[MIRROR] Fixes initial floating action buttons failing to properly position [MDB IGNORE] (#13698)

* Fixes initial floating action buttons failing to properly position (#67068)

Also cleans up artificer stuff a bit, their rune button should align
with their spells.

Basically, when we grant someone a button, it gets positioned in its
default location. If the button's floating, their location var becomes
an invalid arg to position_action. Then we called position action with
their location var.

Big fucky.

I've cleaned up the logic a bit, and ensured that you can never position
to FLOATING directly, since it's a marker rather then a real position on
the screen

* Fixes initial floating action buttons failing to properly position

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-05-18 21:00:29 +02:00
committed by GitHub
parent 60f584fad8
commit f293336aaf
2 changed files with 9 additions and 2 deletions

View File

@@ -400,6 +400,11 @@ GLOBAL_LIST_INIT(available_erp_ui_styles, list(
return
/datum/hud/proc/position_action(atom/movable/screen/movable/action_button/button, position)
// This is kinda a hack, I'm sorry.
// Basically, FLOATING is never a valid position to pass into this proc. It exists as a generic marker for manually positioned buttons
// Not as a position to target
if(position == SCRN_OBJ_FLOATING)
return
if(button.location != SCRN_OBJ_DEFAULT)
hide_action(button)
switch(position)
@@ -488,8 +493,8 @@ GLOBAL_LIST_INIT(available_erp_ui_styles, list(
var/atom/movable/screen/movable/action_button/button = action.viewers[src]
if(!button)
action.ShowTo(mymob)
button = action.viewers[src]
position_action(button, button.location)
else
position_action(button, button.location)
/datum/action_group
/// The hud we're owned by

View File

@@ -63,6 +63,8 @@
spellnum++
if(runetype)
var/pos = 2+spellnum*31
if(construct_spells.len >= 4)
pos -= 31*(construct_spells.len - 4)
our_rune = new runetype(src)
our_rune.default_button_position = "6:[pos],4:-2" // Set the default position to this random position
our_rune.Grant(src)