Skip to content

Commit

Permalink
Fixes Static Anomalies (#2897)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
bzzt. kss bzzt kzz (fixes the static anomaly, it no longer does a weird
runtime related to attempting to run mob code on a spawner effect. The
resulting fucked up chat message is also fixed.)

bzzzap kzzazz mmm bzzzaap (Adds a weakref on mob spawners pointing to
their spawned mob. This is also a surprise tool that'll help us later w.
stuff related to manipulating entities after they've been spawned. I'll
prolly port the full mob spawner rework at some point)
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
bzzz
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
fix: planetary static anomalies no longer drop a broken spawner.
code: mob spawners now store a weakref on their spawned object
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Sun-Soaked authored Apr 19, 2024
1 parent a41f2b9 commit 9e9b5ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 9 additions & 6 deletions code/game/objects/effects/anomalies/anomalies_static.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
var/mob/living/carbon/victim = looking
var/obj/effect/anomaly/tvstatic/planetary/expansion
expansion = new(get_turf(victim))
visible_message("<span class='warning'> The static overtakes [victim], [expansion] taking their place!</span>")
visible_message(span_warning("The static overtakes [victim], taking their place!"))
victim.death()
expansion.stored_mob = victim
victim.forceMove(expansion)
Expand Down Expand Up @@ -89,13 +89,13 @@

/obj/effect/anomaly/tvstatic/detonate()
for(var/mob/living/carbon/human/looking in range(effectrange, src))
visible_message("<span class='boldwarning'> The static lashes out, agony filling your mind as its tendrils scrape your thoughts!</span>")
visible_message(span_boldwarning(" The static lashes out, agony filling your mind as its tendrils scrape your thoughts!"))
if (!HAS_TRAIT(looking, TRAIT_MINDSHIELD) && looking.stat != DEAD)
looking.adjustOrganLoss(ORGAN_SLOT_BRAIN, 100, 200)
playsound(src, 'sound/effects/stall.ogg', 100)
if(stored_mob)
mangle_corpse()
visible_message("<span class='warning'>The static sputters out [stored_mob], their body coming out in a burst of blood and gore!</span>")
visible_message(span_warning("The static sputters out [stored_mob], their body coming out in a burst of blood and gore!"))
new /obj/effect/gibspawner/human(loc)
stored_mob.forceMove(get_turf(src))
stored_mob = null
Expand All @@ -111,7 +111,7 @@
var/turf/T = get_turf(src)
if(T)
if(stored_mob)
visible_message("<span class='warning'>The static spits out [stored_mob], their body coming out in a burst!</span>")
visible_message(span_warning("The static spits out [stored_mob], their body coming out in a burst!"))
stored_mob.forceMove(get_turf(src))
stored_mob = null
. = ..()
Expand All @@ -122,8 +122,11 @@
immobile = TRUE

/obj/effect/anomaly/tvstatic/planetary/Initialize(mapload)
if(prob(25))
stored_mob = /obj/effect/mob_spawn/human/corpse/damaged
if(prob(25) & !stored_mob)
var/obj/effect/mob_spawn/human/corpse/damaged/legioninfested/vicspawner = new (src)
var/mob/living/carbon/victim = (vicspawner.spawned_mob_ref)?.resolve()
src.stored_mob = victim
victim.forceMove(src)
. = ..()

/obj/effect/particle_effect/staticball
Expand Down
4 changes: 4 additions & 0 deletions code/modules/awaymissions/corpse.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
var/show_flavour = TRUE
var/banType = ROLE_LAVALAND
var/ghost_usable = TRUE
/// Weakref to the mob this spawner created - just if you needed to do something with it.
var/datum/weakref/spawned_mob_ref

//ATTACK GHOST IGNORING PARENT RETURN VALUE
/obj/effect/mob_spawn/attack_ghost(mob/user)
Expand Down Expand Up @@ -128,6 +130,7 @@
MM.name = M.real_name
if(uses > 0)
uses--
spawned_mob_ref = WEAKREF(M)
if(!permanent && !uses)
qdel(src)
return M
Expand Down Expand Up @@ -220,6 +223,7 @@
if(istype(C))
C.sensor_mode = NO_SENSORS


var/obj/item/card/id/W = H.wear_id
if(W)
if(H.age)
Expand Down

0 comments on commit 9e9b5ff

Please sign in to comment.