From 2f03f0fabd602cf19121de0e2748b3229b1ecf0d Mon Sep 17 00:00:00 2001 From: phil235 Date: Thu, 12 Jun 2014 23:06:42 +0200 Subject: [PATCH] Door Assembly exploit fix --- code/game/objects/structures/door_assembly.dm | 61 +++++++++++-------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index 553122c43fb..f447bc1f405 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -318,8 +318,10 @@ obj/structure/door_assembly /obj/structure/door_assembly/attackby(obj/item/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/pen)) var/t = copytext(stripped_input(user, "Enter the name for the door.", src.name, src.created_name),1,MAX_NAME_LEN) - if(!t) return - if(!in_range(src, usr) && src.loc != usr) return + if(!t) + return + if(!in_range(src, usr) && src.loc != usr) + return created_name = t return @@ -343,7 +345,8 @@ obj/structure/door_assembly icontype = input(user, "Please select a paintjob for this airlock.") in optionlist - if((!in_range(src, usr) && src.loc != usr) || !WT.use(user)) return + if((!in_range(src, usr) && src.loc != usr) || !WT.use(user)) + return var/has_solid = 0 var/has_glass = 0 switch(icontype) @@ -414,7 +417,7 @@ obj/structure/door_assembly if(mineral && mineral != "glass") mineral = null //I know this is stupid, but until we change glass to a boolean it's how this code works. - user << "\blue You change the paintjob on the airlock assembly." + user << " You change the paintjob on the airlock assembly." else if(istype(W, /obj/item/weapon/weldingtool) && !anchored ) var/obj/item/weapon/weldingtool/WT = W @@ -423,8 +426,9 @@ obj/structure/door_assembly playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) if(do_after(user, 40)) - if(!src || !WT.isOn()) return - user << "\blue You've dissasembled the airlock assembly." + if(!src || !WT.isOn()) + return + user << " You've disassembled the airlock assembly." new /obj/item/stack/sheet/metal(get_turf(src), 4) if (mineral) if (mineral == "glass") @@ -435,7 +439,7 @@ obj/structure/door_assembly new M(get_turf(src)) qdel(src) else - user << "\blue You need more welding fuel to dissassemble the airlock assembly." + user << " You need more welding fuel to dissassemble the airlock assembly." return else if(istype(W, /obj/item/weapon/wrench) && !anchored ) @@ -443,8 +447,9 @@ obj/structure/door_assembly user.visible_message("[user] secures the airlock assembly to the floor.", "You start to secure the airlock assembly to the floor.") if(do_after(user, 40)) - if(!src) return - user << "\blue You've secured the airlock assembly." + if(!src || src.anchored ) + return + user << " You've secured the airlock assembly." src.name = "secured airlock assembly" src.anchored = 1 @@ -452,8 +457,9 @@ obj/structure/door_assembly playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1) user.visible_message("[user] unsecures the airlock assembly from the floor.", "You start to unsecure the airlock assembly from the floor.") if(do_after(user, 40)) - if(!src) return - user << "\blue You've unsecured the airlock assembly." + if(!src || !src.anchored ) + return + user << " You've unsecured the airlock assembly." src.name = "airlock assembly" src.anchored = 0 @@ -461,10 +467,11 @@ obj/structure/door_assembly var/obj/item/stack/cable_coil/coil = W user.visible_message("[user] wires the airlock assembly.", "You start to wire the airlock assembly.") if(do_after(user, 40)) - if(!src) return + if(!src) + return coil.use(1) src.state = 1 - user << "\blue You've wired the airlock assembly." + user << " You've wired the airlock assembly." src.name = "wired airlock assembly" else if(istype(W, /obj/item/weapon/wirecutters) && state == 1 ) @@ -472,8 +479,9 @@ obj/structure/door_assembly user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.") if(do_after(user, 40)) - if(!src) return - user << "\blue You've cut the wires from the airlock assembly." + if(!src || src.state != 1 ) + return + user << " You've cut the wires from the airlock assembly." new/obj/item/stack/cable_coil(get_turf(user), 1) src.state = 0 src.name = "secured airlock assembly" @@ -485,8 +493,9 @@ obj/structure/door_assembly W.loc = src if(do_after(user, 40)) - if(!src) return - user << "\blue You've installed the airlock electronics." + if(!src || src.state != 1 ) + return + user << " You've installed the airlock electronics." src.state = 2 src.name = "near finished airlock assembly" src.electronics = W @@ -500,8 +509,9 @@ obj/structure/door_assembly user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to remove the electronics from the airlock assembly.") if(do_after(user, 40)) - if(!src) return - user << "\blue You've removed the airlock electronics." + if( !src || src.state != 2 ) + return + user << " You've removed the airlock electronics." src.state = 1 src.name = "wired airlock assembly" var/obj/item/weapon/airlock_electronics/ae @@ -519,7 +529,7 @@ obj/structure/door_assembly playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1) user.visible_message("[user] adds [G.name] to the airlock assembly.", "You start to install [G.name] into the airlock assembly.") if(do_after(user, 40)) - user << "\blue You've installed reinforced glass windows into the airlock assembly." + user << " You've installed reinforced glass windows into the airlock assembly." G.use(1) mineral = "glass" name = "near finished window airlock assembly" @@ -541,7 +551,7 @@ obj/structure/door_assembly playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1) user.visible_message("[user] adds [G.name] to the airlock assembly.", "You start to install [G.name] into the airlock assembly.") if(do_after(user, 40)) - user << "\blue You've installed [M] plating into the airlock assembly." + user << " You've installed [M] plating into the airlock assembly." G.use(2) mineral = "[M]" name = "near finished [M] airlock assembly" @@ -552,11 +562,12 @@ obj/structure/door_assembly else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 ) playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1) - user << "\blue You start finishing the airlock." + user.visible_message("[user] finishes the airlock.", "You start finishing the airlock.") if(do_after(user, 40)) - if(!src) return - user << "\blue You've finished the airlock." + if(!src) + return + user << " You've finished the airlock." var/obj/machinery/door/airlock/door if(mineral == "glass") door = new src.glass_type( src.loc ) @@ -580,4 +591,4 @@ obj/structure/door_assembly icon_state = "[base_icon_state][state]" //This updates the icon_state. They are named as "door_as1_eng" where the 1 in that example //represents what state it's in. So the most generic algorithm for the correct updating of - //this is simply to change the number. \ No newline at end of file + //this is simply to change the number.