Skip to content

Commit

Permalink
made organs use initialize properly
Browse files Browse the repository at this point in the history
well I guess I have to do this now too, thanks Amaya
  • Loading branch information
Spookerton committed Jan 7, 2025
1 parent 200bf2d commit c0768ab
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 41 deletions.
4 changes: 2 additions & 2 deletions code/modules/organs/external/_external.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
if(get_fingerprint())
A.add_partial_print(get_fingerprint())

/obj/item/organ/external/New(mob/living/carbon/holder)
..()
/obj/item/organ/external/Initialize()
. = ..()
if(isnull(pain_disability_threshold))
pain_disability_threshold = (max_damage * 0.75)
if(owner)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/organs/external/stump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
icon_name = ""
dislocated = -1

/obj/item/organ/external/stump/New(mob/living/carbon/holder, internal, obj/item/organ/external/limb)
/obj/item/organ/external/stump/Initialize(mapload, internal, obj/item/organ/external/limb)
if(istype(limb))
SetName("stump of \a [limb.name]")
organ_tag = limb.organ_tag
Expand All @@ -13,7 +13,7 @@
parent_organ = limb.parent_organ
artery_name = "mangled [limb.artery_name]"
arterial_bleed_severity = limb.arterial_bleed_severity
..(holder, internal)
. = ..(loc, internal)
if(istype(limb))
max_damage = limb.max_damage
if(BP_IS_ROBOTIC(limb) && (!parent || BP_IS_ROBOTIC(parent)))
Expand Down
17 changes: 8 additions & 9 deletions code/modules/organs/internal/_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
var/min_bruised_damage = 10 // Damage before considered bruised
var/damage_reduction = 0.5 //modifier for internal organ injury

/obj/item/organ/internal/New(mob/living/carbon/holder)
/obj/item/organ/internal/Initialize()
if(max_damage)
min_bruised_damage = floor(max_damage / 4)
..()
if(istype(holder) && !istype(src, /obj/item/organ/internal/augment))
. = ..()
if(iscarbon(loc) && !istype(src, /obj/item/organ/internal/augment))
var/mob/living/carbon/human/holder = loc
holder.internal_organs |= src

var/mob/living/carbon/human/H = holder
if(istype(H))
var/obj/item/organ/external/E = H.get_organ(parent_organ)
if(!E)
if(ishuman(holder))
var/obj/item/organ/external/external = holder.get_organ(parent_organ)
if(!external)
CRASH("[src] spawned in [holder] without a parent organ: [parent_organ].")
E.internal_organs |= src
external.internal_organs |= src

/obj/item/organ/internal/Destroy()
if(owner)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/organs/internal/brain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
. = ..()
icon_state = "brain-prosthetic"

/obj/item/organ/internal/brain/New(mob/living/carbon/holder)
..()
/obj/item/organ/internal/brain/Initialize()
. = ..()
if(species)
set_max_damage(species.total_health)
else
Expand Down
8 changes: 4 additions & 4 deletions code/modules/organs/internal/eyes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
if(is_broken())
owner.eye_blind = 20

/obj/item/organ/internal/eyes/New()
..()
/obj/item/organ/internal/eyes/Initialize()
. = ..()
flash_mod = species.flash_mod
darksight_range = species.darksight_range
darksight_tint = species.darksight_tint
Expand All @@ -101,8 +101,8 @@
name = "optical sensor"
status = ORGAN_ROBOTIC

/obj/item/organ/internal/eyes/robot/New()
..()
/obj/item/organ/internal/eyes/robot/Initialize()
. = ..()
robotize()

/obj/item/organ/internal/eyes/robotize()
Expand Down
14 changes: 9 additions & 5 deletions code/modules/organs/internal/species/fbp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
//at 0.26 completely depleted after 60ish minutes of constant walking or 130 minutes of standing still
var/servo_cost = 0.26

/obj/item/organ/internal/cell/New()
/obj/item/organ/internal/cell/Initialize()
. = ..()
robotize()
if(ispath(cell))
cell = new cell(src)
..()

/obj/item/organ/internal/cell/proc/percent()
if(!cell)
Expand Down Expand Up @@ -120,12 +120,16 @@
stored_mmi = null
return ..()

/obj/item/organ/internal/mmi_holder/New(mob/living/carbon/human/new_owner, internal)
..(new_owner, internal)
/obj/item/organ/internal/mmi_holder/Initialize()
. = ..()
if(!stored_mmi)
stored_mmi = new(src)
sleep(-1)
return INITIALIZE_HINT_LATELOAD

/obj/item/organ/internal/mmi_holder/LateInitialize()
update_from_mmi()
if (!owner)
return
persistantMind = owner.mind
ownerckey = owner.ckey

Expand Down
8 changes: 4 additions & 4 deletions code/modules/organs/internal/species/ipc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
)
var/shackle = 0

/obj/item/organ/internal/posibrain/New(mob/living/carbon/H)
..()
if(!brainmob && H)
init(H)
/obj/item/organ/internal/posibrain/Initialize()
. = ..()
if(!brainmob && iscarbon(loc))
init(loc)
robotize()
unshackle()
update_icon()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/organs/internal/species/nabber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
/obj/item/organ/internal/eyes/insectoid/nabber/proc/remove_shield()
owner.clear_fullscreen("eyeshield")

/obj/item/organ/internal/eyes/nabber/New(mob/living/carbon/holder)
/obj/item/organ/internal/eyes/nabber/Initialize()
. = ..()
if(dna)
color = rgb(dna.GetUIValue(DNA_UI_EYES_R), dna.GetUIValue(DNA_UI_EYES_G), dna.GetUIValue(DNA_UI_EYES_B))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/organs/internal/species/vox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@
var/datum/mind/backup
var/prompting = FALSE // Are we waiting for a user prompt?

/obj/item/organ/internal/voxstack/New()
..()
/obj/item/organ/internal/voxstack/Initialize()
. = ..()
do_backup()
robotize()

Expand Down
4 changes: 2 additions & 2 deletions code/modules/organs/internal/stomach.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
QDEL_NULL(ingested)
. = ..()

/obj/item/organ/internal/stomach/New()
..()
/obj/item/organ/internal/stomach/Initialize()
. = ..()
var/ingested_atom = owner ? owner : src
ingested = new/datum/reagents/metabolism(240, ingested_atom, CHEM_INGEST)
if(species.gluttonous)
Expand Down
15 changes: 7 additions & 8 deletions code/modules/organs/organ.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,21 @@ var/global/list/organ_cache = list()
return (damage >= min_broken_damage || (status & ORGAN_CUT_AWAY) || (status & ORGAN_BROKEN))

//Second argument may be a dna datum; if null will be set to holder's dna.
/obj/item/organ/New(mob/living/carbon/holder, datum/dna/given_dna)
..(holder)
/obj/item/organ/Initialize(mapload, datum/dna/given_dna)
. = ..()
if(!istype(given_dna))
given_dna = null

if(max_damage)
min_broken_damage = floor(max_damage / 2)
else
max_damage = min_broken_damage * 2

if(istype(holder))
owner = holder
if(!given_dna && holder.dna)
given_dna = holder.dna
if (iscarbon(loc))
owner = loc
if(!given_dna && owner.dna)
given_dna = owner.dna
else
log_debug("[src] spawned in [holder] without a proper DNA.")
log_debug("[src] spawned in [owner] without a proper DNA.")

if (given_dna)
set_dna(given_dna)
Expand Down

0 comments on commit c0768ab

Please sign in to comment.