From 3d12d0b23445f26bc5cf0e5aabc3abfd0cfd407d Mon Sep 17 00:00:00 2001 From: GauHelldragon Date: Wed, 2 Jan 2013 11:27:51 -0800 Subject: [PATCH] Seedbags now put their ouputing seeds into your hand Added "Unload All" button to interface --- .../game/objects/items/weapons/hydroponics.dm | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/code/game/objects/items/weapons/hydroponics.dm b/code/game/objects/items/weapons/hydroponics.dm index e7a9278bdd..1b88005096 100644 --- a/code/game/objects/items/weapons/hydroponics.dm +++ b/code/game/objects/items/weapons/hydroponics.dm @@ -52,7 +52,7 @@ flags = FPRINT | TABLEPASS slot_flags = SLOT_BELT w_class = 1 - var/item_quants = list() + var/list/item_quants = list() /obj/item/weapon/seedbag/attack_self(mob/user as mob) user.machine = src @@ -114,6 +114,7 @@ dat += "Vend" dat += "
" + dat += "
Unload All" dat += "" user << browse("Seedbag Supplies[dat]", "window=seedbag") onclose(user, "seedbag") @@ -123,17 +124,24 @@ return usr.machine = src + if ( href_list["vend"] ) + var/N = href_list["vend"] - var/N = href_list["vend"] + if(item_quants[N] <= 0) // Sanity check, there are probably ways to press the button when it shouldn't be possible. + return - if(item_quants[N] <= 0) // Sanity check, there are probably ways to press the button when it shouldn't be possible. - return + item_quants[N] -= 1 + for(var/obj/O in contents) + if(O.name == N) + O.loc = get_turf(src) + usr.put_in_hands(O) + break - item_quants[N] -= 1 - for(var/obj/O in contents) - if(O.name == N) + else if ( href_list["unload"] ) + item_quants.Cut() + for(var/obj/O in contents ) O.loc = get_turf(src) - break + src.updateUsrDialog() return