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 |
alertradio | used for narcing on underages |
bill | Bills we accept? |
canload_access_list | ID's that can load this vending machine wtih refills |
chef_price | Custom item price |
coin | Coins that we accept? |
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 |
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. |
icon_deny | Icon to flash when user is denied a vend |
icon_vend | Icon when vending an item to the user |
input_display_header | Display header on the input view |
last_reply | Last world tick we sent a vent reply |
last_shopper | 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 |
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_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) |
slogan_delay | How many ticks until we can send another |
small_ads | Small ad messages in the vending screen - random chance of popping up whenever you open it |
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 | Custom item stock |
Procs | |
Initialize | Initialize the vending machine |
build_inventory | Build the inventory of the vending machine from it's product and record lists |
canLoadItem | Are we able to load the item passed in |
charge_user | Charge the user during a vend Returns false if the user could not buy this item |
compartmentLoadAccessCheck | Is the passed in user allowed to load this vending machines compartments |
finish_vend | Finish a vend by consuming power, playing animations & playing sounds |
pre_throw | A callback called before an item is tossed out |
refill_inventory | Refill our inventory from the passed in product list into the record list |
restock | Refill a vending machine from a refill canister |
shock | Shock the passed in user |
speak | Speak the given message verbally |
thank_user | Thank the user for the purchase |
throw_item | Throw an item from our internal inventory out in front of us |
unbuild_inventory | Given a record list, go through and and return a list of type -> amount |
update_canister | Set up a refill canister that matches this machines products |
Var Details
active
Is the machine active (No sales pitches if off)!
age_restrictions
Whether our age check is currently functional
alertradio
used for narcing on underages
bill
Bills we accept?
canload_access_list
ID's that can load this vending machine wtih refills
chef_price
Custom item price
coin
Coins that we accept?
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
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.
icon_deny
Icon to flash when user is denied a vend
icon_vend
Icon when vending an item to the user
input_display_header
Display header on the input view
last_reply
Last world tick we sent a vent reply
last_shopper
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
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, /type/path2) as there is only ever one in stock
product_ads
String of small ad messages in the vending screen - random chance
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)
slogan_delay
How many ticks until we can send another
small_ads
Small ad messages in the vending screen - random chance of popping up whenever you open it
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
Custom item stock
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
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
- startempty - should we set vending_product record amount from the product list (so it's prefilled at roundstart)
canLoadItem
Are we able to load the item passed in
Arguments:
- I - the item being loaded
- user - the user doing the loading
charge_user
Charge the user during a vend Returns false if the user could not buy this item
compartmentLoadAccessCheck
Is the passed in user allowed to load this vending machines compartments
Arguments:
- user - mob that is doing the loading of the vending machine
finish_vend
Finish a vend by consuming power, playing animations & playing sounds
pre_throw
A callback called before an item is tossed out
Override this if you need to do any special case handling
Arguments:
- I - obj/item being thrown
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
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
- prb - 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
thank_user
Thank the user for the purchase
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
unbuild_inventory
Given a record list, go through and and return a list of type -> amount
update_canister
Set up a refill canister that matches this machines products
This is used when the machine is deconstructed, so the items aren't "lost"