Files
SmArtKar 8e63bdd337 Moves disfiguration to be handled by the head instead of the mob itself (#94948)
## About The Pull Request
TRAIT_DISFIGURED and physical disfiguration are now handled by the head
bodypart rather than being on the mob itself. This is mostly for
internal purposes, but it does mean that:
- Players can now perform plastic surgery on torn off heads.
- Disfigured mobs' heads keep their face hidden, and when attached to a
different body won't magically get repaired and vice versa, attaching a
new head to a disfigured corpse no longer disfigures it.
- Robotic (and other non-huskable) heads no longer become disfigured
from husking
- Also in the rare case of grafting a head torn off from a husk onto
another body, they no longer permanently turn into an Unknown. (lol)

## Why It's Good For The Game

Saner code, we generally want limb-specific behaviors to be on limbs
themselves and not on the mob. Also yeah that one weird edge case.
~~Husks are next on the chopping block~~

## Changelog
🆑
qol: Plastic surgery can now be done on detached heads.
refactor: Refactored how disfiguration is handled to be stored on head's
side
fix: Robotic (and other non-huskable) heads no longer become disfigured
from husking
fix: Attaching a head from a husk to a different body no longer
permanently turns them into an Unknown.
/🆑
2026-01-28 20:25:25 +00:00

87 lines
2.4 KiB
Plaintext

/obj/structure/headpike
name = "spooky head on a spear"
desc = "When you really want to send a message."
icon = 'icons/obj/structures.dmi'
icon_state = "headpike"
density = FALSE
anchored = TRUE
custom_materials = list(/datum/material/glass = SHEET_MATERIAL_AMOUNT * 1.15, /datum/material/iron = SHEET_MATERIAL_AMOUNT * 0.65)
var/obj/item/spear/spear
var/obj/item/spear/speartype = /obj/item/spear
var/obj/item/bodypart/head/victim
/obj/structure/headpike/bone //for bone spears
icon_state = "headpike-bone"
speartype = /obj/item/spear/bonespear
custom_materials = list(/datum/material/bone = SHEET_MATERIAL_AMOUNT * 4)
/obj/structure/headpike/bamboo //for bamboo spears
icon_state = "headpike-bamboo"
speartype = /obj/item/spear/bamboospear
custom_materials = list(/datum/material/bamboo = SHEET_MATERIAL_AMOUNT * 25)
/obj/structure/headpike/military //for military spears
icon_state = "headpike-military"
speartype = /obj/item/spear/military
/obj/structure/headpike/Initialize(mapload)
. = ..()
if(mapload)
spear = new speartype(src)
victim = new(src)
victim.real_name = generate_random_name()
pixel_x = rand(-8, 8)
/obj/structure/headpike/Destroy()
QDEL_NULL(victim)
QDEL_NULL(spear)
return ..()
/obj/structure/headpike/on_craft_completion(list/components, datum/crafting_recipe/current_recipe, atom/crafter)
. = ..()
victim = locate() in contents
spear = locate(speartype) in contents
update_appearance()
/obj/structure/headpike/update_name()
name = "[victim.get_face_name()] on a [spear.name]"
return ..()
/obj/structure/headpike/update_overlays()
. = ..()
if(!victim)
return
var/mutable_appearance/appearance = new()
appearance.copy_overlays(victim)
appearance.pixel_z = 12
appearance.layer = layer + 0.1
. += appearance
/obj/structure/headpike/Exited(atom/movable/gone, direction)
. = ..()
if(gone != victim && gone != spear)
return
if(gone == victim)
victim = null
if(gone == spear)
spear = null
if(!QDELETED(src))
deconstruct(TRUE)
/obj/structure/headpike/atom_deconstruct(disassembled)
var/obj/item/bodypart/head/our_head = victim
var/obj/item/spear/our_spear = spear
victim = null
spear = null
our_head?.forceMove(drop_location()) //Make sure the head always comes off
if(!disassembled)
return ..()
our_spear?.forceMove(drop_location())
/obj/structure/headpike/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
return
to_chat(user, span_notice("You take down [src]."))
deconstruct(TRUE)