mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 00:27:31 +01:00
Fix hard dels with rune knives and their creations (#55711)
Rune knives held hard references to the runes they created, which were not cleaned when the rune was eventually deleted. These have been replaced with weakrefs.
This commit is contained in:
@@ -319,6 +319,10 @@
|
||||
. = ..()
|
||||
linked_action = new(src)
|
||||
|
||||
/obj/item/melee/rune_knife/Destroy()
|
||||
. = ..()
|
||||
QDEL_NULL(linked_action)
|
||||
|
||||
/obj/item/melee/rune_knife/pickup(mob/user)
|
||||
. = ..()
|
||||
linked_action.Grant(user, src)
|
||||
@@ -339,10 +343,10 @@
|
||||
to_chat(user,"<span class='notice'>You can't draw runes that close to each other!</span>")
|
||||
return
|
||||
|
||||
for(var/X in current_runes)
|
||||
var/obj/structure/trap/eldritch/eldritch = X
|
||||
if(QDELETED(eldritch) || !eldritch)
|
||||
current_runes -= eldritch
|
||||
for(var/_rune_ref in current_runes)
|
||||
var/datum/weakref/rune_ref = _rune_ref
|
||||
if(!rune_ref.resolve())
|
||||
current_runes -= rune_ref
|
||||
|
||||
if(current_runes.len >= max_rune_amt)
|
||||
to_chat(user,"<span class='notice'>The blade cannot support more runes!</span>")
|
||||
@@ -369,7 +373,7 @@
|
||||
drawing = FALSE
|
||||
var/obj/structure/trap/eldritch/eldritch = new type(target)
|
||||
eldritch.set_owner(user)
|
||||
current_runes += eldritch
|
||||
current_runes += WEAKREF(eldritch)
|
||||
|
||||
/datum/action/innate/rune_shatter
|
||||
name = "Rune break"
|
||||
@@ -386,10 +390,10 @@
|
||||
return ..()
|
||||
|
||||
/datum/action/innate/rune_shatter/Activate()
|
||||
for(var/X in sword.current_runes)
|
||||
var/obj/structure/trap/eldritch/eldritch = X
|
||||
if(!QDELETED(eldritch) && eldritch)
|
||||
qdel(eldritch)
|
||||
for(var/_rune_ref in sword.current_runes)
|
||||
var/datum/weakref/rune_ref = _rune_ref
|
||||
qdel(rune_ref.resolve())
|
||||
sword.current_runes.Cut()
|
||||
|
||||
/obj/item/eldritch_potion
|
||||
name = "Brew of Day and Night"
|
||||
|
||||
@@ -111,14 +111,14 @@
|
||||
desc = "Collection of unknown symbols, they remind you of days long gone..."
|
||||
icon = 'icons/obj/eldritch.dmi'
|
||||
charges = 1
|
||||
///Owner of the trap
|
||||
var/mob/owner
|
||||
/// Weakref containing the owner of the trap
|
||||
var/datum/weakref/owner
|
||||
|
||||
/obj/structure/trap/eldritch/Crossed(atom/movable/AM)
|
||||
if(!isliving(AM))
|
||||
return ..()
|
||||
var/mob/living/living_mob = AM
|
||||
if((owner && living_mob == owner) || IS_HERETIC(living_mob) || IS_HERETIC_MONSTER(living_mob))
|
||||
if(living_mob == owner?.resolve() || IS_HERETIC(living_mob) || IS_HERETIC_MONSTER(living_mob))
|
||||
return
|
||||
return ..()
|
||||
|
||||
@@ -128,8 +128,8 @@
|
||||
qdel(src)
|
||||
|
||||
///Proc that sets the owner
|
||||
/obj/structure/trap/eldritch/proc/set_owner(mob/_owner)
|
||||
owner = _owner
|
||||
/obj/structure/trap/eldritch/proc/set_owner(mob/owner)
|
||||
src.owner = WEAKREF(owner)
|
||||
|
||||
/obj/structure/trap/eldritch/alert
|
||||
name = "alert carving"
|
||||
|
||||
Reference in New Issue
Block a user