mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
fixes a big harddel source (#83987)
## About The Pull Request this hard delete would happen everytime a player joins/observers the round. upon using the ref tracker i discovered this problem was caused by movable/screens not cleaning up after their owning huds if it gets deleted. i didnt weakref it was cause it meant id have to resolve it in so many places, but if weakrefing is preferable i will do it  ## Why It's Good For The Game fixes a hard delete
This commit is contained in:
@@ -63,8 +63,7 @@
|
||||
|
||||
///Set the HUD in New, as lobby screens are made before Atoms are Initialized.
|
||||
/atom/movable/screen/lobby/New(loc, datum/hud/our_hud, ...)
|
||||
if(our_hud)
|
||||
hud = our_hud
|
||||
set_new_hud(our_hud)
|
||||
return ..()
|
||||
|
||||
///Run sleeping actions after initialize
|
||||
|
||||
@@ -275,7 +275,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/parallax_layer)
|
||||
. = ..()
|
||||
// Parallax layers are independant of hud, they care about client
|
||||
// Not doing this will just create a bunch of hard deletes
|
||||
hud = null
|
||||
set_new_hud(hud_owner = null)
|
||||
|
||||
if(template)
|
||||
return
|
||||
|
||||
@@ -45,8 +45,9 @@
|
||||
|
||||
/atom/movable/screen/Initialize(mapload, datum/hud/hud_owner)
|
||||
. = ..()
|
||||
if(hud_owner && istype(hud_owner))
|
||||
hud = hud_owner
|
||||
if(isnull(hud_owner)) //some screens set their hud owners on /new, this prevents overriding them with null post atoms init
|
||||
return
|
||||
set_new_hud(hud_owner)
|
||||
|
||||
/atom/movable/screen/Destroy()
|
||||
master_ref = null
|
||||
@@ -72,10 +73,25 @@
|
||||
/atom/movable/screen/proc/component_click(atom/movable/screen/component_button/component, params)
|
||||
return
|
||||
|
||||
///setter used to set our new hud
|
||||
/atom/movable/screen/proc/set_new_hud(datum/hud/hud_owner)
|
||||
if(hud)
|
||||
UnregisterSignal(hud, COMSIG_QDELETING)
|
||||
if(isnull(hud_owner))
|
||||
hud = null
|
||||
return
|
||||
hud = hud_owner
|
||||
RegisterSignal(hud, COMSIG_QDELETING, PROC_REF(on_hud_delete))
|
||||
|
||||
/// Returns the mob this is being displayed to, if any
|
||||
/atom/movable/screen/proc/get_mob()
|
||||
return hud?.mymob
|
||||
|
||||
/atom/movable/screen/proc/on_hud_delete(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
set_new_hud(hud_owner = null)
|
||||
|
||||
/atom/movable/screen/text
|
||||
icon = null
|
||||
icon_state = null
|
||||
|
||||
Reference in New Issue
Block a user