BST Hard Dels (#22212)

Another PR for Bluespace Techs, this time swapping them to hold a
weakref to their original mob. There's a ton of code in BSTs that can
create race conditions with all their associated Destroy() procs, so
swapping them to weakref methods should significantly cut down on that.
This commit is contained in:
VMSolidus
2026-04-12 22:19:35 +00:00
committed by GitHub
parent 1a1a875bdb
commit c5a8107322
3 changed files with 15 additions and 7 deletions
+10 -7
View File
@@ -41,7 +41,7 @@
var/T = get_turf(usr)
var/mob/living/carbon/human/bst/bst = new(T)
if(istype(mob, /mob/living))
bst.original_mob = mob
bst.original_mob = WEAKREF(mob)
bst.anchored = 1
bst.ckey = usr.ckey
@@ -138,7 +138,7 @@
status_flags = GODMODE|NOFALL
/// The BST's original mob. Moved here from /datum/holder to support storytellers.
var/mob/original_mob
var/datum/weakref/original_mob
/mob/living/carbon/human/bst/Destroy(force)
original_mob = null
@@ -174,8 +174,10 @@
QDEL_IN(src, 10)
animate(src, alpha = 0, time = 9, easing = QUAD_EASING)
if(key)
if(original_mob)
client.key = key
var/mob/living/origin = original_mob?.resolve()
if(origin)
origin.key = key
original_mob = null
client.init_verbs()
else
var/mob/abstract/ghost/observer/ghost = new(src, src) //Transfer safety to observer spawning proc.
@@ -326,12 +328,13 @@
set desc = "Jump into bluespace and continue wherever you left off. Deletes the BSTech and returns to your original mob if you have one."
set category = "BST"
if(original_mob)
if(original_mob.key)//Thanks for kicking Tish off the Server Meow, wouldn't have spotted this otherwise.
var/mob/living/origin = original_mob?.resolve()
if(origin)
if(origin.key)//Thanks for kicking Tish off the Server Meow, wouldn't have spotted this otherwise.
//suicide()
return
original_mob.key = key
origin.key = key
original_mob = null
suicide()