Skip to content

Commit

Permalink
Embryo 1s Spawn Protection (#7728)
Browse files Browse the repository at this point in the history
# About the pull request

This PR adds a 1s spawn protection window when larva bursts from an
embryo. The mob has godmode for this duration and will signal no ignite.
The `RECENTSPAWN` flag helps identify a temporary godmode, and is what
also makes all bullets miss temporarily.

This also can be a useful admin tool since the time is variable callable
on any living mob.

# Explain why it's good for the game

Unnested bursts are already near suicide for someone to take. This
should hopefully make a narrow escape possible. Marines can still trap
bursts, but merely shooting the burst immediately will no longer work
for 1s.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

https://youtu.be/u1PXcbKuUWc

</details>


# Changelog
:cl: Drathek
add: Chestbursters now have spawn protections for 1s (godmode, evasion,
and ignores fire)
/:cl:
  • Loading branch information
Drulikar authored Dec 4, 2024
1 parent 5da6fa6 commit aa5a039
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
#define CANROOT (1<<6)
#define GODMODE (1<<12)
#define FAKEDEATH (1<<13) //Replaces stuff like changeling.changeling_fakedeath
//#define DISFIGURED (1<<14) //unused
#define RECENTSPAWN (1<<14) // Temporarily invincible via GODMODE
#define XENO_HOST (1<<15) //Tracks whether we're gonna be a baby alien's mummy.
#define IMMOBILE_ACTION (1<<16) // If you are performing an action that prevents you from being pushed by your own people.
#define PERMANENTLY_DEAD (1<<17)
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ DEFINE_BITFIELD(status_flags, list(
"PASSEMOTES" = PASSEMOTES,
"GODMODE" = GODMODE,
"FAKEDEATH" = FAKEDEATH,
"RECENTSPAWN" = RECENTSPAWN,
"XENO_HOST" = XENO_HOST,
"IMMOBILE_ACTION" = IMMOBILE_ACTION,
"PERMANENTLY_DEAD" = PERMANENTLY_DEAD,
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/xenomorph/Embryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
for(var/mob/living/carbon/xenomorph/larva/larva_embryo in victim)
var/datum/hive_status/hive = GLOB.hive_datum[larva_embryo.hivenumber]
larva_embryo.forceMove(get_turf(victim)) //moved to the turf directly so we don't get stuck inside a cryopod or another mob container.
larva_embryo.grant_spawn_protection(1 SECONDS)
playsound(larva_embryo, pick('sound/voice/alien_chestburst.ogg','sound/voice/alien_chestburst2.ogg'), 25)

if(larva_embryo.client)
Expand Down
14 changes: 14 additions & 0 deletions code/modules/mob/living/living_health_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,20 @@
client.soundOutput.status_flags ^= EAR_DEAF_MUTE
client.soundOutput.apply_status()

/mob/living/proc/grant_spawn_protection(duration)
status_flags |= RECENTSPAWN|GODMODE
RegisterSignal(src, list(COMSIG_LIVING_FLAMER_CROSSED, COMSIG_LIVING_FLAMER_FLAMED), PROC_REF(handle_fire_protection))
addtimer(CALLBACK(src, PROC_REF(end_spawn_protection)), duration)

/mob/living/proc/end_spawn_protection()
status_flags &= ~(RECENTSPAWN|GODMODE)
UnregisterSignal(src, list(COMSIG_LIVING_FLAMER_CROSSED, COMSIG_LIVING_FLAMER_FLAMED))

/mob/living/proc/handle_fire_protection(mob/living/living, datum/reagent/chem)
SIGNAL_HANDLER
if(status_flags & (RECENTSPAWN|GODMODE))
return COMPONENT_NO_IGNITE

// heal ONE limb, organ gets randomly selected from damaged ones.
/mob/living/proc/heal_limb_damage(brute, burn)
apply_damage(-brute, BRUTE)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@
to_world(SPAN_DEBUG("([L]) Hit chance: [hit_chance] | Roll: [hit_roll]"))
#endif

if(hit_chance > hit_roll)
if(hit_chance > hit_roll && !(L.status_flags & RECENTSPAWN))
#if DEBUG_HIT_CHANCE
to_world(SPAN_DEBUG("([L]) Hit."))
#endif
Expand Down

0 comments on commit aa5a039

Please sign in to comment.