Skip to content

Commit

Permalink
fixes actions being a bit fucked
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoe2013 committed Jul 18, 2024
1 parent ccdd8e6 commit 8556c8d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
17 changes: 11 additions & 6 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/flashlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/motion_detector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions code/game/objects/items/devices/whistle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/gloves/boom_glove.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cm_preds/yaut_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8556c8d

Please sign in to comment.