vending machines
Captalism in the year 2525, everything in a vending machine, even love
Vars | |
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 |
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 |
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 |
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 |
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 |
Procs | |
Destroy | 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% |
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 |
build_products_from_categories | Populates list of products with categorized products |
canLoadItem | Are we able to load the item passed in |
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. |
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 |
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 |
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 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 |
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 |
select_colors | Brings up a color config menu for the picked greyscaled item |
shock | Shock the passed in user |
speak | Speak the given message verbally |
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 |
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 |
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 |
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)
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
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%
build_inventories
Prices of vending machines are all increased uniformly. *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 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:
- 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)
build_products_from_categories
Populates list of products with categorized products
canLoadItem
Are we able to load the item passed in
Arguments:
- loaded_item - the item being loaded
- user - the user doing the loading
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:
- user - mob that is doing the loading of the vending machine
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
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
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 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:
- productlist - list of types -> amount
- recordlist - existing record datums
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
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:
- 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
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