From 762ee20a08653dc2af6dd32908d490e898e096cc Mon Sep 17 00:00:00 2001 From: phil235 Date: Fri, 19 Sep 2014 22:42:53 +0200 Subject: [PATCH 1/4] Fixes wrong ignite adminlog message when clicking plasma airlock with hand. Fixes checks during welding of closets, walls, mineral walls, airlocks. --- code/game/machinery/doors/airlock.dm | 19 +++-- .../structures/crates_lockers/closets.dm | 41 +++++----- code/game/turfs/simulated/walls.dm | 74 ++++++++++--------- 3 files changed, 71 insertions(+), 63 deletions(-) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index ed5e9f3f878..e4bb9365afa 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -888,11 +888,13 @@ About the new airlock wires panel: src.add_fingerprint(user) if((istype(C, /obj/item/weapon/weldingtool) && !( src.operating ) && src.density)) var/obj/item/weapon/weldingtool/W = C - user << "You begin [welded ? "unwelding":"welding"] the airlock..." - playsound(loc, 'sound/items/Welder.ogg', 40, 1) - if(do_after(user,40,5,1)) - if(density && !operating)//Door must be closed to weld. - if(W.remove_fuel(0,user)) + if(W.remove_fuel(0,user)) + user << "You begin [welded ? "unwelding":"welding"] the airlock..." + playsound(loc, 'sound/items/Welder.ogg', 40, 1) + if(do_after(user,40,5,1)) + if(density && !operating)//Door must be closed to weld. + if( !istype(src, /obj/machinery/door/airlock) || !user || !W || !W.isOn() || !user.loc ) + return playsound(loc, 'sound/items/Welder2.ogg', 50, 1) welded = !welded user << "You [welded ? "welded the airlock shut":"unwelded the airlock"]" @@ -1013,10 +1015,11 @@ About the new airlock wires panel: return /obj/machinery/door/airlock/plasma/attackby(C as obj, mob/user as mob) - if(C) - message_admins("Plasma airlock ignited by [key_name(user, user.client)](?) in ([x],[y],[z] - JMP)",0,1) - log_game("Plasma airlock ignited by [user.ckey]([user]) in ([x],[y],[z])") + if(is_hot(C) > 300)//If the temperature of the object is over 300, then ignite + message_admins("Plasma wall ignited by [key_name(user, user.client)](?) in ([x],[y],[z] - JMP)",0,1) + log_game("Plasma wall ignited by [user.ckey]([user]) in ([x],[y],[z])") ignite(is_hot(C)) + return ..() /obj/machinery/door/airlock/open(var/forced=0) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 9c772d349b2..92a862ee1c2 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -179,16 +179,16 @@ if(istype(W, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = W - user << "You begin cutting the [src] apart..." - playsound(loc, 'sound/items/Welder.ogg', 40, 1) - if(do_after(user,40,5,1)) - if(src.opened) - if(WT.remove_fuel(0,user)) - playsound(loc, 'sound/items/Welder2.ogg', 50, 1) - new /obj/item/stack/sheet/metal(src.loc) - for(var/mob/M in viewers(src)) - M.show_message("\The [src] has been cut apart by [user] with \the [WT].", 3, "You hear welding.", 2) - qdel(src) + if(WT.remove_fuel(0,user)) + user << "You begin cutting the [src] apart..." + playsound(loc, 'sound/items/Welder.ogg', 40, 1) + if(do_after(user,40,5,1)) + if( !src.opened || !istype(src, /obj/structure/closet) || !user || !WT || !WT.isOn() || !user.loc ) + return + playsound(loc, 'sound/items/Welder2.ogg', 50, 1) + new /obj/item/stack/sheet/metal(src.loc) + visible_message("\The [src] has been cut apart by [user] with \the [WT].", "You hear welding.") + qdel(src) return if(isrobot(user)) @@ -201,16 +201,17 @@ return else if(istype(W, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = W - user << "You begin [welded ? "unwelding":"welding"] the [src]..." - playsound(loc, 'sound/items/Welder2.ogg', 40, 1) - if(do_after(user,40,5,1)) - if(!src.opened) - if(WT.remove_fuel(0,user)) - playsound(loc, 'sound/items/welder.ogg', 50, 1) - welded = !welded - user << "You [welded ? "welded the [src] shut":"unwelded the [src]"]" - update_icon() - user.visible_message("[src] has been [welded? "welded shut":"unwelded"] by [user.name].") + if(WT.remove_fuel(0,user)) + user << "You begin [welded ? "unwelding":"welding"] the [src]..." + playsound(loc, 'sound/items/Welder2.ogg', 40, 1) + if(do_after(user,40,5,1)) + if(src.opened || !istype(src, /obj/structure/closet) || !user || !WT || !WT.isOn() || !user.loc ) + return + playsound(loc, 'sound/items/welder.ogg', 50, 1) + welded = !welded + user << "You [welded ? "welded the [src] shut":"unwelded the [src]"]" + update_icon() + user.visible_message("[src] has been [welded? "welded shut":"unwelded"] by [user.name].") return else if(!place(user, W)) src.attack_hand(user) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index ef645aa7963..31eb386c918 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -221,12 +221,12 @@ user << "You begin slicing through the outer plating." playsound(src, 'sound/items/Welder.ogg', 100, 1) - sleep(100) - if( !istype(src, /turf/simulated/wall) || !user || !WT || !WT.isOn() || !T ) return - - if( user.loc == T && user.get_active_hand() == WT ) - user << "You remove the outer plating." - dismantle_wall() + if(do_after(user, 100)) + if( !istype(src, /turf/simulated/wall) || !user || !WT || !WT.isOn() || !T ) + return + if( user.loc == T && user.get_active_hand() == WT ) + user << "You remove the outer plating." + dismantle_wall() else return @@ -235,16 +235,18 @@ user << "You begin slicing through the outer plating." playsound(src, 'sound/items/Welder.ogg', 100, 1) - sleep(60) - if(mineral == "diamond")//Oh look, it's tougher - sleep(60) - if( !istype(src, /turf/simulated/wall) || !user || !W || !T ) return + if(do_after(user, 60)) + if(mineral == "diamond")//Oh look, it's tougher + if(!do_after(user, 60)) + return - if( user.loc == T && user.get_active_hand() == W ) - user << "You remove the outer plating." - dismantle_wall() - for(var/mob/O in viewers(user, 5)) - O.show_message("The wall was sliced apart by [user]!", 1, "You hear metal being sliced apart.", 2) + if( !istype(src, /turf/simulated/wall) || !user || !W || !T ) + return + + if( user.loc == T && user.get_active_hand() == W ) + user << "You remove the outer plating." + dismantle_wall() + visible_message("The wall was sliced apart by [user]!", "You hear metal being sliced apart.") return //DRILLING @@ -252,16 +254,17 @@ user << "You begin to drill though the wall." - sleep(60) - if(mineral == "diamond") - sleep(60) - if( !istype(src, /turf/simulated/wall) || !user || !W || !T ) return + if(do_after(user, 60)) + if(mineral == "diamond")//Oh look, it's tougher + if(!do_after(user, 60)) + return + if( !istype(src, /turf/simulated/wall) || !user || !W || !T ) + return - if( user.loc == T && user.get_active_hand() == W ) - user << "Your drill tears though the last of the reinforced plating." - dismantle_wall() - for(var/mob/O in viewers(user, 5)) - O.show_message("The wall was drilled through by [user]!", 1, "You hear the grinding of metal.", 2) + if( user.loc == T && user.get_active_hand() == W ) + user << "Your drill tears though the last of the reinforced plating." + dismantle_wall() + visible_message("The wall was drilled through by [user]!", "You hear the grinding of metal.") return else if( istype(W, /obj/item/weapon/melee/energy/blade) ) @@ -271,18 +274,19 @@ user << "You stab \the [EB] into the wall and begin to slice it apart." playsound(src, "sparks", 50, 1) - sleep(70) - if(mineral == "diamond") - sleep(70) - if( !istype(src, /turf/simulated/wall) || !user || !EB || !T ) return + if(do_after(user, 70)) + if(mineral == "diamond")//Oh look, it's tougher + if(!do_after(user, 70)) + return + if( !istype(src, /turf/simulated/wall) || !user || !EB || !T ) + return - if( user.loc == T && user.get_active_hand() == W ) - EB.spark_system.start() - playsound(src, "sparks", 50, 1) - playsound(src, 'sound/weapons/blade1.ogg', 50, 1) - dismantle_wall(1) - for(var/mob/O in viewers(user, 5)) - O.show_message("The wall was sliced apart by [user]!", 1, "You hear metal being sliced apart and sparks flying.", 2) + if( user.loc == T && user.get_active_hand() == W ) + EB.spark_system.start() + playsound(src, "sparks", 50, 1) + playsound(src, 'sound/weapons/blade1.ogg', 50, 1) + dismantle_wall(1) + visible_message("The wall was sliced apart by [user]!", "You hear metal being sliced apart and sparks flying.") return else if(istype(W,/obj/item/apc_frame)) From 8f3ab9eaca72098dd293c14f7a4f9d4963b61e29 Mon Sep 17 00:00:00 2001 From: phil235 Date: Sat, 4 Oct 2014 16:49:11 +0200 Subject: [PATCH 2/4] simplifying thermite ignition code on walls. Fixes being able to move around while deconstruction procedures of rwall(replacing sleep() with do_after() ). Simplifying code and fixing inconsistency with slicing diamond wall ( weldingtool faster than drill/cutter at slicing diamond wall ) --- code/game/turfs/simulated/walls.dm | 68 ++------- code/game/turfs/simulated/walls_reinforced.dm | 131 +++++++++--------- 2 files changed, 75 insertions(+), 124 deletions(-) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 31eb386c918..9539fba3b11 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -155,45 +155,10 @@ //THERMITE related stuff. Calls src.thermitemelt() which handles melting simulated walls and the relevant effects if( thermite ) - if( istype(W, /obj/item/weapon/weldingtool) ) - var/obj/item/weapon/weldingtool/WT = W - if( WT.remove_fuel(0,user) ) - thermitemelt(user) - return - - else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter)) + if(is_hot(W)) thermitemelt(user) - return - else if(istype(W, /obj/item/weapon/lighter)) - var/obj/item/weapon/lighter/L = W - if(L.lit) - thermitemelt(user) - return - - else if(istype(W, /obj/item/weapon/match)) - var/obj/item/weapon/match/M = W - if(M.lit) - thermitemelt(user) - return - - else if(istype(W, /obj/item/device/flashlight/flare/torch)) - var/obj/item/device/flashlight/flare/torch/T = W - if(T.on) - thermitemelt(user) - return - - else if(istype(W, /obj/item/device/assembly/igniter)) - thermitemelt(user) - return - - else if(istype(W, /obj/item/candle)) - var/obj/item/candle/C = W - if(C.lit) - thermitemelt(user) - return - - else if( istype(W, /obj/item/weapon/melee/energy/blade) ) + if( istype(W, /obj/item/weapon/melee/energy/blade) ) var/obj/item/weapon/melee/energy/blade/EB = W EB.spark_system.start() @@ -201,16 +166,11 @@ playsound(src, "sparks", 50, 1) playsound(src, 'sound/weapons/blade1.ogg', 50, 1) - thermitemelt(user) - return - - else if(istype(W, /obj/item/weapon/melee/energy/sword)) - var/obj/item/weapon/melee/energy/sword/ES = W - if(ES.active) - thermitemelt(user) - return var/turf/T = user.loc //get user's location for delay checks + var/slicing_duration = 100 //default time taken to slice the wall + if( mineral == "diamond" ) + slicing_duration = 200 //diamond wall takes twice as much time //DECONSTRUCTION add_fingerprint(user) @@ -221,7 +181,7 @@ user << "You begin slicing through the outer plating." playsound(src, 'sound/items/Welder.ogg', 100, 1) - if(do_after(user, 100)) + if(do_after(user, slicing_duration)) if( !istype(src, /turf/simulated/wall) || !user || !WT || !WT.isOn() || !T ) return if( user.loc == T && user.get_active_hand() == WT ) @@ -235,11 +195,7 @@ user << "You begin slicing through the outer plating." playsound(src, 'sound/items/Welder.ogg', 100, 1) - if(do_after(user, 60)) - if(mineral == "diamond")//Oh look, it's tougher - if(!do_after(user, 60)) - return - + if(do_after(user, slicing_duration*0.6)) // plasma cutter is faster than welding tool if( !istype(src, /turf/simulated/wall) || !user || !W || !T ) return @@ -254,10 +210,7 @@ user << "You begin to drill though the wall." - if(do_after(user, 60)) - if(mineral == "diamond")//Oh look, it's tougher - if(!do_after(user, 60)) - return + if(do_after(user, slicing_duration*0.6)) // diamond drill is faster than welding tool slicing if( !istype(src, /turf/simulated/wall) || !user || !W || !T ) return @@ -274,10 +227,7 @@ user << "You stab \the [EB] into the wall and begin to slice it apart." playsound(src, "sparks", 50, 1) - if(do_after(user, 70)) - if(mineral == "diamond")//Oh look, it's tougher - if(!do_after(user, 70)) - return + if(do_after(user, slicing_duration*0.7)) //energy blade slicing is faster than welding tool slicing if( !istype(src, /turf/simulated/wall) || !user || !EB || !T ) return diff --git a/code/game/turfs/simulated/walls_reinforced.dm b/code/game/turfs/simulated/walls_reinforced.dm index ed18c29dc8c..acc6985e841 100644 --- a/code/game/turfs/simulated/walls_reinforced.dm +++ b/code/game/turfs/simulated/walls_reinforced.dm @@ -22,17 +22,10 @@ //THERMITE related stuff. Calls src.thermitemelt() which handles melting simulated walls and the relevant effects if( thermite ) - if( istype(W, /obj/item/weapon/weldingtool) ) - var/obj/item/weapon/weldingtool/WT = W - if( WT.remove_fuel(0,user) ) - thermitemelt(user) - return - - else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter)) + if( is_hot(W) ) thermitemelt(user) - return - else if( istype(W, /obj/item/weapon/melee/energy/blade) ) + if( istype(W, /obj/item/weapon/melee/energy/blade) ) var/obj/item/weapon/melee/energy/blade/EB = W EB.spark_system.start() @@ -40,8 +33,7 @@ playsound(src, "sparks", 50, 1) playsound(src, 'sound/weapons/blade1.ogg', 50, 1) - thermitemelt(user) - return + return else if(istype(W, /obj/item/weapon/melee/energy/blade)) user << "This wall is too thick to slice through. You will need to find a different path." @@ -65,13 +57,14 @@ user << "You begin removing the support lines." playsound(src, 'sound/items/Screwdriver.ogg', 100, 1) - sleep(40) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) return + if(do_after(user, 40)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) + return - if( d_state == 1 && user.loc == T && user.get_active_hand() == W ) - src.d_state = 2 - src.icon_state = "r_wall-2" - user << "You remove the support lines." + if( d_state == 1 && user.loc == T && user.get_active_hand() == W ) + src.d_state = 2 + src.icon_state = "r_wall-2" + user << "You remove the support lines." return //REPAIRING (replacing the outer grille for cosmetic damage) @@ -95,13 +88,14 @@ user << "You begin slicing through the metal cover." playsound(src, 'sound/items/Welder.ogg', 100, 1) - sleep(60) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !WT || !WT.isOn() || !T ) return + if(do_after(user, 60)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !WT || !WT.isOn() || !T ) + return - if( d_state == 2 && user.loc == T && user.get_active_hand() == WT ) - src.d_state = 3 - src.icon_state = "r_wall-3" - user << "You press firmly on the cover, dislodging it." + if( d_state == 2 && user.loc == T && user.get_active_hand() == WT ) + src.d_state = 3 + src.icon_state = "r_wall-3" + user << "You press firmly on the cover, dislodging it." return if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) ) @@ -109,13 +103,14 @@ user << "You begin slicing through the metal cover." playsound(src, 'sound/items/Welder.ogg', 100, 1) - sleep(40) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) return + if(do_after(user, 60)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) + return - if( d_state == 2 && user.loc == T && user.get_active_hand() == W ) - src.d_state = 3 - src.icon_state = "r_wall-3" - user << "You press firmly on the cover, dislodging it." + if( d_state == 2 && user.loc == T && user.get_active_hand() == W ) + src.d_state = 3 + src.icon_state = "r_wall-3" + user << "You press firmly on the cover, dislodging it." return if(3) @@ -124,13 +119,14 @@ user << "You struggle to pry off the cover." playsound(src, 'sound/items/Crowbar.ogg', 100, 1) - sleep(100) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) return + if(do_after(user, 100)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) + return - if( d_state == 3 && user.loc == T && user.get_active_hand() == W ) - src.d_state = 4 - src.icon_state = "r_wall-4" - user << "You pry off the cover." + if( d_state == 3 && user.loc == T && user.get_active_hand() == W ) + src.d_state = 4 + src.icon_state = "r_wall-4" + user << "You pry off the cover." return if(4) @@ -139,13 +135,14 @@ user << "You start loosening the anchoring bolts which secure the support rods to their frame." playsound(src, 'sound/items/Ratchet.ogg', 100, 1) - sleep(40) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) return + if(do_after(user, 40)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) + return - if( d_state == 4 && user.loc == T && user.get_active_hand() == W ) - src.d_state = 5 - src.icon_state = "r_wall-5" - user << "You remove the bolts anchoring the support rods." + if( d_state == 4 && user.loc == T && user.get_active_hand() == W ) + src.d_state = 5 + src.icon_state = "r_wall-5" + user << "You remove the bolts anchoring the support rods." return if(5) @@ -156,14 +153,15 @@ user << "You begin slicing through the support rods." playsound(src, 'sound/items/Welder.ogg', 100, 1) - sleep(100) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !WT || !WT.isOn() || !T ) return + if(do_after(user, 100)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !WT || !WT.isOn() || !T ) + return - if( d_state == 5 && user.loc == T && user.get_active_hand() == WT ) - src.d_state = 6 - src.icon_state = "r_wall-6" - new /obj/item/stack/rods( src ) - user << "The support rods drop out as you cut them loose from the frame." + if( d_state == 5 && user.loc == T && user.get_active_hand() == WT ) + src.d_state = 6 + src.icon_state = "r_wall-6" + new /obj/item/stack/rods( src ) + user << "The support rods drop out as you cut them loose from the frame." return if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) ) @@ -171,14 +169,15 @@ user << "You begin slicing through the support rods." playsound(src, 'sound/items/Welder.ogg', 100, 1) - sleep(70) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) return + if(do_after(user, 70)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) + return - if( d_state == 5 && user.loc == T && user.get_active_hand() == W ) - src.d_state = 6 - src.icon_state = "r_wall-6" - new /obj/item/stack/rods( src ) - user << "The support rods drop out as you cut them loose from the frame." + if( d_state == 5 && user.loc == T && user.get_active_hand() == W ) + src.d_state = 6 + src.icon_state = "r_wall-6" + new /obj/item/stack/rods( src ) + user << "The support rods drop out as you cut them loose from the frame." return if(6) @@ -187,12 +186,13 @@ user << "You struggle to pry off the outer sheath." playsound(src, 'sound/items/Crowbar.ogg', 100, 1) - sleep(100) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) return + if(do_after(user, 100)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) + return - if( user.loc == T && user.get_active_hand() == W ) - user << "You pry off the outer sheath." - dismantle_wall() + if( user.loc == T && user.get_active_hand() == W ) + user << "You pry off the outer sheath." + dismantle_wall() return //vv OK, we weren't performing a valid deconstruction step or igniting thermite,let's check the other possibilities vv @@ -202,12 +202,13 @@ user << "You begin to drill though the wall." - sleep(200) - if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) return + if(do_after(user, 200)) + if( !istype(src, /turf/simulated/wall/r_wall) || !user || !W || !T ) + return - if( user.loc == T && user.get_active_hand() == W ) - user << "Your drill tears though the last of the reinforced plating." - dismantle_wall() + if( user.loc == T && user.get_active_hand() == W ) + user << "Your drill tears though the last of the reinforced plating." + dismantle_wall() //REPAIRING else if(istype(W, /obj/item/stack/sheet/metal) && d_state) From 7ea3b7fb5cf5dedda1970dcc5ee7809ef8e14ca9 Mon Sep 17 00:00:00 2001 From: phil235 Date: Sat, 4 Oct 2014 17:01:25 +0200 Subject: [PATCH 3/4] missing "return" --- code/game/turfs/simulated/walls.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 9539fba3b11..ce912efc8e6 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -166,6 +166,8 @@ playsound(src, "sparks", 50, 1) playsound(src, 'sound/weapons/blade1.ogg', 50, 1) + return + var/turf/T = user.loc //get user's location for delay checks var/slicing_duration = 100 //default time taken to slice the wall From 47b6ee8d609c20a38dc2e15965017ce52d0fd40e Mon Sep 17 00:00:00 2001 From: phil235 Date: Sun, 5 Oct 2014 13:38:51 +0200 Subject: [PATCH 4/4] Fixing mistake so Travis can compile. --- code/game/machinery/doors/airlock.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 633e50bd4c3..a770e7a9c2e 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -888,7 +888,8 @@ About the new airlock wires panel: src.add_fingerprint(user) if((istype(C, /obj/item/weapon/weldingtool) && !( src.operating ) && src.density)) - var/obj/item/weapon/weldingtool/W = C if(W.remove_fuel(0,user)) + var/obj/item/weapon/weldingtool/W = C + if(W.remove_fuel(0,user)) user.visible_message("[user] is [welded ? "unwelding":"welding"] the airlock.", \ "You begin [welded ? "unwelding":"welding"] the airlock...", \ "You hear welding.")