More code, vending machines cannot dispense while they are unscrewed. (might remove that)

Only the dmi files are missing now.
This commit is contained in:
Kyrah Abattoir
2013-11-15 20:26:39 +01:00
parent e11b05416b
commit 40f17ebaf2
2 changed files with 53 additions and 44 deletions
+43 -39
View File
@@ -167,24 +167,27 @@
coin = W
user << "<span class='notice'>You insert [W] into [src].</span>"
return
else if(panel_open)
if(refill_canister == null)
..()
else if(istype(W, refill_canister) && refill_canister != null)
if(stat & (BROKEN|NOPOWER))
user << "<span class='notice'>It does nothing.</span>"
else if(istype(W, refill_canister) && refill_canister != null)
if(stat & (BROKEN|NOPOWER))
//we do nothing if the machine is unpowered.
user << "<span class='notice'>It does nothing.</span>"
else if(panel_open)
//if the panel is open
//we attempt to refill the machine
var/obj/item/weapon/vending_refill/canister = W
if(canister.charges == 0)
//there is no charge left in this canister.
user << "<span class='notice'>This [canister.name] is empty!</span>"
else
//we start to refill the machine
var/obj/item/weapon/vending_refill/canister = W
if(canister.charges == 0)
user << "<span class='notice'>This [canister.name] is empty!</span>"
var/transfered = refill_inventory(canister,product_records,user)
if(transfered)
user << "<span class='notice'>You loaded [transfered] items in [name].</span>"
else
var/transfered = refill_inventory(canister,product_records,user)
if(transfered)
user << "<span class='notice'>You loaded [transfered] items in [name].</span>"
else
user << "<span class='notice'>[name] is fully stocked.</span>"
user << "<span class='notice'>[name] is fully stocked.</span>"
return;
else
//the service panel is closed, lets "subtly" hint at opening it.
user << "<span class='notice'>You should probably unscrew the service panel first.</span>"
else
..()
@@ -215,30 +218,31 @@
else
dat += "<i>No coin</i>&nbsp;&nbsp;<span class='linkOff'>Remove</span>"
dat += "<h3>Select an Item</h3>"
dat += "<div class='statusDisplay'>"
if(product_records.len == 0)
dat += "<font color = 'red'>No product loaded!</font>"
else
var/list/display_records = product_records
if(extended_inventory)
display_records = product_records + hidden_records
if(coin)
display_records = product_records + coin_records
if(coin && extended_inventory)
display_records = product_records + hidden_records + coin_records
dat += "<ul>"
for (var/datum/data/vending_product/R in display_records)
dat += "<li>"
if(R.amount > 0)
dat += "<a href='byond://?src=\ref[src];vend=\ref[R]'>Vend</A> "
else
dat += "<span class='linkOff'>Sold Out</span> "
dat += "<FONT color = '[R.display_color]'><B>[R.product_name]</B>:</font>"
dat += " <b>[R.amount]</b>"
dat += "</li>"
dat += "</ul>"
dat += "</div>"
if(!panel_open) //not sure about this, it basically prevent getting items from the machine when the service panel is open.
dat += "<h3>Select an Item</h3>"
dat += "<div class='statusDisplay'>"
if(product_records.len == 0)
dat += "<font color = 'red'>No product loaded!</font>"
else
var/list/display_records = product_records
if(extended_inventory)
display_records = product_records + hidden_records
if(coin)
display_records = product_records + coin_records
if(coin && extended_inventory)
display_records = product_records + hidden_records + coin_records
dat += "<ul>"
for (var/datum/data/vending_product/R in display_records)
dat += "<li>"
if(R.amount > 0)
dat += "<a href='byond://?src=\ref[src];vend=\ref[R]'>Vend</A> "
else
dat += "<span class='linkOff'>Sold Out</span> "
dat += "<FONT color = '[R.display_color]'><B>[R.product_name]</B>:</font>"
dat += " <b>[R.amount]</b>"
dat += "</li>"
dat += "</ul>"
dat += "</div>"
if(panel_open)
dat += wires()
@@ -4,7 +4,7 @@
icon = 'icons/obj/storage.dmi'
icon_state = "box"
item_state = "box"
item_state = "restock_unit"
flags = FPRINT | TABLEPASS| CONDUCT
force = 7.0
throwforce = 15.0
@@ -15,11 +15,11 @@
var/charges = 0 //how many restocking "charges" the refill has
/obj/item/weapon/vending_refill/New()
name = "[machine_name] restocking canister"
name = "\improper [machine_name] restocking unit"
/obj/item/weapon/vending_refill/examine()
set src in usr
var/description = "[src] \icon[src] restocking canister for a [machine_name] machine,"
var/description = "[name] \icon[src],"
if(charges)
usr << "[description] it can restock [charges] item(s)."
else
@@ -29,26 +29,31 @@
/obj/item/weapon/vending_refill/boozeomat
machine_name = "Booze-O-Mat"
icon_state = "refill_booze"
//machine contains max 138 items
charges = 50
/obj/item/weapon/vending_refill/coffee
machine_name = "hot drinks"
icon_state = "refill_joe"
//machine contains max 85 items
charges = 30
/obj/item/weapon/vending_refill/snack
machine_name = "\improper Getmore Chocolate Corp"
machine_name = "Getmore Chocolate Corp"
icon_state = "refill_snack"
//machine contains max 48 items
charges = 15
/obj/item/weapon/vending_refill/cola
machine_name = "\improper Robust Softdrinks"
machine_name = "Robust Softdrinks"
icon_state = "refill_cola"
//machine contains max 65 items
charges = 20
/obj/item/weapon/vending_refill/cigarette
machine_name = "cigarette"
icon_state = "refill_smoke"
//machine contains max 30 items
charges = 10