Harddel Fix Pack #42 + Better Live Reftracking Support (#63877)

* Hard Del Fixes, Ref Tracking Changes
This commit is contained in:
LemonInTheDark
2022-01-12 22:46:13 +01:00
committed by GitHub
parent f3f7720d7e
commit f8aad14ae8
109 changed files with 865 additions and 733 deletions
+11 -10
View File
@@ -83,7 +83,8 @@
include_user = TRUE
range = -1
clothes_req = FALSE
var/obj/item/item
///List of weakrefs to items summoned
var/list/datum/weakref/item_refs = list()
var/item_type = /obj/item/banhammer
school = SCHOOL_CONJURATION
charge_max = 150
@@ -91,18 +92,18 @@
var/delete_old = TRUE //TRUE to delete the last summoned object if it's still there, FALSE for infinite item stream weeeee
/obj/effect/proc_holder/spell/targeted/conjure_item/cast(list/targets, mob/user = usr)
if (delete_old && item && !QDELETED(item))
QDEL_NULL(item)
else
for(var/mob/living/carbon/C in targets)
if(C.dropItemToGround(C.get_active_held_item()))
C.put_in_hands(make_item(), TRUE)
if (delete_old && length(item_refs))
QDEL_LIST(item_refs)
return
for(var/mob/living/carbon/C in targets)
if(C.dropItemToGround(C.get_active_held_item()))
C.put_in_hands(make_item(), TRUE)
/obj/effect/proc_holder/spell/targeted/conjure_item/Destroy()
if(item)
qdel(item)
QDEL_LIST(item_refs)
return ..()
/obj/effect/proc_holder/spell/targeted/conjure_item/proc/make_item()
item = new item_type
var/obj/item/item = new item_type
item_refs += WEAKREF(item)
return item
@@ -7,19 +7,22 @@
include_user = TRUE
action_icon_state = "telepathy"
action_background_icon_state = "bg_spell"
var/datum/brain_trauma/severe/split_personality/trauma
// Bidaly reminder that spells are not really "owned" by anyone
/// Weakref to the trauma that owns this spell
var/datum/weakref/trauma_ref
var/flufftext = "You hear an echoing voice in the back of your head..."
/obj/effect/proc_holder/spell/targeted/personality_commune/New(datum/brain_trauma/severe/split_personality/T)
. = ..()
trauma = T
trauma_ref = WEAKREF(T)
/obj/effect/proc_holder/spell/targeted/personality_commune/Destroy()
trauma = null
trauma_ref = null
return ..()
// Pillaged and adapted from telepathy code
/obj/effect/proc_holder/spell/targeted/personality_commune/cast(list/targets, mob/user)
var/datum/brain_trauma/severe/split_personality/trauma = trauma_ref?.resolve()
if(!istype(trauma))
to_chat(user, span_warning("Something is wrong; Either due a bug or admemes, you are trying to cast this spell without a split personality!"))
return