From a8d15514668d2cab76d17e806d75889347cffb2e Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 8 Mar 2024 23:00:18 -0500 Subject: [PATCH] Shuttle gibbing code improvements (#81726) ## About The Pull Request Adds a resistance flag, `SHUTTLE_CRUSH_PROOF`, adds it to the existing things that have it, and adds it to the immortality spectres. ## Why It's Good For The Game Gets rid of some hardcoded checks, making it easier for future code (or admins) to make things immune to shuttle crushing. Also makes it so immortality spectres are immune to being shuttle crushed, as that kinda ruins the whole "immortality" thing... ## Changelog :cl: refactor: Improved shuttle gibbing code, adding a new resistance flag, `SHUTTLE_CRUSH_PROOF`. fix: Immortality revival spectres can no longer be crushed by shuttles. add: The ghost of Poly can no longer be shuttle-crushed, nor can anything incorporeal. /:cl: Co-authored-by: san7890 --- code/__DEFINES/_flags.dm | 2 ++ code/_globalvars/bitfields.dm | 3 +- code/game/objects/effects/effects.dm | 1 + .../grand_ritual/finales/immortality.dm | 1 + .../mob/living/basic/pets/parrot/poly.dm | 1 + code/modules/power/singularity/singularity.dm | 2 +- code/modules/power/tesla/energy_ball.dm | 2 +- code/modules/shuttle/on_move.dm | 34 ++++++++----------- 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/code/__DEFINES/_flags.dm b/code/__DEFINES/_flags.dm index 55b5b12b531..75dccb49fda 100644 --- a/code/__DEFINES/_flags.dm +++ b/code/__DEFINES/_flags.dm @@ -193,6 +193,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define INDESTRUCTIBLE (1<<6) /// can't be frozen #define FREEZE_PROOF (1<<7) +/// can't be shuttle crushed. +#define SHUTTLE_CRUSH_PROOF (1<<8) //tesla_zap #define ZAP_MACHINE_EXPLOSIVE (1<<0) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 4135428194b..37e7ef30d41 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -313,7 +313,8 @@ DEFINE_BITFIELD(resistance_flags, list( "UNACIDABLE" = UNACIDABLE, "ACID_PROOF" = ACID_PROOF, "INDESTRUCTIBLE" = INDESTRUCTIBLE, - "FREEZE_PROOF" = FREEZE_PROOF + "FREEZE_PROOF" = FREEZE_PROOF, + "SHUTTLE_CRUSH_PROOF" = SHUTTLE_CRUSH_PROOF )) DEFINE_BITFIELD(sight, list( diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm index 377c8470480..0c050579de4 100644 --- a/code/game/objects/effects/effects.dm +++ b/code/game/objects/effects/effects.dm @@ -48,6 +48,7 @@ ///The abstract effect ignores even more effects and is often typechecked for atoms that should truly not be fucked with. /obj/effect/abstract + resistance_flags = parent_type::resistance_flags | SHUTTLE_CRUSH_PROOF /obj/effect/abstract/singularity_pull() return diff --git a/code/modules/antagonists/wizard/grand_ritual/finales/immortality.dm b/code/modules/antagonists/wizard/grand_ritual/finales/immortality.dm index 92489145fda..85267c0333c 100644 --- a/code/modules/antagonists/wizard/grand_ritual/finales/immortality.dm +++ b/code/modules/antagonists/wizard/grand_ritual/finales/immortality.dm @@ -148,6 +148,7 @@ color = COLOR_PALE_GREEN light_range = 2 light_color = COLOR_PALE_GREEN + resistance_flags = parent_type::resistance_flags | SHUTTLE_CRUSH_PROOF /// Who are we reviving? var/mob/living/corpse /// Who if anyone is playing as them? diff --git a/code/modules/mob/living/basic/pets/parrot/poly.dm b/code/modules/mob/living/basic/pets/parrot/poly.dm index f139a43d988..cba3dd6e588 100644 --- a/code/modules/mob/living/basic/pets/parrot/poly.dm +++ b/code/modules/mob/living/basic/pets/parrot/poly.dm @@ -197,6 +197,7 @@ butcher_results = list(/obj/item/ectoplasm = 1) ai_controller = /datum/ai_controller/basic_controller/parrot/ghost speech_probability_rate = 1 + resistance_flags = parent_type::resistance_flags | SHUTTLE_CRUSH_PROOF /mob/living/basic/parrot/poly/ghost/Initialize(mapload) // block anything and everything that could possibly happen with writing memory for ghosts diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index b21b26dcea0..5b712d52da2 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -50,7 +50,7 @@ pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE | PASSCLOSEDTURF | PASSMACHINE | PASSSTRUCTURE | PASSDOORS flags_1 = SUPERMATTER_IGNORES_1 - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | SHUTTLE_CRUSH_PROOF obj_flags = CAN_BE_HIT | DANGEROUS_POSSESSION /obj/singularity/Initialize(mapload, starting_energy = 50) diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index 2b625b36d5b..89dec17a26e 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -26,7 +26,7 @@ obj_flags = CAN_BE_HIT | DANGEROUS_POSSESSION pixel_x = -32 pixel_y = -32 - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | SHUTTLE_CRUSH_PROOF flags_1 = SUPERMATTER_IGNORES_1 var/energy diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index c65a9ad123a..9b267489100 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -21,26 +21,22 @@ All ShuttleMove procs go here return var/shuttle_dir = shuttle.dir - for(var/i in contents) - var/atom/movable/thing = i - if(ismob(thing)) - if(isliving(thing)) - var/mob/living/M = thing - if(M.buckled) - M.buckled.unbuckle_mob(M, 1) - if(M.pulledby) - M.pulledby.stop_pulling() - M.stop_pulling() - M.visible_message(span_warning("[shuttle] slams into [M]!")) - SSblackbox.record_feedback("tally", "shuttle_gib", 1, M.type) - log_shuttle("[key_name(M)] was shuttle gibbed by [shuttle].") - M.investigate_log("has been gibbed by [shuttle].", INVESTIGATE_DEATHS) - M.gib(DROP_ALL_REMAINS) - - - else //non-living mobs shouldn't be affected by shuttles, which is why this is an else - if(istype(thing, /obj/effect/abstract) || istype(thing, /obj/singularity) || istype(thing, /obj/energy_ball)) + for(var/atom/movable/thing as anything in contents) + if(thing.resistance_flags & SHUTTLE_CRUSH_PROOF) + continue + if(isliving(thing)) + var/mob/living/living_thing = thing + if(living_thing.incorporeal_move) // Don't crush incorporeal things continue + living_thing.buckled?.unbuckle_mob(living_thing, force = TRUE) + living_thing.pulledby?.stop_pulling() + living_thing.stop_pulling() + living_thing.visible_message(span_warning("[shuttle] slams into [living_thing]!")) + SSblackbox.record_feedback("tally", "shuttle_gib", 1, living_thing.type) + log_shuttle("[key_name(living_thing)] was shuttle gibbed by [shuttle].") + living_thing.investigate_log("has been gibbed by [shuttle].", INVESTIGATE_DEATHS) + living_thing.gib(DROP_ALL_REMAINS) + else if(!ismob(thing)) //non-living mobs shouldn't be affected by shuttles, which is why this is an else if(!thing.anchored) step(thing, shuttle_dir) else