From 8556c8dff6cb9d95e51ee3e20dab56afd596023a Mon Sep 17 00:00:00 2001 From: John Doe Date: Thu, 18 Jul 2024 17:36:27 +0200 Subject: [PATCH] fixes actions being a bit fucked --- code/datums/action.dm | 17 +++++++++++------ code/game/objects/items/devices/flashlight.dm | 2 +- .../objects/items/devices/motion_detector.dm | 2 +- code/game/objects/items/devices/whistle.dm | 3 +-- code/modules/clothing/gloves/boom_glove.dm | 2 +- code/modules/cm_preds/yaut_weapons.dm | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/code/datums/action.dm b/code/datums/action.dm index 8dbf6c9df5a5..e6c87eca6a0d 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -187,12 +187,6 @@ holder_item = null return ..() -/datum/action/item_action/action_activate() - . = ..() - if(target) - var/obj/item/I = target - I.ui_action_click(owner, holder_item) - /datum/action/item_action/can_use_action() if(ishuman(owner) && !owner.is_mob_incapacitated()) var/mob/living/carbon/human/human = owner @@ -213,6 +207,17 @@ name = "Toggle [target]" button.name = name +/datum/action/item_action/toggle/action_activate() + . = ..() + if(target) + var/obj/item/I = target + I.ui_action_click(owner, holder_item) + +/datum/action/item_action/toggle/use/New(target) + . = ..() + name = "Use [target]" + button.name = name + //This is the proc used to update all the action buttons. /mob/proc/update_action_buttons(reload_screen) if(!client) diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 8d5e3cc752ff..e506f51ce21c 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -15,7 +15,7 @@ ground_offset_x = 2 ground_offset_y = 6 - actions_types = list(/datum/action/item_action) + actions_types = list(/datum/action/item_action/toggle) var/on = FALSE var/raillight_compatible = TRUE //Can this be turned into a rail light ? var/toggleable = TRUE diff --git a/code/game/objects/items/devices/motion_detector.dm b/code/game/objects/items/devices/motion_detector.dm index dcbcc0dd8bc7..f68295001f92 100644 --- a/code/game/objects/items/devices/motion_detector.dm +++ b/code/game/objects/items/devices/motion_detector.dm @@ -33,7 +33,7 @@ var/long_range_cooldown = 2 var/blip_type = "detector" var/iff_signal = FACTION_MARINE - actions_types = list(/datum/action/item_action) + actions_types = list(/datum/action/item_action/toggle) var/scanning = FALSE // controls if MD is in process of scan var/datum/shape/rectangle/square/range_bounds var/long_range_locked = FALSE //only long-range MD diff --git a/code/game/objects/items/devices/whistle.dm b/code/game/objects/items/devices/whistle.dm index 331df3ffa006..07196a3e1bb9 100644 --- a/code/game/objects/items/devices/whistle.dm +++ b/code/game/objects/items/devices/whistle.dm @@ -5,7 +5,7 @@ w_class = SIZE_TINY flags_atom = FPRINT|CONDUCT flags_equip_slot = SLOT_FACE - actions_types = list(/datum/action/item_action) + actions_types = list(/datum/action/item_action/toggle/use) var/volume = 60 var/spam_cooldown_time = 10 SECONDS @@ -51,7 +51,6 @@ usr.put_in_l_hand(src) add_fingerprint(usr) - /obj/item/device/hailer name = "hailer" desc = "Used by obese officers to save their breath for running." diff --git a/code/modules/clothing/gloves/boom_glove.dm b/code/modules/clothing/gloves/boom_glove.dm index 8cc3e8d910f6..ddddc5ecef5e 100644 --- a/code/modules/clothing/gloves/boom_glove.dm +++ b/code/modules/clothing/gloves/boom_glove.dm @@ -12,7 +12,7 @@ var/cooldown = 50 var/last_use = 0 - actions_types = list(/datum/action/item_action) + actions_types = list(/datum/action/item_action/toggle/use) /obj/item/clothing/gloves/marine/boom_glove/item_action_slot_check(mob/user, slot) if(!ishuman(user)) return FALSE diff --git a/code/modules/cm_preds/yaut_weapons.dm b/code/modules/cm_preds/yaut_weapons.dm index 2db3c2ca4b68..3a0ed72b99ff 100644 --- a/code/modules/cm_preds/yaut_weapons.dm +++ b/code/modules/cm_preds/yaut_weapons.dm @@ -486,7 +486,7 @@ throw_range = 6 hitsound = 'sound/weapons/slash.ogg' attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") - actions_types = list(/datum/action/item_action) + actions_types = list(/datum/action/item_action/toggle/use) unacidable = TRUE /obj/item/weapon/yautja/knife/attack(mob/living/target, mob/living/carbon/human/user)