diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm
index d4d2c2d8a5..cd24e68cbb 100644
--- a/code/_onclick/hud/action_button.dm
+++ b/code/_onclick/hud/action_button.dm
@@ -8,15 +8,22 @@
var/button_icon_state
var/appearance_cache
+ var/id
+
/obj/screen/movable/action_button/Click(location,control,params)
var/list/modifiers = params2list(params)
if(modifiers["shift"])
+ if(locked)
+ to_chat(usr, "Action button \"[name]\" is locked, unlock it first.")
+ return TRUE
moved = 0
usr.update_action_buttons() //redraw buttons that are no longer considered "moved"
return TRUE
if(modifiers["ctrl"])
locked = !locked
to_chat(usr, "Action button \"[name]\" [locked ? "" : "un"]locked.")
+ if(id && usr.client) //try to (un)remember position
+ usr.client.prefs.action_buttons_screen_locs["[name]_[id]"] = locked ? moved : null
return TRUE
if(usr.next_click > world.time)
return
@@ -38,21 +45,30 @@
/obj/screen/movable/action_button/hide_toggle/Click(location,control,params)
var/list/modifiers = params2list(params)
if(modifiers["shift"])
+ if(locked)
+ to_chat(usr, "Action button \"[name]\" is locked, unlock it first.")
+ return TRUE
moved = FALSE
usr.update_action_buttons(TRUE)
return TRUE
if(modifiers["ctrl"])
locked = !locked
to_chat(usr, "Action button \"[name]\" [locked ? "" : "un"]locked.")
+ if(id && usr.client) //try to (un)remember position
+ usr.client.prefs.action_buttons_screen_locs["[name]_[id]"] = locked ? moved : null
return TRUE
if(modifiers["alt"])
for(var/V in usr.actions)
var/datum/action/A = V
var/obj/screen/movable/action_button/B = A.button
B.moved = FALSE
+ if(B.id && usr.client)
+ usr.client.prefs.action_buttons_screen_locs["[B.name]_[B.id]"] = null
B.locked = usr.client.prefs.buttons_locked
locked = usr.client.prefs.buttons_locked
moved = FALSE
+ if(id && usr.client)
+ usr.client.prefs.action_buttons_screen_locs["[name]_[id]"] = null
usr.update_action_buttons(TRUE)
to_chat(usr, "Action button positions have been reset.")
return TRUE
diff --git a/code/datums/action.dm b/code/datums/action.dm
index 721d67044d..f941a00a54 100644
--- a/code/datums/action.dm
+++ b/code/datums/action.dm
@@ -43,10 +43,27 @@
return
Remove(owner)
owner = M
+
+ //button id generation
+ var/counter = 0
+ var/bitfield = 0
+ for(var/datum/action/A in M.actions)
+ if(A.name == name && A.button.id)
+ counter += 1
+ bitfield |= A.button.id
+ bitfield = ~bitfield
+ var/bitflag = 1
+ for(var/i in 1 to (counter + 1))
+ if(bitfield & bitflag)
+ button.id = bitflag
+ break
+ bitflag *= 2
+
M.actions += src
if(M.client)
M.client.screen += button
- button.locked = M.client.prefs.buttons_locked
+ button.locked = M.client.prefs.buttons_locked || button.id ? M.client.prefs.action_buttons_screen_locs["[name]_[button.id]"] : FALSE //even if it's not defaultly locked we should remember we locked it before
+ button.moved = button.id ? M.client.prefs.action_buttons_screen_locs["[name]_[button.id]"] : FALSE
M.update_action_buttons()
else
Remove(owner)
@@ -60,6 +77,7 @@
owner = null
button.moved = FALSE //so the button appears in its normal position when given to another owner.
button.locked = FALSE
+ button.id = null
/datum/action/proc/Trigger()
if(!IsAvailable())
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 96942af46a..a28f15d8ea 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -178,8 +178,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/list/exp
var/list/menuoptions
+<<<<<<< HEAD
//citadel code
var/arousable = TRUE //Allows players to disable arousal from the character creation menu
+=======
+ var/action_buttons_screen_locs = list()
+>>>>>>> f07421a... Makes actionbuttons remember positions where you locked them. (#33150)
/datum/preferences/New(client/C)
parent = C