mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 04:28:12 +01:00
Converts screen hardref to a weakref (#19443)
* Weakrefs the master object * whoops
This commit is contained in:
@@ -17,8 +17,9 @@
|
||||
var/atom/movable/screen/alert/alert
|
||||
if(LAZYACCESS(alerts, category))
|
||||
alert = alerts[category]
|
||||
if(new_master && new_master != alert.master)
|
||||
WARNING("[src] threw alert [category] with new_master [new_master] while already having that alert with master [alert.master]")
|
||||
var/obj/master = alert.master_ref?.resolve()
|
||||
if(new_master && new_master != master)
|
||||
WARNING("[src] threw alert [category] with new_master [new_master] while already having that alert with master [master]")
|
||||
clear_alert(category)
|
||||
return .()
|
||||
else if(alert.type != type)
|
||||
@@ -39,7 +40,7 @@
|
||||
I.plane = PLANE_PLAYER_HUD_ABOVE
|
||||
I.color = new_master.color
|
||||
alert.add_overlay(I)
|
||||
alert.master = new_master
|
||||
alert.master_ref = WEAKREF(new_master)
|
||||
else
|
||||
alert.icon_state = "[initial(alert.icon_state)][severity]"
|
||||
alert.severity = severity
|
||||
@@ -506,6 +507,7 @@ so as to remain in compliance with the most up-to-date laws."
|
||||
if(paramslist["shift"]) // screen objects don't do the normal Click() stuff so we'll cheat
|
||||
to_chat(usr,span_boldnotice(name) + " - " + span_info(desc))
|
||||
return
|
||||
var/obj/master = master_ref?.resolve()
|
||||
if(master)
|
||||
return usr.client.Click(master, location, control, params)
|
||||
..() // VOREStation Edit: Pass through to click_vr
|
||||
@@ -513,6 +515,6 @@ so as to remain in compliance with the most up-to-date laws."
|
||||
/atom/movable/screen/alert/Destroy()
|
||||
..()
|
||||
severity = 0
|
||||
master = null
|
||||
master_ref = null
|
||||
screen_loc = ""
|
||||
return QDEL_HINT_QUEUE
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/atom/movable/screen/gun
|
||||
name = "gun"
|
||||
icon = 'icons/mob/screen1.dmi'
|
||||
master = null
|
||||
master_ref = null
|
||||
dir = 2
|
||||
|
||||
/atom/movable/screen/gun/Click(location, control, params)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
screenobjs += new /atom/movable/screen/rig/deco2_f
|
||||
|
||||
for(var/atom/movable/screen/S as anything in screenobjs)
|
||||
S.master = owner_rig
|
||||
S.master_ref = WEAKREF(owner_rig)
|
||||
..()
|
||||
|
||||
/datum/mini_hud/rig/Destroy()
|
||||
@@ -71,7 +71,7 @@
|
||||
screenobjs += new /atom/movable/screen/mech/deco2_f
|
||||
|
||||
for(var/atom/movable/screen/S as anything in screenobjs)
|
||||
S.master = owner_mech
|
||||
S.master_ref = WEAKREF(owner_mech)
|
||||
..()
|
||||
|
||||
/datum/mini_hud/mech/Destroy()
|
||||
@@ -146,7 +146,7 @@
|
||||
var/mob/living/carbon/human/user = usr
|
||||
if(!istype(user) || user.stat || user.incapacitated())
|
||||
return
|
||||
var/obj/item/rig/owner_rig = master
|
||||
var/obj/item/rig/owner_rig = master_ref?.resolve()
|
||||
if(user != owner_rig.wearer)
|
||||
return
|
||||
user.toggle_internals()
|
||||
@@ -198,7 +198,7 @@
|
||||
var/mob/living/carbon/human/user = usr
|
||||
if(!istype(user) || user.stat || user.incapacitated())
|
||||
return
|
||||
var/obj/mecha/owner_mech = master
|
||||
var/obj/mecha/owner_mech = master_ref?.resolve()
|
||||
if(user != owner_mech.occupant)
|
||||
return
|
||||
owner_mech.toggle_internal_tank()
|
||||
|
||||
@@ -12,11 +12,15 @@
|
||||
appearance_flags = TILE_BOUND|PIXEL_SCALE|NO_CLIENT_COLOR
|
||||
layer = LAYER_HUD_BASE
|
||||
plane = PLANE_PLAYER_HUD
|
||||
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
|
||||
/// A reference to the object in the slot. Grabs or items, generally, but any datum will do.
|
||||
var/datum/weakref/master_ref = null
|
||||
/// A reference to the owner HUD, if any.
|
||||
//VAR_PRIVATE/datum/hud/hud = null //This SHOULD be converted to private eventually, but we're not there yet.
|
||||
var/datum/hud/hud = null // A reference to the owner HUD, if any.
|
||||
|
||||
/atom/movable/screen/Destroy()
|
||||
master = null
|
||||
master_ref = null
|
||||
hud = null
|
||||
return ..()
|
||||
|
||||
/atom/movable/screen/proc/component_click(atom/movable/screen/component_button/component, params)
|
||||
@@ -67,6 +71,7 @@
|
||||
name = "close"
|
||||
|
||||
/atom/movable/screen/close/Click()
|
||||
var/obj/master = master_ref?.resolve()
|
||||
if(master)
|
||||
if(istype(master, /obj/item/storage))
|
||||
var/obj/item/storage/S = master
|
||||
@@ -100,6 +105,7 @@
|
||||
name = "grab"
|
||||
|
||||
/atom/movable/screen/grab/Click()
|
||||
var/obj/master = master_ref?.resolve()
|
||||
var/obj/item/grab/G = master
|
||||
G.s_click(src)
|
||||
return 1
|
||||
@@ -121,6 +127,7 @@
|
||||
return 1
|
||||
if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech
|
||||
return 1
|
||||
var/obj/master = master_ref?.resolve()
|
||||
if(master)
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(I)
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
icon_state = "leash_master"
|
||||
|
||||
/atom/movable/screen/alert/leash_dom/Click()
|
||||
var/obj/item/leash/owner = master
|
||||
owner.unleash()
|
||||
var/obj/item/leash/owner = master_ref?.resolve()
|
||||
if(owner)
|
||||
owner.unleash()
|
||||
|
||||
/atom/movable/screen/alert/leash_pet
|
||||
name = "Leashed"
|
||||
@@ -13,8 +14,9 @@
|
||||
icon_state = "leash_pet"
|
||||
|
||||
/atom/movable/screen/alert/leash_dom/Click()
|
||||
var/obj/item/leash/owner = master
|
||||
owner.struggle_leash()
|
||||
var/obj/item/leash/owner = master_ref?.resolve()
|
||||
if(owner)
|
||||
owner.struggle_leash()
|
||||
|
||||
///// OBJECT /////
|
||||
//The leash object itself
|
||||
|
||||
@@ -70,30 +70,30 @@
|
||||
if(storage_slots)
|
||||
src.boxes = new /atom/movable/screen/storage( )
|
||||
src.boxes.name = "storage"
|
||||
src.boxes.master = src
|
||||
src.boxes.master_ref = WEAKREF(src)
|
||||
src.boxes.icon_state = "block"
|
||||
src.boxes.screen_loc = "7,7 to 10,8"
|
||||
else
|
||||
src.storage_start = new /atom/movable/screen/storage( )
|
||||
src.storage_start.name = "storage"
|
||||
src.storage_start.master = src
|
||||
src.storage_start.master_ref = WEAKREF(src)
|
||||
src.storage_start.icon_state = "storage_start"
|
||||
src.storage_start.screen_loc = "7,7 to 10,8"
|
||||
|
||||
src.storage_continue = new /atom/movable/screen/storage( )
|
||||
src.storage_continue.name = "storage"
|
||||
src.storage_continue.master = src
|
||||
src.storage_continue.master_ref = WEAKREF(src)
|
||||
src.storage_continue.icon_state = "storage_continue"
|
||||
src.storage_continue.screen_loc = "7,7 to 10,8"
|
||||
|
||||
src.storage_end = new /atom/movable/screen/storage( )
|
||||
src.storage_end.name = "storage"
|
||||
src.storage_end.master = src
|
||||
src.storage_end.master_ref = WEAKREF(src)
|
||||
src.storage_end.icon_state = "storage_end"
|
||||
src.storage_end.screen_loc = "7,7 to 10,8"
|
||||
|
||||
src.closer = new /atom/movable/screen/close( )
|
||||
src.closer.master = src
|
||||
src.closer.master_ref = WEAKREF(src)
|
||||
src.closer.icon_state = "storage_close"
|
||||
src.closer.hud_layerise()
|
||||
orient2hud()
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
hud.icon_state = "reinforce"
|
||||
icon_state = "grabbed"
|
||||
hud.name = "reinforce grab"
|
||||
hud.master = src
|
||||
hud.master_ref = WEAKREF(src)
|
||||
|
||||
//check if assailant is grabbed by victim as well
|
||||
if(assailant.grabbed_by)
|
||||
|
||||
@@ -653,8 +653,9 @@
|
||||
|
||||
else if(alerts && alerts["leashed"])
|
||||
var/atom/movable/screen/alert/leash_pet/pet_alert = src.alerts["leashed"]
|
||||
var/obj/item/leash/owner = pet_alert.master
|
||||
owner.clear_leash()
|
||||
var/obj/item/leash/owner = pet_alert.master_ref?.resolve()
|
||||
if(owner)
|
||||
owner.clear_leash()
|
||||
log_and_message_admins("used the OOC escape button to get out of a leash.", src)
|
||||
|
||||
//Don't appear to be in a vore situation
|
||||
|
||||
Reference in New Issue
Block a user