This has to do with the code actually using the INDEX value 1 - size to select the slot for the ability to go in, binding the ability AND changing the icon state.
Been trying to ween the code off using index but i've run into a stump which I cant solve with my current understanding of DM.
What im trying to do is change the code to work with any keyboard key and it would be really cool if anyone could take a look at the code below and let me know how to safely remove the brain aka, index. So I can shove in the new era of "lots of keys"
I can paste more code if needed.
Code:
proc
set_index(i)
if(i < 1) i = 1
if(i > size) i = size
index = i
cursor.pos(index * Constants.ICON_WIDTH - Constants.ICON_WIDTH, 0)
refresh()
for(var/i = 1 to size)
var/HudObject/o = objects[i]
var/Ability/a = owner.key_bindings ? owner.key_bindings["[i]"] : null
if(!a)
o.icon = Constants.HUD_ICON
o.icon_state = "ability-button"
continue
o.icon = a.icon
o.icon_state = a.icon_state
Thanks in advance!