From ada80ec52995e4b961788df99efd08c8f4665441 Mon Sep 17 00:00:00 2001 From: Twinmold Date: Sat, 26 Nov 2016 05:37:31 -0600 Subject: [PATCH 1/3] Pod Fixes and Some Runtime Fixes Fixes sending pod pilots to the void when the pod explodes/is destroyed, as well as giving them damage warnings, just like passengers get. Also fixes it so if a guardian traps something, then dies, doesn't runtime. Lastly, fixes it so there isn't a randomly runtime from opening a critter crate, as well as cleaning up a little snowflake code, thanks to Crazylemon. --- .../gamemodes/miniantags/guardian/guardian.dm | 3 +- .../structures/crates_lockers/crittercrate.dm | 11 +---- code/modules/spacepods/spacepod.dm | 44 ++++++++++++------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 69d87a37b7f..b3319c34ecb 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -629,7 +629,8 @@ spawn(600) if(src) stored_obj.loc = get_turf(src.loc) - to_chat(spawner, "Failure! Your trap on \the [stored_obj] didn't catch anyone this time.") + if(spawner) + to_chat(spawner, "Failure! Your trap on \the [stored_obj] didn't catch anyone this time.") qdel(src) /obj/item/weapon/guardian_bomb/proc/detonate(var/mob/living/user) diff --git a/code/game/objects/structures/crates_lockers/crittercrate.dm b/code/game/objects/structures/crates_lockers/crittercrate.dm index 6badf7a6535..ffaff75288d 100644 --- a/code/game/objects/structures/crates_lockers/crittercrate.dm +++ b/code/game/objects/structures/crates_lockers/crittercrate.dm @@ -25,21 +25,12 @@ for(var/i = 1, i <= amount, i++) new content_mob(loc) already_opened = 1 - ..() + . = ..() /obj/structure/closet/critter/close() ..() return 1 -/obj/structure/closet/critter/attack_hand(mob/user as mob) - src.add_fingerprint(user) - - if(src.loc == user.loc) - to_chat(user, "It won't budge!") - toggle() - else - toggle() - /obj/structure/closet/critter/corgi name = "corgi crate" content_mob = /mob/living/simple_animal/pet/corgi diff --git a/code/modules/spacepods/spacepod.dm b/code/modules/spacepods/spacepod.dm index 5a01cd5b09f..d3019f40e12 100644 --- a/code/modules/spacepods/spacepod.dm +++ b/code/modules/spacepods/spacepod.dm @@ -141,6 +141,9 @@ qdel(ion_trail) ion_trail = null occupant_sanity_check() + if(pilot) + pilot.forceMove(get_turf(src)) + pilot = null if(passengers) for(var/mob/M in passengers) M.forceMove(get_turf(src)) @@ -226,26 +229,36 @@ health = max(0, health - damage) var/percentage = (health / initial(health)) * 100 occupant_sanity_check() - if(passengers && oldhealth > health && percentage <= 25 && percentage > 0) + if(passengers | pilot && oldhealth > health && percentage <= 25 && percentage > 0) var/sound/S = sound('sound/effects/engine_alert2.ogg') S.wait = 0 //No queue S.channel = 0 //Any channel S.volume = 50 - for(var/mob/M in passengers) - M << S - if(passengers && oldhealth > health && !health) + if(pilot) + pilot << S + if(passengers) + for(var/mob/M in passengers) + M << S + if(passengers | pilot && oldhealth > health && !health) var/sound/S = sound('sound/effects/engine_alert1.ogg') S.wait = 0 S.channel = 0 S.volume = 50 - for(var/mob/M in passengers) - M << S + if(pilot) + pilot << S + if(passengers) + for(var/mob/M in passengers) + M << S if(!health) spawn(0) + if(pilot) + to_chat(pilot, "Critical damage to the vessel detected, core explosion imminent!") if(passengers) for(var/mob/M in passengers) to_chat(M, "Critical damage to the vessel detected, core explosion imminent!") for(var/i = 10, i >= 0; --i) + if(pilot) + to_chat(pilot, "[i]") if(passengers) for(var/mob/M in passengers) to_chat(M, "[i]") @@ -266,12 +279,13 @@ occupant_sanity_check() switch(severity) if(1) - for(var/mob/M in passengers) - var/mob/living/carbon/human/H = M - if(H) - H.forceMove(get_turf(src)) - H.ex_act(severity + 1) - to_chat(H, "You are forcefully thrown from \the [src]!") + if(passengers || pilot) + for(var/mob/M in passengers | pilot) + var/mob/living/carbon/human/H = M + if(H) + H.forceMove(get_turf(src)) + H.ex_act(severity + 1) + to_chat(H, "You are forcefully thrown from \the [src]!") qdel(ion_trail) qdel(src) if(2) @@ -283,14 +297,14 @@ /obj/spacepod/emp_act(severity) occupant_sanity_check() cargo_hold.emp_act(severity) - + if(battery && battery.charge > 0) battery.use((battery.charge / 2) / severity) deal_damage(80 / severity) if(empcounter < (40 / severity)) empcounter = 40 / severity - processing_objects.Add(src) - + processing_objects.Add(src) + switch(severity) if(1) if(pilot) From e99996c7255d72ad14bdd97b7935551ea54fc676 Mon Sep 17 00:00:00 2001 From: Twinmold Date: Sat, 26 Nov 2016 23:06:55 -0600 Subject: [PATCH 2/3] Changes Sound and Message Dup Codes to Procs By request of Crazylemon. Doing this also removed the need to have the check for passengers and pilots from the health checks of the pod, as they are no longer necessary and unified inside the new procs. --- code/modules/spacepods/spacepod.dm | 64 +++++++++++------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/code/modules/spacepods/spacepod.dm b/code/modules/spacepods/spacepod.dm index d3019f40e12..b8a9cc32b30 100644 --- a/code/modules/spacepods/spacepod.dm +++ b/code/modules/spacepods/spacepod.dm @@ -229,39 +229,15 @@ health = max(0, health - damage) var/percentage = (health / initial(health)) * 100 occupant_sanity_check() - if(passengers | pilot && oldhealth > health && percentage <= 25 && percentage > 0) - var/sound/S = sound('sound/effects/engine_alert2.ogg') - S.wait = 0 //No queue - S.channel = 0 //Any channel - S.volume = 50 - if(pilot) - pilot << S - if(passengers) - for(var/mob/M in passengers) - M << S - if(passengers | pilot && oldhealth > health && !health) - var/sound/S = sound('sound/effects/engine_alert1.ogg') - S.wait = 0 - S.channel = 0 - S.volume = 50 - if(pilot) - pilot << S - if(passengers) - for(var/mob/M in passengers) - M << S + if(oldhealth > health && percentage <= 25 && percentage > 0) + play_sound_to_riders('sound/effects/engine_alert2.ogg') + else if(oldhealth > health) + play_sound_to_riders('sound/effects/engine_alert1.ogg') if(!health) spawn(0) - if(pilot) - to_chat(pilot, "Critical damage to the vessel detected, core explosion imminent!") - if(passengers) - for(var/mob/M in passengers) - to_chat(M, "Critical damage to the vessel detected, core explosion imminent!") + message_to_riders("Critical damage to the vessel detected, core explosion imminent!") for(var/i = 10, i >= 0; --i) - if(pilot) - to_chat(pilot, "[i]") - if(passengers) - for(var/mob/M in passengers) - to_chat(M, "[i]") + message_to_riders("[i]") if(i == 0) explosion(loc, 2, 4, 8) qdel(src) @@ -307,17 +283,25 @@ switch(severity) if(1) - if(pilot) - to_chat(pilot, "The pod console flashes 'Heavy EMP WAVE DETECTED'.") - if(passengers) - for(var/mob/M in passengers) - to_chat(M, "The pod console flashes 'Heavy EMP WAVE DETECTED'.") + message_to_riders("The pod console flashes 'Heavy EMP WAVE DETECTED'.") if(2) - if(pilot) - to_chat(pilot, "The pod console flashes 'EMP WAVE DETECTED'.") - if(passengers) - for(var/mob/M in passengers) - to_chat(M, "The pod console flashes 'EMP WAVE DETECTED'.") + message_to_riders("The pod console flashes 'EMP WAVE DETECTED'.") + +/obj/spacepod/proc/play_sound_to_riders(mysound) + if(length(passengers | pilot) == 0) + return + var/sound/S = sound(mysound) + S.wait = 0 //No queue + S.channel = 0 //Any channel + S.volume = 50 + for(var/mob/M in passengers | pilot) + M << S + +/obj/spacepod/proc/message_to_riders(mymessage) + if(length(passengers | pilot) == 0) + return + for(var/mob/M in passengers | pilot) + to_chat(M, mymessage) /obj/spacepod/attackby(obj/item/W as obj, mob/user as mob, params) if(user.a_intent == I_HARM) From 4ab60530ae62d2be29f58cf21fc0fd016f5f8b96 Mon Sep 17 00:00:00 2001 From: Twinmold Date: Sat, 26 Nov 2016 23:18:04 -0600 Subject: [PATCH 3/3] Err... Should Still be !health Apparently it's just so that single sound plays when the pod is out of health utterly. --- code/modules/spacepods/spacepod.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/spacepods/spacepod.dm b/code/modules/spacepods/spacepod.dm index b8a9cc32b30..1c71f8837ee 100644 --- a/code/modules/spacepods/spacepod.dm +++ b/code/modules/spacepods/spacepod.dm @@ -231,7 +231,7 @@ occupant_sanity_check() if(oldhealth > health && percentage <= 25 && percentage > 0) play_sound_to_riders('sound/effects/engine_alert2.ogg') - else if(oldhealth > health) + if(oldhealth > health && !health) play_sound_to_riders('sound/effects/engine_alert1.ogg') if(!health) spawn(0)