[MIRROR] Fixes cult spell buttons being stacked ontop of eachother. [MDB IGNORE] (#19828)

* Fixes cult spell buttons being stacked ontop of eachother. (#73914)

## About The Pull Request

The system for making sure spells didn't get stacked on top of each
other didn't account for spells being expended out of order (e.g. you
use all charges of your third spell but since you have 3 spells slot 4
must be open). I've changed the code to account for this.

Should fix: #66894
## Why It's Good For The Game

Really frustrating and annoying bug finally fixed.
## Changelog
🆑
fix: When learning new cult spells their buttons will no longer stack on
top of one another.
/🆑

* Fixes cult spell buttons being stacked ontop of eachother.

---------

Co-authored-by: NamelessFairy <40036527+NamelessFairy@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-13 16:20:36 -07:00
committed by GitHub
co-authored by NamelessFairy
parent 187d3452a7
commit 656951eee6
+7 -4
View File
@@ -21,17 +21,20 @@
var/our_view = hud.mymob?.client?.view || "15x15"
var/atom/movable/screen/movable/action_button/button = viewers[hud]
var/position = screen_loc_to_offset(button.screen_loc)
var/spells_iterated = 0
var/list/position_list = list()
for(var/possible_position in 1 to MAX_BLOODCHARGE)
position_list += possible_position
for(var/datum/action/innate/cult/blood_spell/blood_spell in spells)
spells_iterated += 1
if(blood_spell.positioned)
position_list.Remove(blood_spell.positioned)
continue
var/atom/movable/screen/movable/action_button/moving_button = blood_spell.viewers[hud]
if(!moving_button)
continue
var/our_x = position[1] + spells_iterated * world.icon_size // Offset any new buttons into our list
var/first_available_slot = position_list[1]
var/our_x = position[1] + first_available_slot * world.icon_size // Offset any new buttons into our list
hud.position_action(moving_button, offset_to_screen_loc(our_x, position[2], our_view))
blood_spell.positioned = TRUE
blood_spell.positioned = first_available_slot
/datum/action/innate/cult/blood_magic/Activate()
var/rune = FALSE