Removes code treating actions as a lazy list (#24971)

* this doesn't need to be lazy

* fix some small things
This commit is contained in:
Luc
2024-04-03 10:08:26 -04:00
committed by GitHub
parent 629522d2c7
commit 655d170ae2
3 changed files with 6 additions and 11 deletions
+1 -1
View File
@@ -57,7 +57,7 @@
row_offset = clamp(row_offset, 0, total_rows) // You're not allowed to offset so far that we have a row of blank space
var/button_number = 0
for(var/atom/movable/screen/button as anything in actions)
for(var/atom/movable/screen/button in actions)
var/postion = ButtonNumberToScreenCoords(button_number)
button.screen_loc = postion
button_number++
+4 -4
View File
@@ -54,7 +54,7 @@
continue
HideFrom(hud.mymob)
LAZYREMOVE(remove_from?.actions, src) // We aren't always properly inserted into the viewers list, gotta make sure that action's cleared
remove_from?.actions -= src // We aren't always properly inserted into the viewers list, gotta make sure that action's cleared
viewers = list()
// owner = null
@@ -142,7 +142,7 @@
var/datum/hud/our_hud = viewer.hud_used
if(viewers[our_hud]) // Already have a copy of us? go away
return
LAZYOR(viewer.actions, src) // Move this in
viewer.actions |= src // Move this in
ShowTo(viewer)
//Adds our action button to the screen of a player
@@ -168,7 +168,7 @@
/datum/action/proc/HideFrom(mob/viewer)
var/datum/hud/our_hud = viewer.hud_used
var/atom/movable/screen/movable/action_button/button = viewers[our_hud]
LAZYREMOVE(viewer.actions, src)
viewer.actions -= src
if(button)
button.clean_up_keybinds(viewer)
qdel(button)
@@ -193,7 +193,7 @@
if(action == src) // This could be us, which is dumb
continue
var/atom/movable/screen/movable/action_button/button = action.viewers[owner.hud_used]
if(action.name == name && button.id)
if(action.name == name && button?.id)
bitfield |= button.id
bitfield = ~bitfield // Flip our possible ids, so we can check if we've found a unique one
+1 -6
View File
@@ -179,12 +179,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
if(ismob(loc))
var/mob/m = loc
m.unEquip(src, 1)
// actions clear themselves from the list on cut
if(islist(actions))
for(var/datum/action/A as anything in actions)
qdel(A)
if(!isnull(actions))
actions.Cut()
QDEL_LIST_CONTENTS(actions)
master = null
return ..()