From 3bf0063f972a44fab2cfd0db8285da0648a96129 Mon Sep 17 00:00:00 2001 From: Francis Devine Date: Tue, 11 Aug 2015 11:29:56 +1200 Subject: [PATCH 1/3] Check an item exists before trying to eject it --- code/game/machinery/suit_storage_unit.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 67b8c167772..e881e2f0a30 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -319,8 +319,9 @@ MASK = null /obj/machinery/suit_storage_unit/proc/eject_storage() - eject(STORAGE) - STORAGE = null + if(STORAGE) + eject(STORAGE) + STORAGE = null /obj/machinery/suit_storage_unit/proc/eject(atom/movable/ITEM) ITEM.loc = src.loc From 7d3e671a728cae21a6b70d64e0b87ca4bf044762 Mon Sep 17 00:00:00 2001 From: Orange Borg Date: Tue, 18 Aug 2015 14:44:01 +1200 Subject: [PATCH 2/3] Move eject check, clean up dead code in SSU --- code/game/machinery/suit_storage_unit.dm | 86 ++++++++---------------- 1 file changed, 27 insertions(+), 59 deletions(-) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index e881e2f0a30..fb7c9548e6f 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -10,19 +10,24 @@ icon_state = "close" anchored = 1 density = 1 + //Vars to hold internal items var/mob/living/OCCUPANT = null var/obj/item/clothing/suit/space/SUIT = null - var/SUIT_TYPE = null var/obj/item/clothing/head/helmet/space/HELMET = null + var/obj/item/clothing/mask/MASK = null + var/obj/item/STORAGE = null + + //Base types on creation + var/SUIT_TYPE = null var/HELMET_TYPE = null - var/obj/item/clothing/mask/MASK = null //All the stuff that's gonna be stored insiiiiiiiiiiiiiiiiiiide, nyoro~n - var/MASK_TYPE = null //Erro's idea on standarising SSUs whle keeping creation of other SSU types easy: Make a child SSU, name it something then set the TYPE vars to your desired suit output. New() should take it from there by itself. - var/obj/item/STORAGE = null //One-slot storage slot for anything... food not recommended + var/MASK_TYPE = null var/STORAGE_TYPE = null + + //Machine related vars var/isopen = 0 var/islocked = 0 var/isUV = 0 - var/ispowered = 1 //starts powered + var/ispowered = 1 var/isbroken = 0 var/issuperUV = 0 var/panelopen = 0 @@ -30,7 +35,6 @@ var/cycletime_left = 0 -//The units themselves///////////////// /obj/machinery/suit_storage_unit/standard_unit SUIT_TYPE = /obj/item/clothing/suit/space/eva @@ -168,17 +172,13 @@ dat+= "Suit storage unit: Maintenance panel" dat+= "Maintenance panel controls
" dat+= "The panel is ridden with controls, button and meters, labeled in strange signs and symbols that
you cannot understand. Probably the manufactoring world's language.
Among other things, a few controls catch your eye.

" - dat+= text("A small dial with a \"ë\" symbol embroidded on it. It's pointing towards a gauge that reads [].
Turn towards []
",(src.issuperUV ? "15nm" : "185nm"),src,(src.issuperUV ? "185nm" : "15nm") ) + dat+= text("A small dial with a \"ë\" symbol embroidded on it. It's pointing towards a gauge that reads [].
Turn towards []
",(src.issuperUV ? "15nm" : "185nm"),src,(src.issuperUV ? "185nm" : "15nm") ) dat+= text("A thick old-style button, with 2 grimy LED lights next to it. The [] LED is on.
Press button",(src.safetieson? "GREEN" : "RED"),src) dat+= text("

Close panel", user) - //user << browse(dat, "window=ssu_m_panel;size=400x500") - //onclose(user, "ssu_m_panel") else if(src.isUV) //The thing is running its cauterisation cycle. You have to wait. dat += "Suit storage unit" dat+= "Unit is cauterising contents with selected UV ray intensity. Please wait.
" - //dat+= "Cycle end in: [src.cycletimeleft()] seconds. " - //user << browse(dat, "window=ssu_cycling_panel;size=400x500") - //onclose(user, "ssu_cycling_panel") + else if(!src.isbroken) @@ -208,14 +208,12 @@ dat+= text("Unit status: []",(src.islocked? "**LOCKED**
" : "**UNLOCKED**
") ) dat+= text("Start Disinfection cycle
",src) dat += text("

Close control panel", user) - //user << browse(dat, "window=Suit Storage Unit;size=400x500") - //onclose(user, "Suit Storage Unit") + else //Ohhhh shit it's dirty or broken! Let's inform the guy. dat+= "Suit storage unit" dat+= "Unit chamber is too contaminated to continue usage. Please call for a qualified individual to perform maintenance.

" dat+= text("
Close control panel", user) - //user << browse(dat, "window=suit_storage_unit;size=400x500") - //onclose(user, "suit_storage_unit") + var/datum/browser/popup = new(user, "suit_storage_unit", "Suit Storage Unit", 440, 500) popup.set_content(dat) @@ -227,7 +225,7 @@ /obj/machinery/suit_storage_unit/Topic(href, href_list) //I fucking HATE this proc if(..()) return - if(usr == src.OCCUPANT) //No unlocking yourself out! + if(usr == src.OCCUPANT) return if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) usr.set_machine(src) @@ -253,29 +251,15 @@ src.eject_occupant(usr) src.updateUsrDialog() src.update_icon() - /*if (href_list["refresh"]) - src.updateUsrDialog()*/ src.add_fingerprint(usr) return /obj/machinery/suit_storage_unit/proc/toggleUV(mob/user) -// var/protected = 0 -// var/mob/living/carbon/human/H = user if(!src.panelopen) return - - /*if(istype(H)) //Let's check if the guy's wearing electrically insulated gloves - if(H.gloves) - var/obj/item/clothing/gloves/G = H.gloves - if(istype(G,/obj/item/clothing/gloves/yellow)) - protected = 1 - - if(!protected) - playsound(src.loc, "sparks", 75, 1, -1) - user << "You try to touch the controls but you get zapped. There must be a short circuit somewhere." - return*/ - else //welp, the guy is protected, we can continue + + else if(src.issuperUV) user << "You slide the dial back towards \"185nm\"." src.issuperUV = 0 @@ -286,21 +270,8 @@ /obj/machinery/suit_storage_unit/proc/togglesafeties(mob/user) -// var/protected = 0 -// var/mob/living/carbon/human/H = user if(!src.panelopen) //Needed check due to bugs return - - /*if(istype(H)) //Let's check if the guy's wearing electrically insulated gloves - if(H.gloves) - var/obj/item/clothing/gloves/G = H.gloves - if(istype(G,/obj/item/clothing/gloves/yellow) ) - protected = 1 - - if(!protected) - playsound(src.loc, "sparks", 75, 1, -1) - user << "You try to touch the controls but you get zapped. There must be a short circuit somewhere." - return*/ else user << "You push the button. The coloured LED next to it changes." src.safetieson = !src.safetieson @@ -319,12 +290,13 @@ MASK = null /obj/machinery/suit_storage_unit/proc/eject_storage() - if(STORAGE) - eject(STORAGE) - STORAGE = null + eject(STORAGE) + STORAGE = null /obj/machinery/suit_storage_unit/proc/eject(atom/movable/ITEM) - ITEM.loc = src.loc + //Check item still exists - if not, then usually someone has already ejected the item + if(ITEM) + ITEM.loc = src.loc /obj/machinery/suit_storage_unit/proc/dump_everything() for(var/obj/item/ITEM in src) @@ -365,7 +337,7 @@ if(src.OCCUPANT && src.safetieson) user << "WARNING: Biological entity detected in the confines of the Unit's storage. Cannot initiate cycle." return - if(!src.HELMET && !src.MASK && !src.SUIT && !src.STORAGE && !src.OCCUPANT ) //shit's empty yo + if(!src.HELMET && !src.MASK && !src.SUIT && !src.STORAGE && !src.OCCUPANT ) user << "Unit storage bays empty. Nothing to disinfect -- Aborting." return user << "You start the Unit's cauterisation cycle." @@ -376,7 +348,7 @@ src.update_icon() src.updateUsrDialog() - var/i //our counter + var/i spawn(0) for(i=0,i<4,++i) sleep(50) @@ -404,7 +376,7 @@ src.isbroken = 1 src.isopen = 1 src.islocked = 0 - src.eject_occupant(OCCUPANT) //Mixing up these two lines causes bug. DO NOT DO IT. + src.eject_occupant(OCCUPANT) src.isUV = 0 //Cycle ends src.update_icon() src.updateUsrDialog() @@ -422,8 +394,6 @@ if (!src.OCCUPANT) return -// for(var/obj/O in src) -// O.loc = src.loc if (src.OCCUPANT.client) if(user != OCCUPANT) @@ -437,7 +407,7 @@ src.OCCUPANT.loc = src.loc src.OCCUPANT = null if(!src.isopen) - src.isopen = 1 + src.isopeen = 1 src.update_icon() return @@ -495,7 +465,7 @@ M.client.eye = src M.loc = src src.OCCUPANT = M - src.isopen = 0 //Close the thing after the guy gets inside + src.isopen = 0 src.update_icon() src.add_fingerprint(user) @@ -596,5 +566,3 @@ user << "The console controls are far too complicated for your tiny brain!" return - -//////////////////////////////REMINDER: Make it lock once you place some fucker inside. From 28866b07ad391025f17115888229bfaf2711598d Mon Sep 17 00:00:00 2001 From: Orange Borg Date: Tue, 18 Aug 2015 14:51:02 +1200 Subject: [PATCH 3/3] Fix spelling error introduce in cleanup of SSU code --- code/game/machinery/suit_storage_unit.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index fb7c9548e6f..4ba8fe8a619 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -407,7 +407,7 @@ src.OCCUPANT.loc = src.loc src.OCCUPANT = null if(!src.isopen) - src.isopeen = 1 + src.isopen = 1 src.update_icon() return