diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index f5645b70194a..41cabb7903eb 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -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) @@ -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!")) diff --git a/code/game/objects/items/storage/pouch.dm b/code/game/objects/items/storage/pouch.dm index 480615c2244b..a267b3038f58 100644 --- a/code/game/objects/items/storage/pouch.dm +++ b/code/game/objects/items/storage/pouch.dm @@ -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) @@ -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!")) diff --git a/code/modules/clothing/under/ties.dm b/code/modules/clothing/under/ties.dm index 87c0ecb8d6b4..d0e3b77d70c5 100644 --- a/code/modules/clothing/under/ties.dm +++ b/code/modules/clothing/under/ties.dm @@ -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) @@ -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) ..()