Reworks cult sharding to not perma kill mindshielded victims [Needs TM] (#20402)

* fucking cult

* WERE STILL WORKING ON ITTTT

* d

* Revert "d"

This reverts commit 8a4bf06f5c.

* MOREEEE

* update

* Revert "update"

This reverts commit 65d85eae87.

* only chap can do it now lmao

* WHOOPS

* OK NOW

* Update runes.dm

* Apply suggestions from code review

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

* PLEASE TESTMERGE AAA

* fixes some stuff, improves it

* fixes the code from merge conflict

* Update code/game/gamemodes/wizard/soulstone.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* fixes a bug with shit not dying due to brains

* Adds some GC stuff, Sirr's code reviews.

* finishes the last changes and reviews

* missed 1

---------

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Octus
2023-05-09 19:41:40 -05:00
committed by GitHub
parent a85d4bd9ae
commit a7156dce16
6 changed files with 107 additions and 23 deletions
@@ -26,6 +26,8 @@
del_on_death = TRUE
deathmessage = "collapses in a shattered heap."
var/construct_type = "shade"
/// The body/brain of the player inside this construct, transferred over from the soulstone.
var/mob/living/held_body
var/list/construct_spells = list()
/// Is this a holy/purified construct?
var/holy = FALSE
@@ -50,9 +52,34 @@
set_light(2, 3, l_color = SSticker.cultdat ? SSticker.cultdat.construct_glow : LIGHT_COLOR_BLOOD_MAGIC)
/mob/living/simple_animal/hostile/construct/Destroy()
remove_held_body()
return ..()
/mob/living/simple_animal/hostile/construct/death(gibbed)
. = ..()
SSticker.mode.remove_cultist(show_message = FALSE, target_mob = src)
if(held_body) // Null check for empty bodies
held_body.forceMove(get_turf(src))
SSticker.mode.add_cult_immunity(held_body)
if(ismob(held_body)) // Check if the held_body is a mob
held_body.key = key
else if(istype(held_body, /obj/item/organ/internal/brain)) // Check if the held_body is a brain
var/obj/item/organ/internal/brain/brain = held_body
if(brain.brainmob) // Check if the brain has a brainmob
brain.brainmob.key = key // Set the key to the brainmob
brain.brainmob.mind.transfer_to(brain.brainmob) // Transfer the mind to the brainmob
held_body.cancel_camera()
new /obj/effect/temp_visual/cult/sparks(get_turf(src))
playsound(src, 'sound/effects/pylon_shatter.ogg', 40, TRUE)
. = ..()
/mob/living/simple_animal/hostile/construct/proc/add_held_body(atom/movable/body)
held_body = body
RegisterSignal(body, COMSIG_PARENT_QDELETING, PROC_REF(remove_held_body))
/mob/living/simple_animal/hostile/construct/proc/remove_held_body()
SIGNAL_HANDLER
held_body = null
/mob/living/simple_animal/hostile/construct/examine(mob/user)
. = ..()