vending machines
Captalism in the year 2525, everything in a vending machine, even love
Vars | |
Radio | used for narcing on underages |
---|---|
active | Is the machine active (No sales pitches if off)! |
age_restrictions | Whether our age check is currently functional |
bill | Bills we accept? |
canload_access_list | ID's that can load this vending machine wtih refills |
coin | Coins that we accept? |
contraband | List of products this machine sells when you hack it |
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 |
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 |
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 force cost and ID requirements |
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 |
vend_ready | Are we ready to vend?? Is it time?? |
vend_reply | Message sent post vend (Thank you for shopping!) |
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 |
compartmentLoadAccessCheck | Is the passed in user allowed to load this vending machines compartments |
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 |
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
Radio
used for narcing on underages
active
Is the machine active (No sales pitches if off)!
age_restrictions
Whether our age check is currently functional
bill
Bills we accept?
canload_access_list
ID's that can load this vending machine wtih refills
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)
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
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
onstation
Is this item on station or not
if it doesn't originate from off-station during mapload, everything is free
onstation_override
A variable to change on a per instance basis on the map that allows the instance to force cost and ID requirements
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
vend_ready
Are we ready to vend?? Is it time??
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
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
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
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
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"