diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e8f518533c0..8a888c4f195 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -678,9 +678,7 @@ /obj/item/update_filters() . = ..() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /atom/proc/get_filter(name) if(filter_data && filter_data[name]) diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 02bc96a0406..fdaee7c737e 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -102,9 +102,7 @@ CONTENTS: if(ishuman(loc)) var/mob/living/carbon/human/H = loc H.update_inv_wear_suit() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/suit/armor/abductor/vest/item_action_slot_check(slot, mob/user) if(slot == ITEM_SLOT_OUTER_SUIT) //we only give the mob the ability to activate the vest if he's actually wearing it. @@ -265,9 +263,7 @@ CONTENTS: to_chat(usr, "You switch the baton to [txt] mode.") update_icon(UPDATE_ICON_STATE) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/abductor_baton/update_icon_state() switch(mode) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index e98cfecc048..66caeb5ad6f 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -988,6 +988,10 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons /obj/item/proc/should_stack_with(obj/item/other) return type == other.type && name == other.name +/obj/item/proc/update_action_buttons(status_only = FALSE, force = FALSE) + for(var/datum/action/current_action as anything in actions) + current_action.UpdateButtons(status_only, force) + /** * Handles the bulk of cigarette lighting interactions. You must call `light()` to actually light the cigarette. * diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index d01713744ba..efc660d4511 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -38,9 +38,7 @@ on = !on playsound(user, togglesound, 100, 1) update_brightness() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() return TRUE /obj/item/flashlight/attack__legacy__attackchain(mob/living/M as mob, mob/living/user as mob) diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index b9b4787614a..6164c5ea57e 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -30,8 +30,7 @@ GLOB.active_jammers |= src else GLOB.active_jammers -= src - for(var/datum/action/item_action/toggle_radio_jammer/A in actions) - A.UpdateButtons() + update_action_buttons() /obj/item/teleporter name = "syndicate teleporter" diff --git a/code/game/objects/items/devices/voice_changer.dm b/code/game/objects/items/devices/voice_changer.dm index 25f3d564475..e3b87ac62e2 100644 --- a/code/game/objects/items/devices/voice_changer.dm +++ b/code/game/objects/items/devices/voice_changer.dm @@ -29,9 +29,7 @@ icon_state = "voice_changer_[active ? "on" : "off"]" to_chat(user, "You toggle [src] [active ? "on" : "off"].") - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/voice_changer/proc/set_voice(mob/user) var/chosen_voice = tgui_input_text(user, "What voice would you like to mimic? Leave this empty to use the voice on your ID card.", "Set Voice Changer") diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 9d476d964ee..48b0e230118 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -209,9 +209,7 @@ /obj/item/borg/upgrade/selfrepair/update_icon_state() if(cyborg) icon_state = "selfrepair_[on ? "on" : "off"]" - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() else icon_state = "cyborg_upgrade5" diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 50424daac34..1ec98188b57 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -157,9 +157,7 @@ remove_paddles(user) update_icon(UPDATE_OVERLAYS) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/defibrillator/equipped(mob/user, slot) ..() diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm index 7808989a80e..e35157b3196 100644 --- a/code/game/objects/items/weapons/tanks/jetpack.dm +++ b/code/game/objects/items/weapons/tanks/jetpack.dm @@ -79,9 +79,7 @@ else turn_off(user) to_chat(user, "You turn the jetpack off.") - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/tank/jetpack/proc/turn_on(mob/user) if(SEND_SIGNAL(src, COMSIG_JETPACK_ACTIVATED, user) & JETPACK_ACTIVATION_FAILED) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 72a5e86ec3e..14aaea6ee98 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -471,9 +471,7 @@ if(src == user.get_active_hand()) //update inhands user.update_inv_l_hand() user.update_inv_r_hand() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/chainsaw/attack_hand(mob/user) . = ..() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 1d35418c9ee..c57b2737824 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -62,9 +62,7 @@ if(iscarbon(user)) var/mob/living/carbon/C = user C.head_update(src, forced = 1) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() return TRUE /obj/item/clothing/proc/visor_toggling() //handles all the actual toggling of flags @@ -609,9 +607,7 @@ H.wear_mask_update(src, toggle_off = up) usr.update_inv_wear_mask() usr.update_inv_head() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() ////////////////////////////// // MARK: SHOES @@ -835,9 +831,7 @@ if(adjust_flavour) flavour = "[copytext(adjust_flavour, 3, length(adjust_flavour) + 1)] up" //Trims off the 'un' at the beginning of the word. unzip -> zip, unbutton->button. to_chat(user, "You [flavour] \the [src].") - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() else var/flavour = "open" icon_state += "_open" @@ -845,9 +839,7 @@ if(adjust_flavour) flavour = "[adjust_flavour]" to_chat(user, "You [flavour] \the [src].") - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() suit_adjusted = !suit_adjusted update_icon(UPDATE_ICON_STATE) diff --git a/code/modules/clothing/glasses/engine_goggles.dm b/code/modules/clothing/glasses/engine_goggles.dm index 5d5ac61035e..6270916c142 100644 --- a/code/modules/clothing/glasses/engine_goggles.dm +++ b/code/modules/clothing/glasses/engine_goggles.dm @@ -75,9 +75,7 @@ H.update_sight() update_icon(UPDATE_ICON_STATE) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/glasses/meson/engine/attack_self__legacy__attackchain(mob/user) toggle_mode(user, TRUE) diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm index 59cb22ee071..8fdf0be5c34 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -34,9 +34,7 @@ if(ishuman(loc)) var/mob/living/carbon/human/H = loc H.update_inv_head() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/head/hardhat/proc/turn_on(mob/user) set_light(brightness_on) diff --git a/code/modules/clothing/head/soft_caps.dm b/code/modules/clothing/head/soft_caps.dm index ad3c82793c2..c9b4e67ed17 100644 --- a/code/modules/clothing/head/soft_caps.dm +++ b/code/modules/clothing/head/soft_caps.dm @@ -33,9 +33,7 @@ to_chat(user, "You flip the hat back in normal position.") user.update_inv_head() //so our mob-overlays update - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/head/soft/red name = "red cap" diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 932787d7d94..76595128036 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -53,9 +53,7 @@ to_chat(user, "You [magpulse ? "enable" : "disable"] the [magpulse_name].") user.update_inv_shoes() //so our mob-overlays update user.update_gravity(user.mob_has_gravity()) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() check_mag_pulse(user, removing = (user.get_item_by_slot(ITEM_SLOT_SHOES) != src)) /obj/item/clothing/shoes/magboots/proc/check_mag_pulse(mob/user, removing = FALSE) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 1ca2bda770d..5bebc4545b8 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -65,9 +65,7 @@ set_light(brightness_on) else set_light(0) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/head/helmet/space/hardsuit/extinguish_light(force = FALSE) if(on) @@ -310,9 +308,7 @@ if(iscarbon(user)) var/mob/living/carbon/C = user C.head_update(src, forced = 1) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/head/helmet/space/hardsuit/syndi/proc/toggle_hardsuit_mode(mob/user) //Helmet Toggles Suit Mode if(linkedsuit) diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm index 903cefa868c..c917e38e961 100644 --- a/code/modules/clothing/spacesuits/plasmamen.dm +++ b/code/modules/clothing/spacesuits/plasmamen.dm @@ -50,9 +50,7 @@ /obj/item/clothing/head/helmet/space/plasmaman/update_icon(updates=ALL) . = ..() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/head/helmet/space/plasmaman/update_icon_state() if(!up) diff --git a/code/modules/clothing/suits/armor_suits.dm b/code/modules/clothing/suits/armor_suits.dm index 3ddf3ec98ae..e1e9efc6cac 100644 --- a/code/modules/clothing/suits/armor_suits.dm +++ b/code/modules/clothing/suits/armor_suits.dm @@ -452,9 +452,7 @@ item_state = "reactiveoff" add_fingerprint(user) user.update_inv_wear_suit() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/suit/armor/reactive/emp_act(severity) var/emp_power = 5 + (severity-1 ? 0 : 5) diff --git a/code/modules/clothing/suits/hood.dm b/code/modules/clothing/suits/hood.dm index 50b18e8ecfa..df3ceb9cb93 100644 --- a/code/modules/clothing/suits/hood.dm +++ b/code/modules/clothing/suits/hood.dm @@ -49,9 +49,7 @@ H.update_inv_wear_suit() else hood.forceMove(src) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/suit/hooded/dropped() ..() @@ -71,9 +69,7 @@ suit_adjusted = 1 icon_state = "[initial(icon_state)]_hood" H.update_inv_wear_suit() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() else if((hood?.flags & NODROP) && respects_nodrop) if(ishuman(loc)) diff --git a/code/modules/clothing/suits/misc_suits.dm b/code/modules/clothing/suits/misc_suits.dm index 39649d2d164..75a9570a9ce 100644 --- a/code/modules/clothing/suits/misc_suits.dm +++ b/code/modules/clothing/suits/misc_suits.dm @@ -1207,9 +1207,7 @@ icon_state = initial(icon_state) item_state = initial(item_state) usr.update_inv_wear_suit() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/suit/lordadmiral name = "lord admiral's coat" diff --git a/code/modules/customitems/item_defines.dm b/code/modules/customitems/item_defines.dm index 880cd06c900..70af5f6053d 100644 --- a/code/modules/customitems/item_defines.dm +++ b/code/modules/customitems/item_defines.dm @@ -1006,9 +1006,7 @@ item_state += "_on" suit_adjusted = 1 //Lights On - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() to_chat(user, "You turn [src]'s lighting system [flavour].") user.update_inv_wear_suit() @@ -1332,9 +1330,7 @@ name = plushie_color icon_state = plush_colors[plushie_color] - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/toy/plushie/fluff/fox/ui_action_click(mob/user) change_color(user) @@ -1406,9 +1402,7 @@ to_chat(usr, "You transform \the [src].") adjusted = 1 usr.update_inv_head() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /// chronx100: Hughe O'Splash /obj/item/clothing/suit/chaplain_hoodie/fluff/chronx diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index 571ec9564d7..6b4e42830f2 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -1046,9 +1046,7 @@ if(!length(cards)) return if(length(cards) <= 2) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() ..() /obj/item/cardhand/update_name() diff --git a/code/modules/instruments/objs/items/headphones.dm b/code/modules/instruments/objs/items/headphones.dm index fe0f4f54e9e..80b336e4942 100644 --- a/code/modules/instruments/objs/items/headphones.dm +++ b/code/modules/instruments/objs/items/headphones.dm @@ -26,9 +26,7 @@ else if(actiontype == /datum/action/item_action/toggle_music_notes) toggle_visual_notes(user) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/clothing/ears/headphones/proc/toggle_visual_notes(mob/user) on = !on diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm index f3f6a6a7424..e8a175ff62c 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -189,10 +189,7 @@ . += "[icon_state]_uncharged" if(light_on) . += "[icon_state]_lit" - spawn(1) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() //destablizing force /obj/item/projectile/destabilizer diff --git a/code/modules/mining/equipment/regenerative_core.dm b/code/modules/mining/equipment/regenerative_core.dm index 24c6808384a..c8c778ce896 100644 --- a/code/modules/mining/equipment/regenerative_core.dm +++ b/code/modules/mining/equipment/regenerative_core.dm @@ -130,9 +130,7 @@ . = ..() if(!inert && !preserved) . += "legion_soul_crackle" - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/organ/internal/regenerative_core/legion/go_inert() ..() diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 7e5e86a7e4d..780e94bd70b 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -428,9 +428,7 @@ else set_light(0) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/gun/proc/clear_bayonet() if(!bayonet) diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 65ac020b713..3162f234d2e 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -75,9 +75,7 @@ playsound(user, 'sound/weapons/gun_interactions/selector.ogg', 100, 1) update_icon() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtons() + update_action_buttons() /obj/item/gun/projectile/automatic/can_shoot() return get_ammo()