Skip to content

Commit

Permalink
COOLDOWNS WOW
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Jul 20, 2023
1 parent d75703f commit 7768a16
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions code/game/objects/items/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,8 @@
)
cant_hold = list()
flap = FALSE
var/draw_cooldown = 0

COOLDOWN_DECLARE(draw_cooldown)

/obj/item/storage/belt/knifepouch/fill_preset_inventory()
for(var/i = 1 to storage_slots)
Expand All @@ -750,9 +751,9 @@
playsound(src, 'sound/weapons/gun_shotgun_shell_insert.ogg', 15, TRUE)

/obj/item/storage/belt/knifepouch/attack_hand(mob/user, mods)
if(draw_cooldown < world.time)
if(COOLDOWN_FINISHED(src, draw_cooldown))
..()
draw_cooldown = world.time + BAYONET_DRAW_DELAY
COOLDOWN_START(src, draw_cooldown, BAYONET_DRAW_DELAY)
playsound(src, 'sound/weapons/gun_shotgun_shell_insert.ogg', 15, TRUE)
else
to_chat(user, SPAN_WARNING("You need to wait before drawing another knife!"))
Expand Down
7 changes: 4 additions & 3 deletions code/game/objects/items/storage/pouch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@
icon_state = "bayonet"
storage_slots = 5
storage_flags = STORAGE_FLAGS_POUCH|STORAGE_USING_DRAWING_METHOD|STORAGE_ALLOW_QUICKDRAW
var/draw_cooldown = 0
var/default_knife_type = /obj/item/weapon/throwing_knife

COOLDOWN_DECLARE(draw_cooldown)

/obj/item/storage/pouch/bayonet/Initialize()
. = ..()
for(var/total_storage_slots in 1 to storage_slots)
Expand All @@ -148,9 +149,9 @@
playsound(src, 'sound/weapons/gun_shotgun_shell_insert.ogg', 15, TRUE)

/obj/item/storage/pouch/bayonet/attack_hand(mob/user, mods)
if(draw_cooldown < world.time)
if(COOLDOWN_FINISHED(src, draw_cooldown))
..()
draw_cooldown = world.time + BAYONET_DRAW_DELAY
COOLDOWN_START(src, draw_cooldown, BAYONET_DRAW_DELAY)
playsound(src, 'sound/weapons/gun_shotgun_shell_insert.ogg', 15, TRUE)
else
to_chat(user, SPAN_WARNING("You need to wait before drawing another knife!"))
Expand Down
7 changes: 4 additions & 3 deletions code/modules/clothing/under/ties.dm
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,8 @@
/obj/item/weapon/throwing_knife,
)
storage_flags = STORAGE_ALLOW_QUICKDRAW|STORAGE_FLAGS_POUCH
var/draw_cooldown = 0

COOLDOWN_DECLARE(draw_cooldown)

/obj/item/storage/internal/accessory/knifeharness/fill_preset_inventory()
for(var/i = 1 to storage_slots)
Expand All @@ -619,13 +620,13 @@
/obj/item/storage/internal/accessory/knifeharness/attack_hand(mob/user, mods)
. = ..()

if(draw_cooldown >= world.time)
if(!COOLDOWN_FINISHED(src, draw_cooldown))
to_chat(user, SPAN_WARNING("You need to wait before drawing another knife!"))
return FALSE

if(length(contents))
contents[length(contents)].attack_hand(user, mods)
draw_cooldown = world.time + BAYONET_DRAW_DELAY
COOLDOWN_START(src, draw_cooldown, BAYONET_DRAW_DELAY)

/obj/item/storage/internal/accessory/knifeharness/_item_insertion(obj/item/inserted_item, prevent_warning = 0)
..()
Expand Down

0 comments on commit 7768a16

Please sign in to comment.