Allows clings to regenerate without a brain. (#19856)

* Move brain organ code where it belongs

* Rename too

* WIP, but hey, it kinda works now.

* Account for a few missing heads

* Remove vital check, killing the user on death

* Let defibs and scanners better deal with these

* Remove debug brains

* Clean up some more contingencies

* More head checks

* Update code/modules/antagonists/changeling/datum_changeling.dm

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* Fixes up signal business

* some stuff from sean's review

* Add some type safety checks for heads

* oops

* Update code/game/objects/items/weapons/cosmetics.dm

get this in there too

Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>

* Remove decap sword

* Quick suggestions

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

* Addresses shedding problems

* Add new defib changes

* this is why we have CI

Co-authored-by: Farie82 <farie82@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Luc
2023-01-20 19:25:51 -05:00
committed by GitHub
co-authored by Farie82 S34N Ryan
parent b90bb7bcb8
commit b940c1eb21
27 changed files with 208 additions and 133 deletions
@@ -1,137 +0,0 @@
/obj/item/organ/internal/brain
name = "brain"
max_damage = 120
icon_state = "brain2"
force = 1.0
w_class = WEIGHT_CLASS_SMALL
throwforce = 1.0
throw_speed = 3
throw_range = 5
origin_tech = "biotech=5"
attack_verb = list("attacked", "slapped", "whacked")
var/mob/living/carbon/brain/brainmob = null
organ_tag = "brain"
parent_organ = "head"
slot = "brain"
vital = TRUE
hidden_pain = TRUE //the brain has no pain receptors, and brain damage is meant to be a stealthy damage type.
var/mmi_icon = 'icons/obj/assemblies.dmi'
var/mmi_icon_state = "mmi_full"
/obj/item/organ/internal/brain/xeno
name = "xenomorph brain"
desc = "We barely understand the brains of terrestial animals. Who knows what we may find in the brain of such an advanced species?"
icon_state = "brain-x"
origin_tech = "biotech=6"
mmi_icon = 'icons/mob/alien.dmi'
mmi_icon_state = "AlienMMI"
/obj/item/organ/internal/brain/Destroy()
QDEL_NULL(brainmob)
return ..()
/obj/item/organ/internal/brain/proc/transfer_identity(mob/living/carbon/H)
brainmob = new(src)
if(isnull(dna)) // someone didn't set this right...
stack_trace("[src] at [loc] did not contain a dna datum at time of removal.")
dna = H.dna.Clone()
name = "\the [dna.real_name]'s [initial(src.name)]"
brainmob.dna = dna.Clone() // Silly baycode, what you do
// brainmob.dna = H.dna.Clone() Putting in and taking out a brain doesn't make it a carbon copy of the original brain of the body you put it in
brainmob.name = dna.real_name
brainmob.real_name = dna.real_name
brainmob.timeofhostdeath = H.timeofdeath
if(H.mind)
H.mind.transfer_to(brainmob)
to_chat(brainmob, "<span class='notice'>You feel slightly disoriented. That's normal when you're just a [initial(src.name)].</span>")
/obj/item/organ/internal/brain/examine(mob/user) // -- TLE
. = ..()
if(brainmob && brainmob.client)//if thar be a brain inside... the brain.
. += "You can feel the small spark of life still left in this one."
else
. += "This one seems particularly lifeless. Perhaps it will regain some of its luster later.."
/obj/item/organ/internal/brain/remove(mob/living/user,special = 0)
if(dna)
name = "[dna.real_name]'s [initial(name)]"
if(!owner) return ..() // Probably a redundant removal; just bail
var/obj/item/organ/internal/brain/B = src
if(!special)
if(owner.mind && !non_primary)//don't transfer if the owner does not have a mind.
B.transfer_identity(user)
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
H.update_hair()
owner.thought_bubble_image = initial(owner.thought_bubble_image)
. = ..()
/obj/item/organ/internal/brain/insert(mob/living/target,special = 0)
name = "[initial(name)]"
var/brain_already_exists = 0
if(ishuman(target)) // No more IPC multibrain shenanigans
if(target.get_int_organ(/obj/item/organ/internal/brain))
brain_already_exists = 1
var/mob/living/carbon/human/H = target
H.update_hair()
if(!brain_already_exists)
if(brainmob)
if(target.key)
target.ghostize()
if(brainmob.mind)
brainmob.mind.transfer_to(target)
else
target.key = brainmob.key
else
log_debug("Multibrain shenanigans at ([target.x],[target.y],[target.z]), mob '[target]'")
..(target, special = special)
/obj/item/organ/internal/brain/receive_damage(amount, silent = 0) //brains are special; if they receive damage by other means, we really just want the damage to be passed ot the owner and back onto the brain.
if(owner)
owner.adjustBrainLoss(amount)
/obj/item/organ/internal/brain/necrotize(update_sprite = TRUE) //Brain also has special handling for when it necrotizes
damage = max_damage
status |= ORGAN_DEAD
STOP_PROCESSING(SSobj, src)
if(dead_icon && !is_robotic())
icon_state = dead_icon
if(owner && vital)
owner.setBrainLoss(120)
/obj/item/organ/internal/brain/prepare_eat()
return // Too important to eat.
/obj/item/organ/internal/brain/slime
name = "slime core"
desc = "A complex, organic knot of jelly and crystalline particles."
icon = 'icons/mob/slimes.dmi'
icon_state = "green slime extract"
mmi_icon_state = "slime_mmi"
// parent_organ = "chest" Hello I am from the ministry of rubber forehead aliens how are you
/obj/item/organ/internal/brain/golem
name = "Runic mind"
desc = "A tightly furled roll of paper, covered with indecipherable runes."
icon = 'icons/obj/wizard.dmi'
icon_state = "scroll"
/obj/item/organ/internal/brain/Destroy() //copypasted from MMIs.
QDEL_NULL(brainmob)
return ..()
/obj/item/organ/internal/brain/cluwne
/obj/item/organ/internal/brain/cluwne/insert(mob/living/target, special = 0, make_cluwne = 1)
..(target, special = special)
if(ishuman(target) && make_cluwne)
var/mob/living/carbon/human/H = target
H.makeCluwne() //No matter where you go, no matter what you do, you cannot escape
@@ -10,13 +10,14 @@
gender = new_gender
var/datum/sprite_accessory/hair/current_hair = GLOB.hair_styles_full_list[H.h_style]
if(current_hair.gender != NEUTER && current_hair.gender != gender)
reset_head_hair()
if(istype(H))
var/datum/sprite_accessory/hair/current_hair = GLOB.hair_styles_full_list[H.h_style]
if(current_hair.gender != NEUTER && current_hair.gender != gender)
reset_head_hair()
var/datum/sprite_accessory/hair/current_fhair = GLOB.facial_hair_styles_list[H.f_style]
if(current_fhair.gender != NEUTER && current_fhair.gender != gender)
reset_facial_hair()
var/datum/sprite_accessory/hair/current_fhair = GLOB.facial_hair_styles_list[H.f_style]
if(current_fhair.gender != NEUTER && current_fhair.gender != gender)
reset_facial_hair()
if(update_dna)
update_dna()
@@ -361,10 +361,9 @@
msg += "<span class = 'deptradio'>Medical records:</span> <a href='?src=[UID()];medrecord=`'>\[View\]</a> <a href='?src=[UID()];medrecordadd=`'>\[Add comment\]</a>\n"
if(print_flavor_text() && !skipface)
if(get_organ("head"))
var/obj/item/organ/external/head/H = get_organ("head")
if(!(H.status & ORGAN_DISFIGURED))
msg += "[print_flavor_text()]\n"
var/obj/item/organ/external/head/H = get_organ("head")
if(H && !(H.status & ORGAN_DISFIGURED))
msg += "[print_flavor_text()]\n"
msg += "*---------*</span>"
if(pose)
+28 -25
View File
@@ -1393,32 +1393,33 @@
//Handle default hair/head accessories for created mobs.
var/obj/item/organ/external/head/H = get_organ("head")
if(dna.species.default_hair)
H.h_style = dna.species.default_hair
else
H.h_style = "Bald"
if(dna.species.default_fhair)
H.f_style = dna.species.default_fhair
else
H.f_style = "Shaved"
if(dna.species.default_headacc)
H.ha_style = dna.species.default_headacc
else
H.ha_style = "None"
if(istype(H))
if(dna.species.default_hair)
H.h_style = dna.species.default_hair
else
H.h_style = "Bald"
if(dna.species.default_fhair)
H.f_style = dna.species.default_fhair
else
H.f_style = "Shaved"
if(dna.species.default_headacc)
H.ha_style = dna.species.default_headacc
else
H.ha_style = "None"
if(dna.species.default_hair_colour)
//Apply colour.
H.hair_colour = dna.species.default_hair_colour
else
H.hair_colour = "#000000"
if(dna.species.default_fhair_colour)
H.facial_colour = dna.species.default_fhair_colour
else
H.facial_colour = "#000000"
if(dna.species.default_headacc_colour)
H.headacc_colour = dna.species.default_headacc_colour
else
H.headacc_colour = "#000000"
if(dna.species.default_hair_colour)
//Apply colour.
H.hair_colour = dna.species.default_hair_colour
else
H.hair_colour = "#000000"
if(dna.species.default_fhair_colour)
H.facial_colour = dna.species.default_fhair_colour
else
H.facial_colour = "#000000"
if(dna.species.default_headacc_colour)
H.headacc_colour = dna.species.default_headacc_colour
else
H.headacc_colour = "#000000"
m_styles = DEFAULT_MARKING_STYLES //Wipes out markings, setting them all to "None".
m_colours = DEFAULT_MARKING_COLOURS //Defaults colour to #00000 for all markings.
@@ -1525,6 +1526,8 @@
/mob/living/carbon/human/proc/get_eye_shine() //Referenced cult constructs for shining in the dark. Needs to be above lighting effects such as shading.
var/obj/item/organ/external/head/head_organ = get_organ("head")
if(!istype(head_organ))
return
var/datum/sprite_accessory/hair/hair_style = GLOB.hair_styles_full_list[head_organ.h_style]
var/icon/hair = new /icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
var/mutable_appearance/MA = mutable_appearance(get_icon_difference(get_eyecon(), hair), layer = ABOVE_LIGHTING_LAYER)
@@ -64,6 +64,10 @@
if(sponge)
return min(sponge.damage,maxHealth*2)
else
if(ischangeling(src))
// if a changeling has no brain, they have no brain damage.
return 0
return 200
else
return 0
@@ -847,7 +847,7 @@
if(radiation > RAD_MOB_HAIRLOSS)
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
if(!head_organ || (NO_HAIR in species_traits))
if(!istype(head_organ) || (NO_HAIR in species_traits))
return
if(prob(15) && head_organ.h_style != "Bald")
to_chat(H, "<span class='danger'>Your hair starts to fall out in clumps...</span>")
@@ -1019,4 +1019,4 @@ It'll return null if the organ doesn't correspond, so include null checks when u
return H.skin_colour
else
var/obj/item/organ/external/head/HD = H.get_organ("head")
return HD.hair_colour
return HD?.hair_colour
@@ -103,7 +103,7 @@
/datum/species/machine/handle_death(gibbed, mob/living/carbon/human/H)
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
if(!head_organ)
if(!istype(head_organ))
return
head_organ.h_style = "Bald"
head_organ.f_style = "Shaved"
@@ -306,7 +306,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
markings_standing.Blend(b_marking_s, ICON_OVERLAY)
//Head markings.
var/obj/item/organ/external/head/head_organ = get_organ("head")
if(head_organ && m_styles["head"]) //If the head is destroyed, forget the head markings. This prevents floating optical markings on decapitated IPCs, for example.
if(istype(head_organ) && m_styles["head"]) //If the head is destroyed, forget the head markings. This prevents floating optical markings on decapitated IPCs, for example.
var/head_marking = m_styles["head"]
var/datum/sprite_accessory/head_marking_style = GLOB.marking_styles_list[head_marking]
if(head_marking_style && head_marking_style.species_allowed && (head_organ.dna.species.name in head_marking_style.species_allowed))
@@ -325,7 +325,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
remove_overlay(HEAD_ACC_OVER_LAYER)
var/obj/item/organ/external/head/head_organ = get_organ("head")
if(!head_organ)
if(!istype(head_organ))
return
//masks and helmets can obscure our head accessory
@@ -360,7 +360,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
remove_overlay(HAIR_LAYER)
var/obj/item/organ/external/head/O = get_organ("head")
if(!O)
if(!istype(O))
return
if((head?.flags & BLOCKHAIR) || (wear_mask?.flags & BLOCKHAIR))
@@ -445,7 +445,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
remove_overlay(FHAIR_OVER_LAYER)
var/obj/item/organ/external/head/head_organ = get_organ("head")
if(!head_organ)
if(!istype(head_organ))
return
//masks and helmets can obscure our facial hair, unless we're a synthetic
@@ -987,7 +987,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
if(wear_mask && (istype(wear_mask, /obj/item/clothing/mask) || istype(wear_mask, /obj/item/clothing/accessory)))
if(!(slot_wear_mask in check_obscured_slots()))
var/obj/item/organ/external/head/head_organ = get_organ("head")
if(!head_organ)
if(!istype(head_organ))
return // Nothing to update here
var/datum/sprite_accessory/alt_heads/alternate_head
if(head_organ.alt_head && head_organ.alt_head != "None")
@@ -220,7 +220,7 @@
SSticker.mode.greyshirts += target.mind
target.set_species(/datum/species/human)
var/obj/item/organ/external/head/head_organ = target.get_organ("head")
if(head_organ)
if(istype(head_organ))
head_organ.h_style = "Bald"
head_organ.f_style = "Shaved"
target.s_tone = 35