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

vending machines

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

Vars

Radioused for narcing on underages
activeIs the machine active (No sales pitches if off)!
age_restrictionsWhether our age check is currently functional
billBills we accept?
canload_access_listID's that can load this vending machine wtih refills
coinCoins that we accept?
contrabandList of products this machine sells when you hack it
default_priceDefault price of items if not overridden
extended_inventorycan we access the hidden inventory?
extra_priceDefault price of premium items if not overridden
icon_denyIcon to flash when user is denied a vend
icon_vendIcon when vending an item to the user
input_display_headerDisplay header on the input view
last_replyLast world tick we sent a vent reply
last_shopperLast 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
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 force cost and ID requirements
premiumList of premium products this machine sells
product_adsString of small ad messages in the vending screen - random chance
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
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
small_adsSmall ad messages in the vending screen - random chance of popping up whenever you open it
vend_readyAre we ready to vend?? Is it time??
vend_replyMessage sent post vend (Thank you for shopping!)

Procs

InitializeInitialize the vending machine
build_inventoryBuild the inventory of the vending machine from it's product and record lists
canLoadItemAre we able to load the item passed in
compartmentLoadAccessCheckIs the passed in user allowed to load this vending machines compartments
pre_throwA callback called before an item is tossed out
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
shockShock the passed in user
speakSpeak the given message verbally
throw_itemThrow an item from our internal inventory out in front of us
unbuild_inventoryGiven a record list, go through and and return a list of type -> amount
update_canisterSet 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) per second

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:

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:

canLoadItem

Are we able to load the item passed in

Arguments:

compartmentLoadAccessCheck

Is the passed in user allowed to load this vending machines compartments

Arguments:

pre_throw

A callback called before an item is tossed out

Override this if you need to do any special case handling

Arguments:

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:

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_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"