Skip to content

Commit

Permalink
Shuttle gibbing code improvements (tgstation#81726) (#1371)
Browse files Browse the repository at this point in the history
Adds a resistance flag, `SHUTTLE_CRUSH_PROOF`, adds it to the existing
things that have it, and adds it to the immortality spectres.

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...

: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 <the@san7890.com>
  • Loading branch information
Absolucy and san7890 committed Mar 26, 2024
1 parent a17598d commit 8374896
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 22 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,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)
Expand Down
3 changes: 2 additions & 1 deletion code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,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(
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/effects/effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
light_inner_range = 1 //monkestation edit
light_outer_range = 2 //monkestation edit
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?
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/basic/pets/parrot/poly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/singularity/singularity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
var/ghost_notification_message = "IT'S LOOSE"

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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/tesla/energy_ball.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 15 additions & 19 deletions code/modules/shuttle/on_move.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()


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()
else if(!ismob(thing))
if(!thing.anchored)
step(thing, shuttle_dir)
else
Expand Down

0 comments on commit 8374896

Please sign in to comment.