From e6ee419f47501efe043dc5ca092f7476d9994cce Mon Sep 17 00:00:00 2001 From: Kyrah Abattoir Date: Mon, 18 Nov 2013 16:25:36 +0100 Subject: [PATCH] ADDED costume restocking unit REMOVED many useless comments ADDED invoke vending_refill consutructor superclass ADDED: Cargo can order the autodrobe supply crate --- code/datums/supplypacks.dm | 7 +++++ code/game/machinery/vending.dm | 24 +++++------------- .../objects/items/weapons/vending_items.dm | 22 ++++++++-------- icons/obj/vending_restock.dmi | Bin 877 -> 986 bytes 4 files changed, 24 insertions(+), 29 deletions(-) diff --git a/code/datums/supplypacks.dm b/code/datums/supplypacks.dm index f45c5d438d1..f8609bf2908 100644 --- a/code/datums/supplypacks.dm +++ b/code/datums/supplypacks.dm @@ -987,3 +987,10 @@ var/list/all_supply_groups = list(supply_emergency,supply_security,supply_engine cost = 30 containername = "crate" //let's keep it subtle, eh? contraband = 1 + +/datum/supply_packs/misc/autodrobe + name = "Autodrobe Supply crate" + contains = list(/obj/item/weapon/vending_refill/autodrobe, + /obj/item/weapon/vending_refill/autodrobe) + cost = 15 + containername = "autodrobe supply crate" diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index ad463093184..7285681f5dd 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -112,11 +112,8 @@ var/to_restock = 0 for(var/datum/data/vending_product/machine_content in machine) - //first pass we count how many items are missing to_restock += machine_content.max_amount - machine_content.amount - - //we attempt to go on the "fast lane" (restock all to max) if(to_restock <= refill.charges) for(var/datum/data/vending_product/machine_content in machine) if(machine_content.amount != machine_content.max_amount) @@ -125,23 +122,17 @@ refill.charges -= to_restock total = to_restock else - //We need to stock items equally in each categories based on the amount of items missing. - //This algorithm will restock each category by percentage, the more items being missing, the larger the - //amount of refills it will get, keeps stocks even. - var/tmp_charges = refill.charges //we need to cache the charges to keep the equation from changing + var/tmp_charges = refill.charges for(var/datum/data/vending_product/machine_content in machine) var/restock = Ceiling(((machine_content.max_amount - machine_content.amount)/to_restock)*tmp_charges) - - //we cannot restock more than what we have, might happen since we are rounding up. if(restock > refill.charges) restock = refill.charges - machine_content.amount += restock refill.charges -= restock total += restock if(restock) usr << "[restock] of [machine_content.product_name]" - if(refill.charges == 0)//due to rounding, we ran out of refill charges, exit. + if(refill.charges == 0) //due to rounding, we ran out of refill charges, exit. break return total @@ -171,24 +162,20 @@ return 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 + //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 var/transfered = refill_inventory(canister,product_records,user) if(transfered) - user << "You loaded [transfered] items in [name]." + user << "You loaded [transfered] items in \the [name]." else - user << "[name] is fully stocked." + user << "The [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 ..() @@ -694,6 +681,7 @@ /obj/item/clothing/head/rabbitears =1) //Pretty much everything that had a chance to spawn. contraband = list(/obj/item/clothing/suit/cardborg = 1,/obj/item/clothing/head/cardborg = 1,/obj/item/clothing/suit/judgerobe = 1,/obj/item/clothing/head/powdered_wig = 1) premium = list(/obj/item/clothing/suit/hgpirate = 1, /obj/item/clothing/head/hgpiratecap = 1, /obj/item/clothing/head/helmet/roman = 1, /obj/item/clothing/head/helmet/roman/legionaire = 1, /obj/item/clothing/under/roman = 1, /obj/item/clothing/shoes/roman = 1, /obj/item/weapon/shield/riot/roman = 1) + refill_canister = /obj/item/weapon/vending_refill/autodrobe /obj/machinery/vending/dinnerware name = "dinnerware" diff --git a/code/game/objects/items/weapons/vending_items.dm b/code/game/objects/items/weapons/vending_items.dm index 783e48b99ec..3f44e648641 100644 --- a/code/game/objects/items/weapons/vending_items.dm +++ b/code/game/objects/items/weapons/vending_items.dm @@ -15,6 +15,7 @@ var/charges = 0 //how many restocking "charges" the refill has /obj/item/weapon/vending_refill/New() + ..() name = "\improper [machine_name] restocking unit" /obj/item/weapon/vending_refill/examine() @@ -23,36 +24,35 @@ if(charges) usr << "It can restock [charges] item(s)." else - usr << "it is empty!" + usr << "It's empty!" //NOTE I decided to go for about 1/3 of a machine's capacity /obj/item/weapon/vending_refill/boozeomat machine_name = "Booze-O-Mat" icon_state = "refill_booze" - //machine contains max 138 items - charges = 50 + charges = 50//of 138 /obj/item/weapon/vending_refill/coffee machine_name = "hot drinks" icon_state = "refill_joe" - //machine contains max 85 items - charges = 30 + charges = 30//of 85 /obj/item/weapon/vending_refill/snack machine_name = "Getmore Chocolate Corp" - //machine contains max 48 items - charges = 15 + charges = 15//of 48 /obj/item/weapon/vending_refill/cola machine_name = "Robust Softdrinks" icon_state = "refill_cola" - //machine contains max 65 items - charges = 20 + charges = 20//of 65 /obj/item/weapon/vending_refill/cigarette machine_name = "cigarette" icon_state = "refill_smoke" - //machine contains max 30 items - charges = 10 + charges = 10// of 30 +/obj/item/weapon/vending_refill/autodrobe + machine_name = "AutoDrobe" + icon_state = "refill_costume" + charges = 28// of 58 diff --git a/icons/obj/vending_restock.dmi b/icons/obj/vending_restock.dmi index d9c8ef765c237e16b35bf035170033199c9e6de1..ec37cad94c5651c04881ff7e343bdcaabcebb597 100644 GIT binary patch delta 762 zcmVb6?lI6jpCSV>>Pc-uggE6i$cuc049fc#Ce^hfDPO!g8M~2YY;Sm8eoI;PAWwrvAHtPoDvs@ zJDh87)gUQfKlS?+QXs;dx_OZsUKIFKRQ|bBDa3;u$H!M4uYZ_7{;?n6QBhG*QU8q| z{p6=e*7{px$&{qOzprXu)fM9DjnC$b#bT6tf7dUslG4YU6>nBe-8aDT=kvY+>hB@` zdL7_(wW@l(XWHiwe-@q(nCzzr^Sa?41I_0%9-a@FTnGFAidR8C-qhjw zVY79%?^2rf8`l80_qYa_Z?-#^0YsIZfwY_3xBY(qra9EW(fqa$Li6p8+ub$v*GtCq ze*;hhJHX+1JieP9@XF?G+sbPWO0nZ7r@@(>P5*DzKpDJ)3`h4s@wV+8fS)cdgY)vt z0yVhb!OFdZ*6iSP`Ebn#Dn+`#w`-vOhYgtdp>ACBfilqi^5O39m(29{Py+`)91ez8 s1M>rpZ}rF5;Kz50H6?U9!^Z);0hYW6=!C;}N57lyBBIOHn z48vF_4-Z8}Mc=B3Zs4C8KDXZS#h@jAR8h|AnsXlK!YQ%-5ww!3ig8}oj4>YNdhH|# z|2t^u1b_8!pMY@A**}xuVzbsJVt~I=D;Y6B&Y6lBAQu~AU=}xWTQDik6;E<47Q~<# zKR{#Ph)jwr#*0eXv&zkmjVDgLB|Uk^Q~0t30i z3+jGAZ;>~s>%lOs-~dO!`9 zBe^3oRmhzIa?YkW%&UVvYXF&2j)ZgzDylZ!@ ziGS6aF~BO)-X0O zI~dq7+#Zg{;{iGJAnz8Tf!s=o1)v9^!RdTHfA}4!%sKD|7kTmdKj?uo_yBpHI|pcR z*+S@d)R>g|2@$4VZKeu=liYn`5t;O!B3}?=WS;FF#pRL mp8GPrJO9rbl>A@xKkF0L+Ea##h=;BK0000YB;|D