mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 11:05:03 +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:
committed by
GitHub
parent
f9016e65ff
commit
56f4960ed4
@@ -1,12 +1,11 @@
|
||||
/datum/action/item_action/mod
|
||||
button_overlay_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
button_overlay_icon_state = "bg_mod_border"
|
||||
button_background_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
button_background_icon_state = "bg_mod"
|
||||
button_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
button_icon_state = "bg_mod_border"
|
||||
background_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
background_icon_state = "bg_mod"
|
||||
check_flags = AB_CHECK_CONSCIOUS
|
||||
use_itemicon = FALSE
|
||||
|
||||
/datum/action/item_action/mod/New(Target, custom_icon, custom_icon_state)
|
||||
/datum/action/item_action/mod/New(Target)
|
||||
..()
|
||||
if(!ismodcontrol(Target))
|
||||
qdel(src)
|
||||
@@ -23,7 +22,7 @@
|
||||
/datum/action/item_action/mod/deploy
|
||||
name = "Deploy MODsuit"
|
||||
desc = "LMB: Deploy/Undeploy full suit. MMB: Deploy/Undeploy part."
|
||||
button_overlay_icon_state = "deploy"
|
||||
button_icon_state = "deploy"
|
||||
|
||||
/datum/action/item_action/mod/deploy/Trigger(left_click, attack_self)
|
||||
. = ..()
|
||||
@@ -38,7 +37,7 @@
|
||||
/datum/action/item_action/mod/activate
|
||||
name = "Activate MODsuit"
|
||||
desc = "LMB: Activate/Deactivate suit with prompt. MMB: Activate/Deactivate suit skipping prompt."
|
||||
button_overlay_icon_state = "activate"
|
||||
button_icon_state = "activate"
|
||||
/// First time clicking this will set it to TRUE, second time will activate it.
|
||||
var/ready = FALSE
|
||||
|
||||
@@ -48,8 +47,8 @@
|
||||
return
|
||||
if(!ready && left_click)
|
||||
ready = TRUE
|
||||
button_overlay_icon_state = "activate-ready"
|
||||
UpdateButtons()
|
||||
button_icon_state = "activate-ready"
|
||||
build_all_button_icons()
|
||||
addtimer(CALLBACK(src, PROC_REF(reset_ready)), 3 SECONDS)
|
||||
return
|
||||
var/obj/item/mod/control/mod = target
|
||||
@@ -59,13 +58,13 @@
|
||||
/// Resets the state requiring to be doubleclicked again.
|
||||
/datum/action/item_action/mod/activate/proc/reset_ready()
|
||||
ready = FALSE
|
||||
button_overlay_icon_state = initial(button_overlay_icon_state)
|
||||
UpdateButtons()
|
||||
button_icon_state = initial(button_icon_state)
|
||||
build_all_button_icons()
|
||||
|
||||
/datum/action/item_action/mod/module
|
||||
name = "Toggle Module"
|
||||
desc = "Toggle a MODsuit module."
|
||||
button_overlay_icon_state = "module"
|
||||
button_icon_state = "module"
|
||||
|
||||
/datum/action/item_action/mod/module/Trigger(left_click, attack_self)
|
||||
. = ..()
|
||||
@@ -77,7 +76,7 @@
|
||||
/datum/action/item_action/mod/panel
|
||||
name = "MODsuit Panel"
|
||||
desc = "Open the MODsuit's panel."
|
||||
button_overlay_icon_state = "panel"
|
||||
button_icon_state = "panel"
|
||||
|
||||
/datum/action/item_action/mod/panel/Trigger(left_click, attack_self)
|
||||
. = ..()
|
||||
@@ -88,20 +87,21 @@
|
||||
|
||||
/datum/action/item_action/mod/pinned_module
|
||||
desc = "Activate the module."
|
||||
button_overlay_icon = 'icons/obj/clothing/modsuit/mod_modules.dmi'
|
||||
button_overlay_icon_state = "module"
|
||||
button_icon = 'icons/obj/clothing/modsuit/mod_modules.dmi'
|
||||
button_icon_state = "module"
|
||||
/// Module we are linked to.
|
||||
var/obj/item/mod/module/module
|
||||
/// A ref to the mob we are pinned to.
|
||||
var/pinner_uid
|
||||
|
||||
/datum/action/item_action/mod/pinned_module/New(Target, custom_icon, custom_icon_state, obj/item/mod/module/linked_module, mob/user)
|
||||
/datum/action/item_action/mod/pinned_module/New(Target, obj/item/mod/module/linked_module, mob/user)
|
||||
button_icon = linked_module.icon
|
||||
button_icon_state = linked_module.icon_state
|
||||
name = "Activate [capitalize(linked_module.name)]"
|
||||
desc = "Quickly activate [linked_module]."
|
||||
..()
|
||||
module = linked_module
|
||||
button_overlay_icon_state = module.icon_state
|
||||
button_background_icon_state = ((module.module_type == MODULE_TOGGLE && module.active) ? "bg_mod_active" : "bg_mod")
|
||||
background_icon_state = ((module.module_type == MODULE_TOGGLE && module.active) ? "bg_mod_active" : "bg_mod")
|
||||
if(linked_module.allow_flags & MODULE_ALLOW_INCAPACITATED)
|
||||
// clears check hands
|
||||
check_flags = AB_CHECK_CONSCIOUS
|
||||
@@ -131,5 +131,5 @@
|
||||
|
||||
/datum/action/item_action/mod/pinned_module/proc/linked_button_update()
|
||||
if(module.module_type != MODULE_PASSIVE)
|
||||
button_background_icon_state = (module.active ? "bg_mod_active" : "bg_mod")
|
||||
UpdateButtons()
|
||||
background_icon_state = (module.active ? "bg_mod_active" : "bg_mod")
|
||||
build_all_button_icons()
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
qdel(M)
|
||||
pinned_to = list()
|
||||
return
|
||||
var/datum/action/item_action/mod/pinned_module/new_action = new(Target = mod, custom_icon = src.icon, custom_icon_state = src.icon_state, linked_module = src, user = user)
|
||||
var/datum/action/item_action/mod/pinned_module/new_action = new(Target = mod, linked_module = src, user = user)
|
||||
to_chat(user, "[new_action] is now pinned to the UI!")
|
||||
|
||||
|
||||
|
||||
@@ -211,12 +211,11 @@
|
||||
/datum/action/item_action/mod_recall
|
||||
name = "Recall MOD"
|
||||
desc = "Recall a MODsuit anyplace, anytime."
|
||||
use_itemicon = FALSE
|
||||
check_flags = AB_CHECK_CONSCIOUS
|
||||
button_overlay_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
button_overlay_icon_state = "recall"
|
||||
button_background_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
button_background_icon_state = "bg_mod"
|
||||
button_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
button_icon_state = "recall"
|
||||
background_icon = 'icons/mob/actions/actions_mod.dmi'
|
||||
background_icon_state = "bg_mod"
|
||||
/// The cooldown for the recall.
|
||||
COOLDOWN_DECLARE(recall_cooldown)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user