Files
Bubberstation/code/game/objects/structures/headpike.dm
SkyratBot 25d1a5e7a2 [MIRROR] Fixes a few hard deletes and runtimes I either caused, or ran into when trying to fix hard deletes [MDB IGNORE] (#8713)
* Fixes a few hard deletes and runtimes I either caused, or ran into when trying to fix hard deletes (#61953)

Please don't try and send chat messages if you have nothing to say
Fixes a spurious runtime.
Fixes a runtime caused by my lack of understanding of huds. remove_hud_from is intended for hud watchers, remove_from_hud is intended for hud items. Doesn't really make sense most of the time, and just runtimes out the ass
Fixes a runtime in shapeshifting, restore should not run if the object is not restoring, or if it's deleting. it should run if it's not restoring, and it's not deleted. 4head
Fun fact, if there's two turret control boards they'll override each other. Use weakrefs. Oh also removes a var called cp, nothing good will come of that
Today in: Good lord the stacking machine is an afront to god, we discover that the labor claims console was attempting to act as a console, which of course fails when it comes time to clear it's improperly named var. Disgusting
Attempts to fix potential wound ref hangs in surgeries? maybe?
Fixes a runtime in luminescent stuff I created in my big harddel crusade. owner is a mob, not a species
Fixes a runtime related to headspikes deleting themselves twice. Pain
Fixes hard deletes sourced from the prophet trauma. Good fucking lord this is awful
Offhand item is somehow hard deleting. I have no idea how. Here's hoping signals fixes it, because if it doesn't I'm stumped. It's not a common scenario, but it does happen in spurts that suggest repeated usage

* Fixes a few hard deletes and runtimes I either caused, or ran into when trying to fix hard deletes

* Update turret_id_system.dm

* Update turret_id_system.dm

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-10-13 19:23:32 +01:00

78 lines
1.8 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
var/bonespear = FALSE
var/obj/item/spear/spear
var/obj/item/bodypart/head/victim
/obj/structure/headpike/bone //for bone spears
icon_state = "headpike-bone"
bonespear = TRUE
/obj/structure/headpike/Initialize(mapload)
. = ..()
if(mapload)
CheckParts()
pixel_x = rand(-8, 8)
/obj/structure/headpike/Destroy()
QDEL_NULL(victim)
QDEL_NULL(spear)
return ..()
/obj/structure/headpike/CheckParts(list/parts_list)
victim = locate() in parts_list
if(!victim) //likely a mapspawned one
victim = new(src)
victim.real_name = random_unique_name(prob(50))
spear = locate(bonespear ? /obj/item/spear/bonespear : /obj/item/spear) in parts_list
if(!spear)
spear = bonespear ? new/obj/item/spear/bonespear(src) : new/obj/item/spear(src)
update_appearance()
return ..()
/obj/structure/headpike/update_name()
name = "[victim.real_name] on a [spear]"
return ..()
/obj/structure/headpike/update_overlays()
. = ..()
if(!victim)
return
var/mutable_appearance/MA = new()
MA.copy_overlays(victim)
MA.pixel_y = 12
MA.pixel_x = pixel_x
. += victim
/obj/structure/headpike/handle_atom_del(atom/A)
if(A == victim)
victim = null
if(A == spear)
spear = null
if(!QDELETED(src))
deconstruct(TRUE)
return ..()
/obj/structure/headpike/deconstruct(disassembled)
if(!disassembled)
return ..()
if(victim)
victim.forceMove(drop_location())
victim = null
if(spear)
spear.forceMove(drop_location())
spear = null
return ..()
/obj/structure/headpike/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
return
to_chat(user, span_notice("You take down [src]."))
deconstruct(TRUE)