From 40f17ebaf2cc6c47bbea9ae18f17e3182d51cfda Mon Sep 17 00:00:00 2001 From: Kyrah Abattoir Date: Fri, 15 Nov 2013 20:26:39 +0100 Subject: [PATCH] More code, vending machines cannot dispense while they are unscrewed. (might remove that) Only the dmi files are missing now. --- code/game/machinery/vending.dm | 82 ++++++++++--------- .../objects/items/weapons/vending_items.dm | 15 ++-- 2 files changed, 53 insertions(+), 44 deletions(-) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index bbaf94af574..b720edfb420 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -167,24 +167,27 @@ coin = W user << "You insert [W] into [src]." return - else if(panel_open) - if(refill_canister == null) - ..() - else if(istype(W, refill_canister) && refill_canister != null) - if(stat & (BROKEN|NOPOWER)) - user << "It does nothing." + else if(istype(W, refill_canister) && refill_canister != null) + if(stat & (BROKEN|NOPOWER)) + //we do nothing if the machine is unpowered. + user << "It does nothing." + 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 << "This [canister.name] is empty!" else - //we start to refill the machine - var/obj/item/weapon/vending_refill/canister = W - if(canister.charges == 0) - user << "This [canister.name] is empty!" + var/transfered = refill_inventory(canister,product_records,user) + if(transfered) + user << "You loaded [transfered] items in [name]." else - var/transfered = refill_inventory(canister,product_records,user) - if(transfered) - user << "You loaded [transfered] items in [name]." - else - user << "[name] is fully stocked." + user << "[name] is fully stocked." return; + else + //the service panel is closed, lets "subtly" hint at opening it. + user << "You should probably unscrew the service panel first." else ..() @@ -215,30 +218,31 @@ else dat += "No coin  Remove" - dat += "

Select an Item

" - dat += "
" - if(product_records.len == 0) - dat += "No product loaded!" - 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 += "" - dat += "
" + if(!panel_open) //not sure about this, it basically prevent getting items from the machine when the service panel is open. + dat += "

Select an Item

" + dat += "
" + if(product_records.len == 0) + dat += "No product loaded!" + 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 += "" + dat += "
" if(panel_open) dat += wires() diff --git a/code/game/objects/items/weapons/vending_items.dm b/code/game/objects/items/weapons/vending_items.dm index 4225c1179bf..b556799705c 100644 --- a/code/game/objects/items/weapons/vending_items.dm +++ b/code/game/objects/items/weapons/vending_items.dm @@ -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