From 0fcf436b52fca8bb902c6a3d395670af08200ca9 Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 2 Aug 2018 09:14:51 -0700 Subject: [PATCH 01/10] shieldgen.dm refactor --- code/game/machinery/shieldgen.dm | 149 ++++++++++++++++--------------- 1 file changed, 77 insertions(+), 72 deletions(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 6ef4d064ac7..3ffc431f176 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -11,7 +11,7 @@ var/health = max_health //The shield can only take so much beating (prevents perma-prisons) /obj/machinery/shield/New() - src.dir = pick(1,2,3,4) + dir = pick(1,2,3,4) ..() /obj/machinery/shield/Initialize() @@ -30,31 +30,34 @@ move_update_air(T) /obj/machinery/shield/CanPass(atom/movable/mover, turf/target, height) - if(!height) return 0 - else return ..() + if(!height) + return 0 + return ..() /obj/machinery/shield/CanAtmosPass(var/turf/T) return !density /obj/machinery/shield/attackby(obj/item/W as obj, mob/user as mob, params) - if(!istype(W)) return + if(!istype(W)) + return //Calculate damage var/aforce = W.force if(W.damtype == BRUTE || W.damtype == BURN) - src.health -= aforce + health -= aforce //Play a fitting sound - playsound(src.loc, 'sound/effects/EMPulse.ogg', 75, 1) + playsound(loc, 'sound/effects/EMPulse.ogg', 75, 1) - - if(src.health <= 0) + if(health <= 0) visible_message("The [src] dissipates") qdel(src) return opacity = 1 - spawn(20) if(src) opacity = 0 + spawn(20) + if(src) + opacity = 0 ..() @@ -66,7 +69,9 @@ qdel(src) return opacity = 1 - spawn(20) if(src) opacity = 0 + spawn(20) + if(src) + opacity = 0 /obj/machinery/shield/ex_act(severity) switch(severity) @@ -79,7 +84,6 @@ if(3.0) if(prob(25)) qdel(src) - return /obj/machinery/shield/emp_act(severity) switch(severity) @@ -147,7 +151,7 @@ /obj/machinery/shieldgen/proc/shields_up() if(active) return 0 //If it's already turned on, how did this get called? - src.active = 1 + active = 1 update_icon() for(var/turf/target_tile in range(2, src)) @@ -158,7 +162,7 @@ /obj/machinery/shieldgen/proc/shields_down() if(!active) return 0 //If it's already off, how did this get called? - src.active = 0 + active = 0 update_icon() for(var/obj/machinery/shield/shield_tile in deployed_shields) @@ -173,7 +177,7 @@ /obj/machinery/shieldgen/proc/checkhp() if(health <= 30) - src.malfunction = 1 + malfunction = 1 if(health <= 0) qdel(src) update_icon() @@ -182,27 +186,27 @@ /obj/machinery/shieldgen/ex_act(severity) switch(severity) if(1.0) - src.health -= 75 - src.checkhp() + health -= 75 + checkhp() if(2.0) - src.health -= 30 + health -= 30 if(prob(15)) - src.malfunction = 1 - src.checkhp() + malfunction = 1 + checkhp() if(3.0) - src.health -= 10 - src.checkhp() + health -= 10 + checkhp() return /obj/machinery/shieldgen/emp_act(severity) switch(severity) if(1) - src.health /= 2 //cut health in half + health /= 2 //cut health in half malfunction = 1 locked = pick(0,1) if(2) if(prob(50)) - src.health *= 0.3 //chop off a third of the health + health *= 0.3 //chop off a third of the health malfunction = 1 checkhp() @@ -214,17 +218,17 @@ to_chat(user, "The panel must be closed before operating this machine.") return - if(src.active) + if(active) user.visible_message("[bicon(src)] [user] deactivated the shield generator.", \ "[bicon(src)] You deactivate the shield generator.", \ "You hear heavy droning fade out.") - src.shields_down() + shields_down() else if(anchored) user.visible_message("[bicon(src)] [user] activated the shield generator.", \ "[bicon(src)] You activate the shield generator.", \ "You hear heavy droning.") - src.shields_up() + shields_up() else to_chat(user, "The device must first be secured to the floor.") return @@ -235,7 +239,7 @@ update_icon() else if(istype(W, /obj/item/screwdriver)) - playsound(src.loc, W.usesound, 100, 1) + playsound(loc, W.usesound, 100, 1) if(is_open) to_chat(user, "You close the panel.") is_open = 0 @@ -246,7 +250,6 @@ else if(istype(W, /obj/item/stack/cable_coil) && malfunction && is_open) var/obj/item/stack/cable_coil/coil = W to_chat(user, "You begin to replace the wires.") - //if(do_after(user, min(60, round( ((maxhealth/health)*10)+(malfunction*10) ), target = src)) //Take longer to repair heavier damage if(do_after(user, 30 * coil.toolspeed, target = src)) if(!src || !coil) return coil.use(1) @@ -261,23 +264,23 @@ to_chat(user, "The bolts are covered, unlocking this would retract the covers.") return if(anchored) - playsound(src.loc, W.usesound, 100, 1) + playsound(loc, W.usesound, 100, 1) to_chat(user, "You unsecure the [src] from the floor!") if(active) to_chat(user, "The [src] shuts off!") - src.shields_down() + shields_down() anchored = 0 else if(istype(get_turf(src), /turf/space)) return //No wrenching these in space! - playsound(src.loc, W.usesound, 100, 1) + playsound(loc, W.usesound, 100, 1) to_chat(user, "You secure the [src] to the floor!") anchored = 1 else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/pda)) - if(src.allowed(user)) - src.locked = !src.locked - to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]") + if(allowed(user)) + locked = !locked + to_chat(user, "The controls are now [locked ? "locked." : "unlocked."]") else to_chat(user, "Access denied.") @@ -287,11 +290,12 @@ /obj/machinery/shieldgen/update_icon() if(active) - src.icon_state = malfunction ? "shieldonbr":"shieldon" + icon_state = malfunction ? "shieldonbr":"shieldon" else - src.icon_state = malfunction ? "shieldoffbr":"shieldoff" + icon_state = malfunction ? "shieldoffbr":"shieldoff" return + ////FIELD GEN START //shameless copypasta from fieldgen, powersink, and grille #define maxstoredpower 500 /obj/machinery/shieldwallgen @@ -322,7 +326,7 @@ if(!anchored) power = 0 return 0 - var/turf/T = src.loc + var/turf/T = loc var/obj/structure/cable/C = T.get_cable_node() var/datum/powernet/PN @@ -349,28 +353,28 @@ if(state != 1) to_chat(user, "The shield generator needs to be firmly secured to the floor first.") return 1 - if(src.locked && !istype(user, /mob/living/silicon)) + if(locked && !istype(user, /mob/living/silicon)) to_chat(user, "The controls are locked!") return 1 if(power != 1) to_chat(user, "The shield generator needs to be powered by wire underneath.") return 1 - if(src.active >= 1) - src.active = 0 + if(active >= 1) + active = 0 icon_state = "Shield_Gen" user.visible_message("[user] turned the shield generator off.", \ "You turn off the shield generator.", \ "You hear heavy droning fade out.") - for(var/dir in list(1,2,4,8)) src.cleanup(dir) + for(var/dir in list(1,2,4,8)) cleanup(dir) else - src.active = 1 + active = 1 icon_state = "Shield_Gen +a" user.visible_message("[user] turned the shield generator on.", \ "You turn on the shield generator.", \ "You hear heavy droning.") - src.add_fingerprint(user) + add_fingerprint(user) /obj/machinery/shieldwallgen/process() spawn(100) @@ -384,9 +388,9 @@ // if(shieldload >= maxshieldload) //there was a loop caused by specifics of process(), so this was needed. // shieldload = maxshieldload - if(src.active == 1) - if(!src.state == 1) - src.active = 0 + if(active == 1) + if(!state == 1) + active = 0 return spawn(1) setup_field(1) @@ -396,18 +400,18 @@ setup_field(4) spawn(4) setup_field(8) - src.active = 2 - if(src.active >= 1) - if(src.power == 0) - src.visible_message("The [src.name] shuts down due to lack of power!", \ + active = 2 + if(active >= 1) + if(power == 0) + visible_message("The [name] shuts down due to lack of power!", \ "You hear heavy droning fade out") icon_state = "Shield_Gen" - src.active = 0 - for(var/dir in list(1,2,4,8)) src.cleanup(dir) + active = 0 + for(var/dir in list(1,2,4,8)) cleanup(dir) /obj/machinery/shieldwallgen/proc/setup_field(var/NSEW = 0) - var/turf/T = src.loc - var/turf/T2 = src.loc + var/turf/T = loc + var/turf/T2 = loc var/obj/machinery/shieldwallgen/G var/steps = 0 var/oNSEW = 0 @@ -439,7 +443,7 @@ if(isnull(G)) return - T2 = src.loc + T2 = loc for(var/dist = 0, dist < steps, dist += 1) // creates each field tile var/field_dir = get_dir(T2,get_step(T2, NSEW)) @@ -458,22 +462,22 @@ else if(state == 0) state = 1 - playsound(src.loc, W.usesound, 75, 1) + playsound(loc, W.usesound, 75, 1) to_chat(user, "You secure the external reinforcing bolts to the floor.") - src.anchored = 1 + anchored = 1 return else if(state == 1) state = 0 - playsound(src.loc, W.usesound, 75, 1) + playsound(loc, W.usesound, 75, 1) to_chat(user, "You undo the external reinforcing bolts.") - src.anchored = 0 + anchored = 0 return if(istype(W, /obj/item/card/id)||istype(W, /obj/item/pda)) - if(src.allowed(user)) - src.locked = !src.locked - to_chat(user, "Controls are now [src.locked ? "locked." : "unlocked."]") + if(allowed(user)) + locked = !locked + to_chat(user, "Controls are now [locked ? "locked." : "unlocked."]") else to_chat(user, "Access denied.") @@ -484,8 +488,8 @@ /obj/machinery/shieldwallgen/proc/cleanup(var/NSEW) var/obj/machinery/shieldwall/F var/obj/machinery/shieldwallgen/G - var/turf/T = src.loc - var/turf/T2 = src.loc + var/turf/T = loc + var/turf/T2 = loc for(var/dist = 0, dist <= 9, dist += 1) // checks out to 8 tiles away for fields T = get_step(T2, NSEW) @@ -500,10 +504,10 @@ break /obj/machinery/shieldwallgen/Destroy() - src.cleanup(1) - src.cleanup(2) - src.cleanup(4) - src.cleanup(8) + cleanup(1) + cleanup(2) + cleanup(4) + cleanup(8) return ..() /obj/machinery/shieldwallgen/bullet_act(var/obj/item/projectile/Proj) @@ -533,8 +537,8 @@ /obj/machinery/shieldwall/New(var/obj/machinery/shieldwallgen/A, var/obj/machinery/shieldwallgen/B) ..() - src.gen_primary = A - src.gen_secondary = B + gen_primary = A + gen_secondary = B if(A && B) needs_power = 1 @@ -598,7 +602,8 @@ /obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target, height=0) - if(height==0) return 1 + if(height==0) + return 1 if(istype(mover) && mover.checkpass(PASSGLASS)) return prob(20) @@ -606,4 +611,4 @@ if(istype(mover, /obj/item/projectile)) return prob(10) else - return !src.density + return !density From ff93deef4727a97a5a0945e50a3655ed6709d3e0 Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 2 Aug 2018 10:06:08 -0700 Subject: [PATCH 02/10] removes implied var --- code/game/machinery/shieldgen.dm | 41 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 3ffc431f176..a61e4a29de9 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -34,10 +34,10 @@ return 0 return ..() -/obj/machinery/shield/CanAtmosPass(var/turf/T) +/obj/machinery/shield/CanAtmosPass(turf/T) return !density -/obj/machinery/shield/attackby(obj/item/W as obj, mob/user as mob, params) +/obj/machinery/shield/attackby(obj/item/W, mob/user, params) if(!istype(W)) return @@ -61,7 +61,7 @@ ..() -/obj/machinery/shield/bullet_act(var/obj/item/projectile/Proj) +/obj/machinery/shield/bullet_act(obj/item/projectile/Proj) health -= Proj.damage ..() if(health <=0) @@ -149,7 +149,8 @@ /obj/machinery/shieldgen/proc/shields_up() - if(active) return 0 //If it's already turned on, how did this get called? + if(active) + return 0 //If it's already turned on, how did this get called? active = 1 update_icon() @@ -231,7 +232,6 @@ shields_up() else to_chat(user, "The device must first be secured to the floor.") - return /obj/machinery/shieldgen/attackby(obj/item/W as obj, mob/user as mob, params) if(istype(W, /obj/item/card/emag)) @@ -316,7 +316,6 @@ var/locked = 1 var/destroyed = 0 var/directwired = 1 -// var/maxshieldload = 200 var/obj/structure/cable/attached // the attached cable var/storedpower = 0 flags = CONDUCT @@ -330,7 +329,8 @@ var/obj/structure/cable/C = T.get_cable_node() var/datum/powernet/PN - if(C) PN = C.powernet // find the powernet of the connected cable + if(C) + PN = C.powernet // find the powernet of the connected cable if(!PN) power = 0 @@ -349,7 +349,7 @@ // message_admins("[PN.load]", 1) // use_power(250) //uses APC power -/obj/machinery/shieldwallgen/attack_hand(mob/user as mob) +/obj/machinery/shieldwallgen/attack_hand(mob/user) if(state != 1) to_chat(user, "The shield generator needs to be firmly secured to the floor first.") return 1 @@ -367,7 +367,8 @@ user.visible_message("[user] turned the shield generator off.", \ "You turn off the shield generator.", \ "You hear heavy droning fade out.") - for(var/dir in list(1,2,4,8)) cleanup(dir) + for(var/dir in list(1,2,4,8)) + cleanup(dir) else active = 1 icon_state = "Shield_Gen +a" @@ -385,8 +386,6 @@ storedpower = maxstoredpower if(storedpower <= 0) storedpower = 0 -// if(shieldload >= maxshieldload) //there was a loop caused by specifics of process(), so this was needed. -// shieldload = maxshieldload if(active == 1) if(!state == 1) @@ -407,9 +406,10 @@ "You hear heavy droning fade out") icon_state = "Shield_Gen" active = 0 - for(var/dir in list(1,2,4,8)) cleanup(dir) + for(var/dir in list(1,2,4,8)) + cleanup(dir) -/obj/machinery/shieldwallgen/proc/setup_field(var/NSEW = 0) +/obj/machinery/shieldwallgen/proc/setup_field(NSEW = 0) var/turf/T = loc var/turf/T2 = loc var/obj/machinery/shieldwallgen/G @@ -485,7 +485,7 @@ add_fingerprint(user) ..() -/obj/machinery/shieldwallgen/proc/cleanup(var/NSEW) +/obj/machinery/shieldwallgen/proc/cleanup(NSEW) var/obj/machinery/shieldwall/F var/obj/machinery/shieldwallgen/G var/turf/T = loc @@ -510,13 +510,13 @@ cleanup(8) return ..() -/obj/machinery/shieldwallgen/bullet_act(var/obj/item/projectile/Proj) +/obj/machinery/shieldwallgen/bullet_act(obj/item/projectile/Proj) storedpower -= Proj.damage ..() return -//////////////Containment Field START +////////////// Containment Field START /obj/machinery/shieldwall name = "Shield" desc = "An energy shield." @@ -528,21 +528,20 @@ luminosity = 3 var/needs_power = 0 var/active = 1 -// var/power = 10 var/delay = 5 var/last_active var/mob/U var/obj/machinery/shieldwallgen/gen_primary var/obj/machinery/shieldwallgen/gen_secondary -/obj/machinery/shieldwall/New(var/obj/machinery/shieldwallgen/A, var/obj/machinery/shieldwallgen/B) +/obj/machinery/shieldwall/New(obj/machinery/shieldwallgen/A, obj/machinery/shieldwallgen/B) ..() gen_primary = A gen_secondary = B if(A && B) needs_power = 1 -/obj/machinery/shieldwall/attack_hand(mob/user as mob) +/obj/machinery/shieldwall/attack_hand(mob/user) return @@ -555,14 +554,14 @@ if(!(gen_primary.active)||!(gen_secondary.active)) qdel(src) return -// + if(prob(50)) gen_primary.storedpower -= 10 else gen_secondary.storedpower -=10 -/obj/machinery/shieldwall/bullet_act(var/obj/item/projectile/Proj) +/obj/machinery/shieldwall/bullet_act(obj/item/projectile/Proj) if(needs_power) var/obj/machinery/shieldwallgen/G if(prob(50)) From 87782afedcaec2a439c5474a34d92022dee2ecfb Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 2 Aug 2018 16:45:16 -0700 Subject: [PATCH 03/10] thanks False --- code/game/machinery/shieldgen.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index a61e4a29de9..6696a1bbb7f 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -31,7 +31,7 @@ /obj/machinery/shield/CanPass(atom/movable/mover, turf/target, height) if(!height) - return 0 + return FALSE return ..() /obj/machinery/shield/CanAtmosPass(turf/T) @@ -150,7 +150,7 @@ /obj/machinery/shieldgen/proc/shields_up() if(active) - return 0 //If it's already turned on, how did this get called? + return //If it's already turned on, how did this get called? active = 1 update_icon() @@ -161,7 +161,8 @@ deployed_shields += new /obj/machinery/shield(target_tile) /obj/machinery/shieldgen/proc/shields_down() - if(!active) return 0 //If it's already off, how did this get called? + if(!active) + return //If it's already off, how did this get called? active = 0 update_icon() From 3142f2d7306a119aa112c4fa222c197db9a5e391 Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 2 Aug 2018 16:50:52 -0700 Subject: [PATCH 04/10] malfunction/locked -> TRUE/false, dir = pick --- code/game/machinery/shieldgen.dm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 6696a1bbb7f..e6bc1ba60d0 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -11,7 +11,7 @@ var/health = max_health //The shield can only take so much beating (prevents perma-prisons) /obj/machinery/shield/New() - dir = pick(1,2,3,4) + dir = pick(NORTH, SOUTH, EAST, WEST) ..() /obj/machinery/shield/Initialize() @@ -137,10 +137,10 @@ var/const/max_health = 100 var/health = max_health var/active = 0 - var/malfunction = 0 //Malfunction causes parts of the shield to slowly dissapate + var/malfunction = FALSE //Malfunction causes parts of the shield to slowly dissapate var/list/deployed_shields = list() - var/is_open = 0 //Whether or not the wires are exposed - var/locked = 0 + var/is_open = FALSE //Whether or not the wires are exposed + var/locked = FALSE /obj/machinery/shieldgen/Destroy() QDEL_LIST(deployed_shields) @@ -179,7 +179,7 @@ /obj/machinery/shieldgen/proc/checkhp() if(health <= 30) - malfunction = 1 + malfunction = TRUE if(health <= 0) qdel(src) update_icon() @@ -193,7 +193,7 @@ if(2.0) health -= 30 if(prob(15)) - malfunction = 1 + malfunction = TRUE checkhp() if(3.0) health -= 10 @@ -204,12 +204,12 @@ switch(severity) if(1) health /= 2 //cut health in half - malfunction = 1 - locked = pick(0,1) + malfunction = TRUE + locked = pick(TRUE, FALSE) if(2) if(prob(50)) health *= 0.3 //chop off a third of the health - malfunction = 1 + malfunction = TRUE checkhp() /obj/machinery/shieldgen/attack_hand(mob/user as mob) @@ -236,17 +236,17 @@ /obj/machinery/shieldgen/attackby(obj/item/W as obj, mob/user as mob, params) if(istype(W, /obj/item/card/emag)) - malfunction = 1 + malfunction = TRUE update_icon() else if(istype(W, /obj/item/screwdriver)) playsound(loc, W.usesound, 100, 1) if(is_open) to_chat(user, "You close the panel.") - is_open = 0 + is_open = FALSE else to_chat(user, "You open the panel and expose the wiring.") - is_open = 1 + is_open = TRUE else if(istype(W, /obj/item/stack/cable_coil) && malfunction && is_open) var/obj/item/stack/cable_coil/coil = W @@ -255,7 +255,7 @@ if(!src || !coil) return coil.use(1) health = max_health - malfunction = 0 + malfunction = TRUE playsound(loc, coil.usesound, 50, 1) to_chat(user, "You repair the [src]!") update_icon() @@ -314,7 +314,7 @@ var/last_check = 0 var/check_delay = 10 var/recalc = 0 - var/locked = 1 + var/locked = TRUE var/destroyed = 0 var/directwired = 1 var/obj/structure/cable/attached // the attached cable From 0d1c073186047d3f7289aae47ce87c45697f34bb Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 6 Aug 2018 21:34:48 -0700 Subject: [PATCH 05/10] Fox --- code/game/machinery/shieldgen.dm | 62 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index e6bc1ba60d0..71ef92c18c6 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -4,7 +4,7 @@ icon = 'icons/effects/effects.dmi' icon_state = "shield-old" density = 1 - opacity = 0 + opacity = FALSE anchored = 1 unacidable = 1 var/const/max_health = 200 @@ -19,7 +19,7 @@ ..() /obj/machinery/shield/Destroy() - opacity = 0 + opacity = FALSE density = 0 air_update_turf(1) return ..() @@ -37,13 +37,13 @@ /obj/machinery/shield/CanAtmosPass(turf/T) return !density -/obj/machinery/shield/attackby(obj/item/W, mob/user, params) - if(!istype(W)) +/obj/machinery/shield/attackby(obj/item/I, mob/user, params) + if(!istype(I)) return //Calculate damage - var/aforce = W.force - if(W.damtype == BRUTE || W.damtype == BURN) + var/aforce = I.force + if(I.damtype == BRUTE || I.damtype == BURN) health -= aforce //Play a fitting sound @@ -54,10 +54,10 @@ qdel(src) return - opacity = 1 + opacity = TRUE spawn(20) if(src) - opacity = 0 + opacity = FALSE ..() @@ -68,10 +68,10 @@ visible_message("The [src] dissipates") qdel(src) return - opacity = 1 + opacity = TRUE spawn(20) if(src) - opacity = 0 + opacity = FALSE /obj/machinery/shield/ex_act(severity) switch(severity) @@ -118,10 +118,10 @@ return //The shield becomes dense to absorb the blow.. purely asthetic. - opacity = 1 + opacity = TRUE spawn(20) if(src) - opacity = 0 + opacity = FALSE /obj/machinery/shieldgen @@ -130,7 +130,7 @@ icon = 'icons/obj/objects.dmi' icon_state = "shieldoff" density = 1 - opacity = 0 + opacity = FALSE anchored = 0 pressure_resistance = 2*ONE_ATMOSPHERE req_access = list(access_engine) @@ -203,7 +203,7 @@ /obj/machinery/shieldgen/emp_act(severity) switch(severity) if(1) - health /= 2 //cut health in half + health = health * 0.5 //cut health in half malfunction = TRUE locked = pick(TRUE, FALSE) if(2) @@ -234,13 +234,13 @@ else to_chat(user, "The device must first be secured to the floor.") -/obj/machinery/shieldgen/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W, /obj/item/card/emag)) +/obj/machinery/shieldgen/attackby(obj/item/I as obj, mob/user as mob, params) + if(istype(I, /obj/item/card/emag)) malfunction = TRUE update_icon() - else if(istype(W, /obj/item/screwdriver)) - playsound(loc, W.usesound, 100, 1) + else if(isscrewdriver(I)) + playsound(loc, I.usesound, 100, 1) if(is_open) to_chat(user, "You close the panel.") is_open = FALSE @@ -248,11 +248,12 @@ to_chat(user, "You open the panel and expose the wiring.") is_open = TRUE - else if(istype(W, /obj/item/stack/cable_coil) && malfunction && is_open) - var/obj/item/stack/cable_coil/coil = W + else if(istype(I, /obj/item/stack/cable_coil) && malfunction && is_open) + var/obj/item/stack/cable_coil/coil = I to_chat(user, "You begin to replace the wires.") if(do_after(user, 30 * coil.toolspeed, target = src)) - if(!src || !coil) return + if(!src || !coil) + return coil.use(1) health = max_health malfunction = TRUE @@ -260,25 +261,26 @@ to_chat(user, "You repair the [src]!") update_icon() - else if(istype(W, /obj/item/wrench)) + else if(istype(I, /obj/item/wrench)) if(locked) to_chat(user, "The bolts are covered, unlocking this would retract the covers.") return if(anchored) - playsound(loc, W.usesound, 100, 1) + playsound(loc, I.usesound, 100, 1) to_chat(user, "You unsecure the [src] from the floor!") if(active) to_chat(user, "The [src] shuts off!") shields_down() anchored = 0 else - if(istype(get_turf(src), /turf/space)) return //No wrenching these in space! + if(istype(get_turf(src), /turf/space)) + return //No wrenching these in space! playsound(loc, W.usesound, 100, 1) to_chat(user, "You secure the [src] to the floor!") anchored = 1 - else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/pda)) + else if(istype(I, /obj/item/card/id) || istype(W, /obj/item/pda)) if(allowed(user)) locked = !locked to_chat(user, "The controls are now [locked ? "locked." : "unlocked."]") @@ -354,7 +356,7 @@ if(state != 1) to_chat(user, "The shield generator needs to be firmly secured to the floor first.") return 1 - if(locked && !istype(user, /mob/living/silicon)) + if(locked && !issilicon(user)) to_chat(user, "The controls are locked!") return 1 if(power != 1) @@ -368,7 +370,7 @@ user.visible_message("[user] turned the shield generator off.", \ "You turn off the shield generator.", \ "You hear heavy droning fade out.") - for(var/dir in list(1,2,4,8)) + for(var/dir in list(NORTH, SOUTH, EAST, WEST)) cleanup(dir) else active = 1 @@ -407,7 +409,7 @@ "You hear heavy droning fade out") icon_state = "Shield_Gen" active = 0 - for(var/dir in list(1,2,4,8)) + for(var/dir in list(NORTH, SOUTH, EAST, WEST)) cleanup(dir) /obj/machinery/shieldwallgen/proc/setup_field(NSEW = 0) @@ -602,8 +604,8 @@ /obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target, height=0) - if(height==0) - return 1 + if(height == 0) + return TRUE if(istype(mover) && mover.checkpass(PASSGLASS)) return prob(20) From 188a59758a8eecf2d5b782f6815ea49bba60c816 Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 6 Aug 2018 21:37:51 -0700 Subject: [PATCH 06/10] tweak --- code/game/machinery/shieldgen.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 71ef92c18c6..b8e8b93fc91 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -275,7 +275,7 @@ else if(istype(get_turf(src), /turf/space)) return //No wrenching these in space! - playsound(loc, W.usesound, 100, 1) + playsound(loc, I.usesound, 100, 1) to_chat(user, "You secure the [src] to the floor!") anchored = 1 From f0476725d8244908e81925000c20227a3cf3199d Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 6 Aug 2018 21:39:45 -0700 Subject: [PATCH 07/10] squash --- code/game/machinery/shieldgen.dm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index b8e8b93fc91..035744daab1 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -457,27 +457,27 @@ CF.dir = field_dir -/obj/machinery/shieldwallgen/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/wrench)) +/obj/machinery/shieldwallgen/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/wrench)) if(active) to_chat(user, "Turn off the field generator first.") return else if(state == 0) state = 1 - playsound(loc, W.usesound, 75, 1) + playsound(loc, I.usesound, 75, 1) to_chat(user, "You secure the external reinforcing bolts to the floor.") anchored = 1 return else if(state == 1) state = 0 - playsound(loc, W.usesound, 75, 1) + playsound(loc, I.usesound, 75, 1) to_chat(user, "You undo the external reinforcing bolts.") anchored = 0 return - if(istype(W, /obj/item/card/id)||istype(W, /obj/item/pda)) + if(istype(I, /obj/item/card/id)||istype(I, /obj/item/pda)) if(allowed(user)) locked = !locked to_chat(user, "Controls are now [locked ? "locked." : "unlocked."]") From cdba81238543a95cfb6d7eb613bb4c16261dd9de Mon Sep 17 00:00:00 2001 From: Kyep Date: Mon, 6 Aug 2018 21:40:51 -0700 Subject: [PATCH 08/10] last one --- code/game/machinery/shieldgen.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 035744daab1..5438fe84d6a 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -280,7 +280,7 @@ anchored = 1 - else if(istype(I, /obj/item/card/id) || istype(W, /obj/item/pda)) + else if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda)) if(allowed(user)) locked = !locked to_chat(user, "The controls are now [locked ? "locked." : "unlocked."]") From 695c70aab8f5a5dcb914e0df89de8b057bd4bf97 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 18 Aug 2018 09:02:30 -0700 Subject: [PATCH 09/10] fixes incorrect deletion of wrong shields in some situations --- code/game/machinery/shieldgen.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index f6d5eb2e8cb..13979dafa5f 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -499,7 +499,8 @@ T2 = T if(locate(/obj/machinery/shieldwall) in T) F = (locate(/obj/machinery/shieldwall) in T) - qdel(F) + if(F.type == /obj/machinery/shieldwall) + qdel(F) if(locate(/obj/machinery/shieldwallgen) in T) G = (locate(/obj/machinery/shieldwallgen) in T) From e6a469213aa97b3443c9af441d2004e2f2de0eff Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 18 Aug 2018 16:15:26 -0700 Subject: [PATCH 10/10] CL request --- code/game/machinery/shieldgen.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 13979dafa5f..30567b14371 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -499,7 +499,7 @@ T2 = T if(locate(/obj/machinery/shieldwall) in T) F = (locate(/obj/machinery/shieldwall) in T) - if(F.type == /obj/machinery/shieldwall) + if(F.gen_primary == src || F.gen_secondary == src) qdel(F) if(locate(/obj/machinery/shieldwallgen) in T)