vending machines 
Captalism in the year 2525, everything in a vending machine, even love
Vars | |
ad_list | List of ads built from product_ads upon Iniitialize() |
---|---|
age_restrictions | Whether our age check is currently functional |
all_products_free | If this is set to TRUE, all products sold by the vending machine are free (cost nothing). If unset, this will get automatically set to TRUE during init if the machine originates from off-station during mapload. Defaults to null, set it to TRUE or FALSE explicitly on a per-machine basis if you want to force it to be a certain value. |
allow_custom | Whether this vendor can be selected when building a custom vending machine |
coin_records | List of premium product records |
contraband | List of products this machine sells when you hack it |
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 |
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 |
onstation | Is this item on station or not |
onstation_override | DO NOT APPLY THIS GLOBALLY. For mapping var edits only. A variable to change on a per instance basis that allows the instance to avoid having onstation set for them during mapload. Setting this to TRUE means that the vending machine is treated as if it were still onstation if it spawns off-station during mapload. Useful to specify an off-station machine that will be affected by machine-brand intelligence for whatever reason. |
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 |
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. |
product_records | List of standard product records |
product_slogans | String of slogans separated by semicolons, optional |
products | List of products this machine sells |
purchase_message_cooldown | Next world time to send a purchase message |
scan_id | Are we checking the users ID |
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_reply | Message sent post vend (Thank you for shopping!) |
Procs | |
Initialize | Initialize the vending machine |
_vend_greyscale | Vends a greyscale modified item. arguments: menu - greyscale config menu that has been used to vend the item |
build_inventories | Builds all available inventories for the vendor - standard, contraband and premium |
build_inventory | Build the inventory of the vending machine from its product and record lists |
canLoadItem | Are we able to load the item passed in |
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. |
dispense | Common proc that dispenses an item. Called when the item is vended, or gotten some other way. |
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. |
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_restock | After-effects of refilling a vending machine from a refill canister |
pre_throw | A callback called before an item is tossed out |
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. discountless - whether or not to apply discounts |
reset_prices | Reassign the prices of the vending machine as a result of the inflation value, as provided by SSeconomy |
restock | Refill a vending machine from a refill canister |
shock | Shock the passed in user |
speak | Speak the given message verbally Checks if the machine is powered and the message exists |
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 |
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 range - the range of the machine when thrown if not adjacent |
total_stock | Returns the total loaded & max amount of items i.e list(total_loaded, total_maximum) in the vending machine based on the product records and premium records |
untilt | Rights the vendor up, unpinning mobs under it, if any. Arguments: user - mob that has untilted the vendor |
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 |
Var Details
ad_list 
List of ads built from product_ads upon Iniitialize()
age_restrictions 
Whether our age check is currently functional
all_products_free 
If this is set to TRUE, all products sold by the vending machine are free (cost nothing). If unset, this will get automatically set to TRUE during init if the machine originates from off-station during mapload. Defaults to null, set it to TRUE or FALSE explicitly on a per-machine basis if you want to force it to be a certain value.
allow_custom 
Whether this vendor can be selected when building a custom vending machine
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
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
onstation 
Is this item on station or not
if it doesn't originate from off-station during mapload, all_products_free gets automatically set to TRUE if it was unset previously. if it's off-station during mapload, it's also safe from the brand intelligence event
onstation_override 
DO NOT APPLY THIS GLOBALLY. For mapping var edits only. A variable to change on a per instance basis that allows the instance to avoid having onstation set for them during mapload. Setting this to TRUE means that the vending machine is treated as if it were still onstation if it spawns off-station during mapload. Useful to specify an off-station machine that will be affected by machine-brand intelligence for whatever reason.
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
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_reply 
Message sent post vend (Thank you for shopping!)
Proc Details
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:
- FALSE - if the machine was maploaded on a zlevel that doesn't pass the is_station_level check
- TRUE - all other cases
_vend_greyscale
Vends a greyscale modified item. arguments: menu - greyscale config menu that has been used to vend the item
build_inventories
Builds all available inventories for the vendor - standard, contraband and premium
Arguments start_empty - bool to pass into build_inventory that determines whether a product entry starts with available stock or not
build_inventory
Build the inventory of the vending machine from its 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:
- productlist - the list of products that need to be converted
- recordlist - the list containing /datum/data/vending_product datums
- categories - A list in the format of product_categories to source category from
- startempty - should we set vending_product record amount from the product list (so it's prefilled at roundstart)
- premium - Whether the ending products shall have premium or default prices
canLoadItem
Are we able to load the item passed in
Arguments:
- loaded_item - the item being loaded
- user - the user doing the loading
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:
- user - mob that is doing the loading of the vending machine
dispense
Common proc that dispenses an item. Called when the item is vended, or gotten some other way.
Arguments
- datum/data/vending_product/item_record - the vending record which contains the information of the item to dispense
- atom/spawn_location - location to dispense the item to
- silent - should we play the vending sound
- dispense_returned - are we vending out an returned item
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.
Arguments
- obj/item/vended_item - the item that has just been dispensed
- dispense_returned - is this item an returned product
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:
- user - the user restocking us
- restocked - the amount of items we've been refilled with
pre_throw
A callback called before an item is tossed out
Override this if you need to do any special case handling
Arguments:
- thrown_item - obj/item being thrown
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. discountless - whether or not to apply discounts
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:
- recordlist - the list of standard product datums in the vendor to refresh their prices.
- premiumlist - the list of premium product datums in the vendor to refresh their prices.
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:
- canister - the vending canister we are refilling from
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:
- user - the user to shock
- shock_chance - probability the shock happens
speak
Speak the given message verbally Checks if the machine is powered and the message exists
Arguments:
- message - the message to speak
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 range - the range of the machine when thrown if not adjacent
total_stock
Returns the total loaded & max amount of items i.e list(total_loaded, total_maximum) in the vending machine based on the product records and premium records
Arguments
- contraband - should we count contrabrand as well
untilt
Rights the vendor up, unpinning mobs under it, if any. Arguments: user - mob that has untilted the vendor
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