Skip to content

Commit

Permalink
Moves the brain attributes into the body fabricator file for modulari…
Browse files Browse the repository at this point in the history
…ty, saves it on death instead of constantly re-saving it every life tick (#2474)

* boop

* just in case, erase that living check

* brain melt
  • Loading branch information
Gboster-0 authored Oct 21, 2024
1 parent ed3e261 commit 000756a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
23 changes: 23 additions & 0 deletions ModularTegustation/lc13_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,29 @@

#undef ANIMATE_FABRICATOR_ACTIVE

// here we add some vars to the brain to hold the attributes/traits of a mob
/obj/item/organ/brain
var/list/initial_traits = list()
var/stored_fortitude = 0
var/stored_prudence = 0
var/stored_temperance = 0
var/stored_justice = 0

/obj/item/organ/brain/Remove(mob/living/carbon/C, special = 0, no_id_transfer = FALSE)
if(C)
stored_fortitude = get_raw_level(C, FORTITUDE_ATTRIBUTE)
stored_prudence = get_raw_level(C, PRUDENCE_ATTRIBUTE)
stored_temperance = get_raw_level(C, TEMPERANCE_ATTRIBUTE)
stored_justice = get_raw_level(C, JUSTICE_ATTRIBUTE)
. = ..()

/datum/job/after_spawn(mob/living/H, mob/M, latejoin = FALSE)
. = ..()
var/obj/item/organ/brain/B = H.getorganslot(ORGAN_SLOT_BRAIN)
if(B)
if(length(B.initial_traits) == 0)
B.initial_traits = H.status_traits

/*---------------\
|Body Preservation Unit|
\---------------*/
Expand Down
13 changes: 0 additions & 13 deletions code/modules/mob/living/brain/brain_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
/datum/brain_trauma/severe/narcolepsy
)

var/list/initial_traits = list()
var/stored_fortitude = 0
var/stored_prudence = 0
var/stored_temperance = 0
var/stored_justice = 0

/obj/item/organ/brain/Insert(mob/living/carbon/C, special = 0,no_id_transfer = FALSE)
..()

Expand Down Expand Up @@ -431,10 +425,3 @@
qdel(X)
amount_cured++
return amount_cured

/obj/item/organ/brain/proc/sync_stats(mob/living/carbon/human/H) //Syncs stuff for torso fabricator
stored_fortitude = get_raw_level(H, FORTITUDE_ATTRIBUTE)
stored_prudence = get_raw_level(H, PRUDENCE_ATTRIBUTE)
stored_temperance = get_raw_level(H, TEMPERANCE_ATTRIBUTE)
stored_justice = get_raw_level(H, JUSTICE_ATTRIBUTE)

4 changes: 0 additions & 4 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
//Update our name based on whether our face is obscured/disfigured
name = get_visible_name()

var/obj/item/organ/brain/B = getorganslot(ORGAN_SLOT_BRAIN)
if(stat != DEAD && B)
B.sync_stats(src)

if(stat != DEAD)
return TRUE

Expand Down

0 comments on commit 000756a

Please sign in to comment.