[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>
This commit is contained in:
SkyratBot
2021-10-13 19:23:32 +01:00
committed by GitHub
co-authored by LemonInTheDark Gandalf
parent 04bc788f7d
commit 25d1a5e7a2
11 changed files with 54 additions and 26 deletions
+1 -1
View File
@@ -41,7 +41,7 @@
//Called when removed from a mob
/datum/brain_trauma/proc/on_lose(silent)
if(!silent)
if(!silent && lose_text)
to_chat(owner, lose_text)
UnregisterSignal(owner, COMSIG_MOB_SAY)
UnregisterSignal(owner, COMSIG_MOVABLE_HEAR)
+7
View File
@@ -108,6 +108,13 @@
. = ..()
QDEL_IN(src, 300)
/obj/effect/hallucination/simple/bluespace_stream/Destroy()
if(!QDELETED(linked_to))
qdel(linked_to)
linked_to = null
seer = null
return ..()
//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/effect/hallucination/simple/bluespace_stream/attack_hand(mob/user, list/modifiers)
if(user != seer || !linked_to)
+8 -1
View File
@@ -108,8 +108,14 @@
if(wielded)
unwield(user)
if(source == offhand_item && !QDELETED(source))
offhand_item = null
qdel(source)
/// Triggered on destroy of the component's offhand
/datum/component/two_handed/proc/on_destroy(datum/source)
SIGNAL_HANDLER
offhand_item = null
/// Triggered on attack self of the item containing the component
/datum/component/two_handed/proc/on_attack_self(datum/source, mob/user)
SIGNAL_HANDLER
@@ -181,6 +187,7 @@
offhand_item.desc = "Your second grip on [parent_item]."
offhand_item.wielded = TRUE
RegisterSignal(offhand_item, COMSIG_ITEM_DROPPED, .proc/on_drop)
RegisterSignal(offhand_item, COMSIG_PARENT_QDELETING, .proc/on_destroy)
user.put_in_inactive_hand(offhand_item)
/**
@@ -245,7 +252,7 @@
// Remove the object in the offhand
if(offhand_item)
UnregisterSignal(offhand_item, COMSIG_ITEM_DROPPED)
UnregisterSignal(offhand_item, list(COMSIG_ITEM_DROPPED, COMSIG_PARENT_QDELETING))
qdel(offhand_item)
// Clear any old refrence to an item that should be gone now
offhand_item = null
-1
View File
@@ -100,7 +100,6 @@ GLOBAL_LIST_INIT(huds, list(
/datum/atom_hud/proc/unregister_mob(datum/source, force)
SIGNAL_HANDLER
remove_hud_from(source, TRUE)
remove_from_hud(source)
/datum/atom_hud/proc/hide_single_atomhud_from(hud_user,hidden_atom)
if(hudusers[hud_user])
@@ -93,8 +93,6 @@ DEFINE_BITFIELD(turret_flags, list(
var/list/faction = list("turret")
/// The spark system, used for generating... sparks?
var/datum/effect_system/spark_spread/spark_system
/// Linked turret control panel of the turret
var/obj/machinery/turretid/cp = null
/// The turret will try to shoot from a turf in that direction when in a wall
var/wall_turret_direction
/// If the turret is manually controlled
@@ -204,9 +202,6 @@ DEFINE_BITFIELD(turret_flags, list(
//deletes its own cover with it
QDEL_NULL(cover)
base = null
if(cp)
cp.turrets -= src
cp = null
QDEL_NULL(stored_gun)
QDEL_NULL(spark_system)
remove_control()
@@ -877,7 +872,7 @@ DEFINE_BITFIELD(turret_flags, list(
var/ailock = FALSE
/// Variable dictating if linked turrets will shoot cyborgs
var/shoot_cyborgs = FALSE
/// List of all linked turrets
/// List of weakrefs to all turrets
var/list/turrets = list()
/obj/machinery/turretid/Initialize(mapload, ndir = 0, built = 0)
@@ -907,9 +902,8 @@ DEFINE_BITFIELD(turret_flags, list(
control_area = get_area(src)
for(var/obj/machinery/porta_turret/T in control_area)
turrets |= T
T.cp = src
turrets |= WEAKREF(T)
/obj/machinery/turretid/examine(mob/user)
. += ..()
if(issilicon(user) && !(machine_stat & BROKEN))
@@ -925,7 +919,7 @@ DEFINE_BITFIELD(turret_flags, list(
return
var/obj/item/multitool/M = I
if(M.buffer && istype(M.buffer, /obj/machinery/porta_turret))
turrets |= M.buffer
turrets |= WEAKREF(M.buffer)
to_chat(user, span_notice("You link \the [M.buffer] with \the [src]."))
return
@@ -1014,8 +1008,12 @@ DEFINE_BITFIELD(turret_flags, list(
updateTurrets()
/obj/machinery/turretid/proc/updateTurrets()
for (var/obj/machinery/porta_turret/aTurret in turrets)
aTurret.setState(enabled, lethal, shoot_cyborgs)
for (var/datum/weakref/turret_ref in turrets)
var/obj/machinery/porta_turret/turret = turret_ref.resolve()
if(!turret)
turrets -= turret_ref
continue
turret.setState(enabled, lethal, shoot_cyborgs)
update_appearance()
/obj/machinery/turretid/update_icon_state()
+2 -1
View File
@@ -54,7 +54,8 @@
victim = null
if(A == spear)
spear = null
deconstruct(TRUE)
if(!QDELETED(src))
deconstruct(TRUE)
return ..()
/obj/structure/headpike/deconstruct(disassembled)
+10 -2
View File
@@ -36,7 +36,7 @@ GLOBAL_LIST(labor_sheet_values)
/obj/machinery/mineral/labor_claim_console/Destroy()
QDEL_NULL(Radio)
if(stacking_machine)
stacking_machine.console = null
stacking_machine.labor_console = null
stacking_machine = null
return ..()
@@ -125,7 +125,7 @@ GLOBAL_LIST(labor_sheet_values)
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
if(stacking_machine)
stacking_machine.console = src
stacking_machine.labor_console = src
/obj/machinery/mineral/labor_claim_console/emag_act(mob/user)
if(!(obj_flags & EMAGGED))
@@ -138,6 +138,14 @@ GLOBAL_LIST(labor_sheet_values)
force_connect = TRUE
var/points = 0 //The unclaimed value of ore stacked.
damage_deflection = 21
var/obj/machinery/mineral/labor_claim_console/labor_console //This is abhorent. I know.
/obj/machinery/mineral/stacking_machine/laborstacker/Destroy()
if(labor_console)
labor_console.stacking_machine = null
labor_console = null
return ..()
/obj/machinery/mineral/stacking_machine/laborstacker/process_sheet(obj/item/stack/sheet/inp)
points += inp.point_value * inp.amount
..()
@@ -563,8 +563,17 @@
/datum/action/innate/use_extract/ApplyIcon(atom/movable/screen/movable/action_button/current_button, force)
..(current_button, TRUE)
var/datum/species/jelly/luminescent/species = owner
if(species?.current_extract)
if(!ishuman(owner))
return
var/mob/living/carbon/human/gazer = owner
var/datum/species/jelly/luminescent/species = gazer?.dna?.species
if(!istype(species, /datum/species/jelly/luminescent))
return
if(species.current_extract)
current_button.add_overlay(mutable_appearance(species.current_extract.icon, species.current_extract.icon_state))
/datum/action/innate/use_extract/Activate()
@@ -173,7 +173,7 @@
/obj/shapeshift_holder/Moved()
. = ..()
if(!restoring || QDELETED(src))
if(!restoring && !QDELETED(src))
restore()
/obj/shapeshift_holder/handle_atom_del(atom/A)
+1
View File
@@ -38,6 +38,7 @@
/datum/surgery/Destroy()
if(operated_wound)
operated_wound.attached_surgery = null
operated_wound = null
if(target)
target.surgeries -= src
target = null
@@ -11,12 +11,11 @@ GLOBAL_LIST_EMPTY(turret_id_refs)
GLOB.turret_id_refs[system_id][src] = TRUE
/obj/machinery/porta_turret/Destroy()
. = ..()
if(system_id && GLOB.turret_id_refs[system_id])
GLOB.turret_id_refs[system_id] -= src
if(!length(GLOB.turret_id_refs[system_id]))
GLOB.turret_id_refs -= system_id
return ..()
/obj/machinery/turretid
var/system_id //The ID system for turrets, will get any turrets with the same ID and put them in controlled turrets
@@ -25,6 +24,5 @@ GLOBAL_LIST_EMPTY(turret_id_refs)
if(system_id && GLOB.turret_id_refs[system_id])
for(var/i in GLOB.turret_id_refs[system_id])
var/obj/machinery/porta_turret/T = i
turrets |= T
T.cp = src
turrets |= WEAKREF(T)