organs NEW to INIT (#17050)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
Kashargul
2025-02-07 12:30:20 -05:00
committed by GitHub
co-authored by Cameron Lennox
parent 71627d97ce
commit bb6a263e2f
12 changed files with 143 additions and 117 deletions
+20 -20
View File
@@ -62,37 +62,37 @@ var/list/organ_cache = list()
/obj/item/organ/proc/update_health()
return
/obj/item/organ/New(var/mob/living/holder, var/internal)
..(holder)
/obj/item/organ/Initialize(mapload, var/internal)
. = ..()
create_reagents(5)
if(isliving(holder))
src.owner = holder
src.w_class = max(src.w_class + mob_size_difference(holder.mob_size, MOB_MEDIUM), 1) //smaller mobs have smaller organs.
if(isliving(loc))
src.owner = loc
src.w_class = max(src.w_class + mob_size_difference(owner.mob_size, MOB_MEDIUM), 1) //smaller mobs have smaller organs.
if(internal)
if(!LAZYLEN(holder.internal_organs))
holder.internal_organs = list()
if(!LAZYLEN(holder.internal_organs_by_name))
holder.internal_organs_by_name = list()
if(!LAZYLEN(owner.internal_organs))
owner.internal_organs = list()
if(!LAZYLEN(owner.internal_organs_by_name))
owner.internal_organs_by_name = list()
holder.internal_organs |= src
holder.internal_organs_by_name[organ_tag] = src
owner.internal_organs |= src
owner.internal_organs_by_name[organ_tag] = src
else
if(!LAZYLEN(holder.organs))
holder.organs = list()
if(!LAZYLEN(holder.organs_by_name))
holder.organs_by_name = list()
if(!LAZYLEN(owner.organs))
owner.organs = list()
if(!LAZYLEN(owner.organs_by_name))
owner.organs_by_name = list()
holder.organs |= src
holder.organs_by_name[organ_tag] = src
owner.organs |= src
owner.organs_by_name[organ_tag] = src
if(!max_damage)
max_damage = min_broken_damage * 2
if(iscarbon(holder))
var/mob/living/carbon/C = holder
if(iscarbon(owner))
var/mob/living/carbon/C = owner
species = GLOB.all_species[SPECIES_HUMAN]
if(holder.dna)
if(owner.dna)
qdel_swap(dna, C.dna.Clone())
species = C.species
else