/tg/ Station 13 - Modules - TypesVar Details - Proc Details

vending machines

Captalism in the year 2525, everything in a vending machine, even love

Vars

activeIs the machine active (No sales pitches if off)!
age_restrictionsWhether our age check is currently functional
billBills we accept?
coinCoins that we accept?
coin_recordsList of premium product records
contrabandList of products this machine sells when you hack it
credits_containedHow many credits does this vending machine have? 20% of all sales go to this pool, and are given freely when the machine is restocked, or successfully tilted. Lost on deconstruction.
crit_chanceThe chance, in percent, of this vendor performing a critical hit on anything it crushes via [tilt].
default_priceDefault price of items if not overridden
displayed_currency_iconfontawesome icon name to use in to display the user's balance in the vendor UI
displayed_currency_nameString of the used currency to display in the vendor UI
extended_inventorycan we access the hidden inventory?
extra_priceDefault price of premium items if not overridden
forcecritIf set to a critical define in crushing.dm, anything this vendor crushes will always be hit with that effect.
hidden_recordsList of contraband product records
icon_denyIcon to flash when user is denied a vend
icon_vendIcon when vending an item to the user
last_replyLast world tick we sent a vent reply
last_shopperThe ref of the last mob to shop with us
last_sloganLast world tick we sent a slogan message out
light_maskName of lighting mask for the vending machine
loaded_itemshow many items have been inserted in a vendor
num_shardsNumber of glass shards the vendor creates and tries to embed into an atom it tilted onto
onstationIs this item on station or not
onstation_overrideA variable to change on a per instance basis on the map that allows the instance to ignore whether it's on the station or not. Useful to force cost and ID requirements. DO NOT APPLY THIS GLOBALLY.
panel_typeIcon for the maintenance panel overlay
pinned_mobsList of mobs stuck under the vendor
premiumList of premium products this machine sells
product_adsString of small ad messages in the vending screen - random chance
product_categoriesList of products this machine sells, categorized. Can only be used as an alternative to products, not alongside it.
product_recordsList of standard product records
product_slogansString of slogans separated by semicolons, optional
productsList of products this machine sells
purchase_message_cooldownNext world time to send a purchase message
scan_idAre we checking the users ID
sec_radioused for narcing on underages
seconds_electrifiedWorld ticks the machine is electified for
shoot_inventoryWhen this is TRUE, we fire items at customers! We're broken!
shoot_inventory_chanceHow likely this is to happen (prob 100) per second
slogan_delayHow many ticks until we can send another
slogan_listList of slogans to scream at potential customers; built upon Iniitialize() of the vendor from product_slogans
squish_damageDamage this vendor does when tilting onto an atom
tiltableWhether this vendor can be tilted over or not
tiltedWhether the vendor is tilted or not
tilted_rotationIf tilted, this variable should always be the rotation that was applied when we were tilted. Stored for the purposes of unapplying it.
vend_readyAre we ready to vend?? Is it time??
vend_replyMessage sent post vend (Thank you for shopping!)
vending_machine_inputItems that the players have loaded into the vendor

Procs

DestroyNon-constructible vending machines do not have a refill canister to populate its products list from, Which apparently is still needed in the case we use product categories instead. in average, it should be 37.5% of the max amount, rounded up to the nearest int, tho the max boundary can be as low/high as 50%/100%
InitializeInitialize the vending machine
atom_breakIntentionally leaving out a case for zero credits as it should be covered by the vending machine's stock being full, or covered by first case if items were returned.
build_inventoriesPrices of vending machines are all increased uniformly. *Builds all available inventories for the vendor - standard, contraband and premium
build_inventoryBuild the inventory of the vending machine from it's product and record lists
build_products_from_categoriesPopulates list of products with categorized products
canLoadItemAre we able to load the item passed in
can_vendWhether this vendor can vend items or not. arguments: user - current customer
collect_records_for_static_dataReturns a list of given product records of the vendor to be used in UI. arguments: records - list of records available categories - list of categories available premium - bool of whether a record should be priced by a custom/premium price or not
compartmentLoadAccessCheckIs the passed in user allowed to load this vending machines compartments? This only is ran if we are using a /obj/item/storage/bag to load the vending machine, and not a dedicated restocker.
create_categories_fromReturns a list of data about the category Arguments: name - string for the name of the category icon - string for the fontawesome icon to use in the UI for the category products - list of products available in the category
deploy_creditsDrop credits when the vendor is attacked.
fetch_balance_to_useReturns the balance that the vendor will use for proceeding payment. Most vendors would want to use the user's card's account credits balance. arguments: passed_id - the id card that will be billed for the product
freebieDispenses free items from the standard stock. Arguments: freebies - number of free items to vend
loadingAttemptTries to insert the item into the vendor, and depending on whether the product is a part of the vendor's stock or not, increments an already present product entry's available amount or creates a new entry. arguments: inserted_item - the item we're trying to insert user - mob who's trying to insert the item
on_dispenseA proc meant to perform custom behavior on newly dispensed items.
post_crush_livingContains structures and items that vendors shouldn't crush when we land on them.
post_restockAfter-effects of refilling a vending machine from a refill canister
pre_throwA callback called before an item is tossed out
proceed_paymentHandles payment processing: discounts, logging, balance change etc. arguments: paying_id_card - the id card that will be billed for the product. mob_paying - the mob that is trying to purchase the item. product_to_vend - the product record of the item we're trying to vend. price_to_use - price of the item we're trying to vend.
refill_inventoryRefill our inventory from the passed in product list into the record list
reset_pricesReassign the prices of the vending machine as a result of the inflation value, as provided by SSeconomy
restockRefill a vending machine from a refill canister
select_colorsBrings up a color config menu for the picked greyscaled item
shockShock the passed in user
speakSpeak the given message verbally
throw_impactCrush the mob that the vending machine got thrown at
throw_itemThrow an item from our internal inventory out in front of us
tiltTilts ontop of the atom supplied, if crit is true some extra shit can happen. See [fall_and_crush] for return values. Arguments: fatty - atom to tilt the vendor onto local_crit_chance - percent chance of a critical hit forced_crit - specific critical hit case to use, if any
total_loaded_stockReturns the total amount of items in the vending machine based on the product records and premium records, but not contraband
total_max_stockReturns the total amount of items in the vending machine based on the product records and premium records, but not contraband
unbuild_inventoryGiven a record list, go through and return a list of products in format of type -> amount Arguments: recordlist - list of records to unbuild products from
unbuild_inventory_intoUnbuild product_records into categorized product lists to the machine's refill canister. Does not handle contraband/premium products, only standard stock and any other categories used by the vendor(see: ClothesMate). If a product has no category, puts it into standard stock category. Arguments: product_records - list of products of the vendor products - list of products of the refill canister product_categories - list of product categories of the refill canister
untiltRights the vendor up, unpinning mobs under it, if any. Arguments: user - mob that has untilted the vendor
update_canisterSet up a refill canister that matches this machine's products
vendThe entire shebang of vending the picked item. Processes the vending and initiates the payment for the item. arguments: greyscale_colors - greyscale config for the item we're about to vend, if any
vend_greyscaleVends a greyscale modified item. arguments: menu - greyscale config menu that has been used to vend the item

Var Details

active

Is the machine active (No sales pitches if off)!

age_restrictions

Whether our age check is currently functional

bill

Bills we accept?

coin

Coins that we accept?

coin_records

List of premium product records

contraband

List of products this machine sells when you hack it

form should be list(/type/path = amount, /type/path2 = amount2)

credits_contained

How many credits does this vending machine have? 20% of all sales go to this pool, and are given freely when the machine is restocked, or successfully tilted. Lost on deconstruction.

crit_chance

The chance, in percent, of this vendor performing a critical hit on anything it crushes via [tilt].

default_price

Default price of items if not overridden

displayed_currency_icon

fontawesome icon name to use in to display the user's balance in the vendor UI

displayed_currency_name

String of the used currency to display in the vendor UI

extended_inventory

can we access the hidden inventory?

extra_price

Default price of premium items if not overridden

forcecrit

If set to a critical define in crushing.dm, anything this vendor crushes will always be hit with that effect.

hidden_records

List of contraband product records

icon_deny

Icon to flash when user is denied a vend

icon_vend

Icon when vending an item to the user

last_reply

Last world tick we sent a vent reply

last_shopper

The ref of the last mob to shop with us

last_slogan

Last world tick we sent a slogan message out

light_mask

Name of lighting mask for the vending machine

loaded_items

how many items have been inserted in a vendor

num_shards

Number of glass shards the vendor creates and tries to embed into an atom it tilted onto

onstation

Is this item on station or not

if it doesn't originate from off-station during mapload, everything is free if it's off-station during mapload, it's also safe from the brand intelligence event

onstation_override

A variable to change on a per instance basis on the map that allows the instance to ignore whether it's on the station or not. Useful to force cost and ID requirements. DO NOT APPLY THIS GLOBALLY.

panel_type

Icon for the maintenance panel overlay

pinned_mobs

List of mobs stuck under the vendor

premium

List of premium products this machine sells

form should be list(/type/path = amount, /type/path2 = amount2)

product_ads

String of small ad messages in the vending screen - random chance

product_categories

List of products this machine sells, categorized. Can only be used as an alternative to products, not alongside it.

Form should be list( "name" = "Category Name", "icon" = "UI Icon (Font Awesome or tgfont)", "products" = list(/type/path = amount, ...), )

product_records

List of standard product records

product_slogans

String of slogans separated by semicolons, optional

products

List of products this machine sells

form should be list(/type/path = amount, /type/path2 = amount2)

purchase_message_cooldown

Next world time to send a purchase message

scan_id

Are we checking the users ID

sec_radio

used for narcing on underages

seconds_electrified

World ticks the machine is electified for

shoot_inventory

When this is TRUE, we fire items at customers! We're broken!

shoot_inventory_chance

How likely this is to happen (prob 100) per second

slogan_delay

How many ticks until we can send another

slogan_list

List of slogans to scream at potential customers; built upon Iniitialize() of the vendor from product_slogans

squish_damage

Damage this vendor does when tilting onto an atom

tiltable

Whether this vendor can be tilted over or not

tilted

Whether the vendor is tilted or not

tilted_rotation

If tilted, this variable should always be the rotation that was applied when we were tilted. Stored for the purposes of unapplying it.

vend_ready

Are we ready to vend?? Is it time??

vend_reply

Message sent post vend (Thank you for shopping!)

vending_machine_input

Items that the players have loaded into the vendor

Proc Details

Destroy

Non-constructible vending machines do not have a refill canister to populate its products list from, Which apparently is still needed in the case we use product categories instead. in average, it should be 37.5% of the max amount, rounded up to the nearest int, tho the max boundary can be as low/high as 50%/100%

Initialize

Initialize the vending machine

Builds the vending machine inventory, sets up slogans and other such misc work

This also sets the onstation var to:

atom_break

Intentionally leaving out a case for zero credits as it should be covered by the vending machine's stock being full, or covered by first case if items were returned.

build_inventories

Prices of vending machines are all increased uniformly. *Builds all available inventories for the vendor - standard, contraband and premium

build_inventory

Build the inventory of the vending machine from it's product and record lists

This builds up a full set of /datum/data/vending_products from the product list of the vending machine type Arguments:

build_products_from_categories

Populates list of products with categorized products

canLoadItem

Are we able to load the item passed in

Arguments:

can_vend

Whether this vendor can vend items or not. arguments: user - current customer

collect_records_for_static_data

Returns a list of given product records of the vendor to be used in UI. arguments: records - list of records available categories - list of categories available premium - bool of whether a record should be priced by a custom/premium price or not

compartmentLoadAccessCheck

Is the passed in user allowed to load this vending machines compartments? This only is ran if we are using a /obj/item/storage/bag to load the vending machine, and not a dedicated restocker.

Arguments:

create_categories_from

Returns a list of data about the category Arguments: name - string for the name of the category icon - string for the fontawesome icon to use in the UI for the category products - list of products available in the category

deploy_credits

Drop credits when the vendor is attacked.

fetch_balance_to_use

Returns the balance that the vendor will use for proceeding payment. Most vendors would want to use the user's card's account credits balance. arguments: passed_id - the id card that will be billed for the product

freebie

Dispenses free items from the standard stock. Arguments: freebies - number of free items to vend

loadingAttempt

Tries to insert the item into the vendor, and depending on whether the product is a part of the vendor's stock or not, increments an already present product entry's available amount or creates a new entry. arguments: inserted_item - the item we're trying to insert user - mob who's trying to insert the item

on_dispense

A proc meant to perform custom behavior on newly dispensed items.

post_crush_living

Contains structures and items that vendors shouldn't crush when we land on them.

post_restock

After-effects of refilling a vending machine from a refill canister

This takes the amount of products restocked and gives the user our contained credits if needed, sending the user a fitting message.

Arguments:

pre_throw

A callback called before an item is tossed out

Override this if you need to do any special case handling

Arguments:

proceed_payment

Handles payment processing: discounts, logging, balance change etc. arguments: paying_id_card - the id card that will be billed for the product. mob_paying - the mob that is trying to purchase the item. product_to_vend - the product record of the item we're trying to vend. price_to_use - price of the item we're trying to vend.

refill_inventory

Refill our inventory from the passed in product list into the record list

Arguments:

reset_prices

Reassign the prices of the vending machine as a result of the inflation value, as provided by SSeconomy

This rebuilds both /datum/data/vending_products lists for premium and standard products based on their most relevant pricing values. Arguments:

restock

Refill a vending machine from a refill canister

This takes the products from the refill canister and then fills the products, contraband and premium product categories

Arguments:

select_colors

Brings up a color config menu for the picked greyscaled item

shock

Shock the passed in user

This checks we have power and that the passed in prob is passed, then generates some sparks and calls electrocute_mob on the user

Arguments:

speak

Speak the given message verbally

Checks if the machine is powered and the message exists

Arguments:

throw_impact

Crush the mob that the vending machine got thrown at

throw_item

Throw an item from our internal inventory out in front of us

This is called when we are hacked, it selects a random product from the records that has an amount > 0 This item is then created and tossed out in front of us with a visible message

tilt

Tilts ontop of the atom supplied, if crit is true some extra shit can happen. See [fall_and_crush] for return values. Arguments: fatty - atom to tilt the vendor onto local_crit_chance - percent chance of a critical hit forced_crit - specific critical hit case to use, if any

total_loaded_stock

Returns the total amount of items in the vending machine based on the product records and premium records, but not contraband

total_max_stock

Returns the total amount of items in the vending machine based on the product records and premium records, but not contraband

unbuild_inventory

Given a record list, go through and return a list of products in format of type -> amount Arguments: recordlist - list of records to unbuild products from

unbuild_inventory_into

Unbuild product_records into categorized product lists to the machine's refill canister. Does not handle contraband/premium products, only standard stock and any other categories used by the vendor(see: ClothesMate). If a product has no category, puts it into standard stock category. Arguments: product_records - list of products of the vendor products - list of products of the refill canister product_categories - list of product categories of the refill canister

untilt

Rights the vendor up, unpinning mobs under it, if any. Arguments: user - mob that has untilted the vendor

update_canister

Set up a refill canister that matches this machine's products

This is used when the machine is deconstructed, so the items aren't "lost"

vend

The entire shebang of vending the picked item. Processes the vending and initiates the payment for the item. arguments: greyscale_colors - greyscale config for the item we're about to vend, if any

vend_greyscale

Vends a greyscale modified item. arguments: menu - greyscale config menu that has been used to vend the item