mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Organ Deletion Upon Removal is now handled by base procs instead of overrides (#18624)
* organs fix * minor tweak * documentation changes * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> * requested changes Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
name = "Man-Machine Interface"
|
||||
parent_organ = "chest"
|
||||
status = ORGAN_ROBOT
|
||||
destroy_on_removal = TRUE
|
||||
|
||||
var/obj/item/mmi/stored_mmi
|
||||
|
||||
/obj/item/organ/internal/brain/mmi_holder/Destroy()
|
||||
@@ -22,9 +24,7 @@
|
||||
owner.mind.transfer_to(stored_mmi.brainmob)
|
||||
stored_mmi.forceMove(get_turf(owner))
|
||||
stored_mmi = null
|
||||
..()
|
||||
if(!QDELETED(src))
|
||||
qdel(src)
|
||||
return ..()
|
||||
|
||||
/obj/item/organ/internal/brain/mmi_holder/proc/update_from_mmi()
|
||||
if(!stored_mmi)
|
||||
|
||||
@@ -31,11 +31,14 @@
|
||||
var/hidden_pain = FALSE //will it skip pain messages?
|
||||
var/requires_robotic_bodypart = FALSE
|
||||
|
||||
///Should this organ be destroyed on removal?
|
||||
var/destroy_on_removal = FALSE
|
||||
|
||||
|
||||
/obj/item/organ/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
if(owner)
|
||||
remove(owner, 1)
|
||||
remove(owner, TRUE)
|
||||
QDEL_LIST_ASSOC_VAL(autopsy_data)
|
||||
QDEL_NULL(dna)
|
||||
return ..()
|
||||
@@ -229,6 +232,14 @@
|
||||
status &= ~ORGAN_SPLINTED
|
||||
status |= ORGAN_ROBOT
|
||||
|
||||
/*
|
||||
* remove
|
||||
*
|
||||
* Removes the organ from the user properly.
|
||||
* If the organ is vital, it will kill the user.
|
||||
* The proc returns the organ removed (i.e. `src`) assuming it was removed successfully;
|
||||
* otherwise, or if the organ gets destroyed in the process, it returns null.
|
||||
*/
|
||||
/obj/item/organ/proc/remove(mob/living/user, special = 0)
|
||||
if(!istype(owner))
|
||||
return
|
||||
@@ -245,6 +256,9 @@
|
||||
add_attack_logs(user, owner, "Removed vital organ ([src])", !!user ? ATKLOG_FEW : ATKLOG_ALL)
|
||||
owner.death()
|
||||
owner = null
|
||||
if(destroy_on_removal && !QDELETED(src))
|
||||
qdel(src)
|
||||
return
|
||||
return src
|
||||
|
||||
/obj/item/organ/proc/replaced(mob/living/carbon/human/target)
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
var/datum/action/A = X
|
||||
A.Remove(M)
|
||||
START_PROCESSING(SSobj, src)
|
||||
if(destroy_on_removal && !QDELETED(src))
|
||||
qdel(src)
|
||||
return
|
||||
return src
|
||||
|
||||
/obj/item/organ/internal/emp_act(severity)
|
||||
@@ -202,6 +205,8 @@
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
parent_organ = "head"
|
||||
slot = "brain_tumor"
|
||||
destroy_on_removal = TRUE
|
||||
|
||||
var/organhonked = 0
|
||||
var/suffering_delay = 900
|
||||
var/datum/component/squeak
|
||||
@@ -217,14 +222,13 @@
|
||||
squeak = M.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg' = 1), 50, falloff_exponent = 20)
|
||||
|
||||
/obj/item/organ/internal/honktumor/remove(mob/living/carbon/M, special = 0)
|
||||
. = ..()
|
||||
M.dna.SetSEState(GLOB.clumsyblock, FALSE)
|
||||
M.dna.SetSEState(GLOB.comicblock, FALSE)
|
||||
singlemutcheck(M, GLOB.clumsyblock, MUTCHK_FORCED)
|
||||
singlemutcheck(M, GLOB.comicblock, MUTCHK_FORCED)
|
||||
M.RemoveElement(/datum/element/waddling)
|
||||
QDEL_NULL(squeak)
|
||||
qdel(src)
|
||||
return ..()
|
||||
|
||||
/obj/item/organ/internal/honktumor/on_life()
|
||||
if(organhonked < world.time)
|
||||
@@ -269,6 +273,8 @@
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
parent_organ = "groin"
|
||||
slot = "honk_bladder"
|
||||
destroy_on_removal = TRUE
|
||||
|
||||
var/datum/component/squeak
|
||||
|
||||
/obj/item/organ/internal/honkbladder/insert(mob/living/carbon/M, special = 0)
|
||||
@@ -276,10 +282,8 @@
|
||||
squeak = M.AddComponent(/datum/component/squeak, list('sound/effects/clownstep1.ogg'=1,'sound/effects/clownstep2.ogg'=1), 50, falloff_exponent = 20)
|
||||
|
||||
/obj/item/organ/internal/honkbladder/remove(mob/living/carbon/M, special = 0)
|
||||
. = ..()
|
||||
|
||||
QDEL_NULL(squeak)
|
||||
qdel(src)
|
||||
return ..()
|
||||
|
||||
/obj/item/organ/internal/beard
|
||||
name = "beard organ"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
name = "spider eggs"
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "eggs"
|
||||
destroy_on_removal = TRUE
|
||||
|
||||
var/stage = 1
|
||||
|
||||
/obj/item/organ/internal/body_egg/spider_eggs/on_life()
|
||||
@@ -33,13 +35,8 @@
|
||||
owner.gib()
|
||||
|
||||
/obj/item/organ/internal/body_egg/spider_eggs/remove(mob/living/carbon/M, special = 0)
|
||||
..()
|
||||
M.reagents.del_reagent("spidereggs") //purge all remaining spider eggs reagent if caught, in time.
|
||||
if(!QDELETED(src))
|
||||
qdel(src) // prevent people re-implanting them into others
|
||||
return null
|
||||
|
||||
|
||||
return ..()
|
||||
|
||||
// Terror Spiders - white spider infection
|
||||
|
||||
@@ -47,6 +44,7 @@
|
||||
name = "terror eggs"
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "eggs"
|
||||
destroy_on_removal = TRUE
|
||||
|
||||
var/cycle_num = 0 // # of on_life() cycles completed, never reset
|
||||
var/egg_progress = 0 // # of on_life() cycles completed, unlike cycle_num this is reset on each hatch event
|
||||
@@ -102,11 +100,5 @@
|
||||
eggs_hatched++
|
||||
to_chat(owner, "<span class='warning'>A strange prickling sensation moves across your skin... then suddenly the whole world seems to spin around you!</span>")
|
||||
owner.Paralyse(20 SECONDS)
|
||||
if(infection_completed && !QDELETED(src))
|
||||
qdel(src)
|
||||
|
||||
/obj/item/organ/internal/body_egg/terror_eggs/remove(mob/living/carbon/M, special = 0)
|
||||
..()
|
||||
if(!QDELETED(src))
|
||||
qdel(src) // prevent people re-implanting them into others
|
||||
return null
|
||||
if(infection_completed)
|
||||
remove(owner)
|
||||
|
||||
Reference in New Issue
Block a user