mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 20:47:10 +01:00
refactor action buttons (#29416)
* refactor action buttons * fix cult spell charge overlay * lewc review * update for a/mhelp buttons and xenobio organs * update for minebot * properly create button each time * directly add/remove unavail overlay for reasons * lewc review
This commit is contained in:
@@ -15,7 +15,7 @@ Updates the spell's actions on use as well, so they know when they can or can't
|
||||
vessel.stored_plasma = clamp(vessel.stored_plasma + amount, 0, vessel.max_plasma)
|
||||
update_plasma_display(src)
|
||||
for(var/datum/action/spell_action/action in actions)
|
||||
action.UpdateButtons()
|
||||
action.build_all_button_icons()
|
||||
|
||||
/datum/spell/alien_spell
|
||||
action_background_icon_state = "bg_alien"
|
||||
@@ -35,7 +35,7 @@ Updates the spell's actions on use as well, so they know when they can or can't
|
||||
name = "[name] ([plasma_cost])"
|
||||
action.name = name
|
||||
action.desc = desc
|
||||
action.UpdateButtons()
|
||||
action.build_all_button_icons()
|
||||
|
||||
/datum/spell/alien_spell/write_custom_logs(list/targets, mob/user)
|
||||
user.create_log(ATTACK_LOG, "Cast the spell [name]")
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
/datum/spell/alien_spell/neurotoxin/update_spell_icon()
|
||||
if(!action)
|
||||
return
|
||||
action.button_overlay_icon_state = "alien_neurotoxin_[active]"
|
||||
action.UpdateButtons()
|
||||
action.button_icon_state = "alien_neurotoxin_[active]"
|
||||
action.build_all_button_icons()
|
||||
|
||||
/datum/spell/alien_spell/neurotoxin/cast(list/targets, mob/living/carbon/user)
|
||||
var/target = targets[1]
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
if(action)
|
||||
action.name = name
|
||||
action.desc = desc
|
||||
UpdateButtons()
|
||||
build_all_button_icons()
|
||||
|
||||
target.name = "ensouled [target.name]"
|
||||
target.desc += "<br><span class='warning'>A terrible aura surrounds this item, its very existence is offensive to life itself...</span>"
|
||||
|
||||
@@ -212,7 +212,7 @@ GLOBAL_LIST_INIT(spells, typesof(/datum/spell))
|
||||
custom_handler?.spend_spell_cost(user, src)
|
||||
|
||||
if(action)
|
||||
action.UpdateButtons()
|
||||
action.build_all_button_icons()
|
||||
|
||||
/datum/spell/proc/invocation(mob/user) //spelling the spell out and setting it on recharge/reducing charges amount
|
||||
switch(invocation_type)
|
||||
@@ -350,7 +350,7 @@ GLOBAL_LIST_INIT(spells, typesof(/datum/spell))
|
||||
cast(targets, user = user)
|
||||
after_cast(targets, user)
|
||||
if(action)
|
||||
action.UpdateButtons()
|
||||
action.build_all_button_icons()
|
||||
|
||||
/**
|
||||
* Will write additional logs if create_custom_logs is TRUE and the caster has a ckey. Override this
|
||||
@@ -421,11 +421,11 @@ GLOBAL_LIST_INIT(spells, typesof(/datum/spell))
|
||||
custom_handler?.revert_cast(user, src)
|
||||
|
||||
if(action)
|
||||
action.UpdateButtons()
|
||||
action.build_all_button_icons()
|
||||
|
||||
/datum/spell/proc/UpdateButtons()
|
||||
/datum/spell/proc/build_all_button_icons()
|
||||
if(action)
|
||||
action.UpdateButtons()
|
||||
action.build_all_button_icons()
|
||||
|
||||
/datum/spell/proc/adjust_var(mob/living/target = usr, type, amount) //handles the adjustment of the var when the spell is used. has some hardcoded types
|
||||
switch(type)
|
||||
|
||||
@@ -340,8 +340,8 @@
|
||||
/datum/spell/fireball/update_spell_icon()
|
||||
if(!action)
|
||||
return
|
||||
action.button_overlay_icon_state = "fireball[active]"
|
||||
action.UpdateButtons()
|
||||
action.button_icon_state = "fireball[active]"
|
||||
action.build_all_button_icons()
|
||||
|
||||
/datum/spell/fireball/cast(list/targets, mob/living/user = usr)
|
||||
var/target = targets[1] //There is only ever one target for fireball
|
||||
|
||||
Reference in New Issue
Block a user