diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index 71c659054952..60c4116df330 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -18,3 +18,5 @@ //the define for visible message range in combat #define COMBAT_MESSAGE_RANGE 3 #define DEFAULT_MESSAGE_RANGE 7 + +#define BAYONET_DRAW_DELAY (1 SECONDS) diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index 015d8a5eca60..6e8b00fc48e8 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -742,8 +742,8 @@ ) cant_hold = list() flap = FALSE - var/draw_cooldown = 0 - var/draw_cooldown_interval = 1 SECONDS + + COOLDOWN_DECLARE(draw_cooldown) /obj/item/storage/belt/knifepouch/fill_preset_inventory() for(var/i = 1 to storage_slots) @@ -758,9 +758,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 + draw_cooldown_interval + 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 02e4b3866271..7a49f48cdc92 100644 --- a/code/game/objects/items/storage/pouch.dm +++ b/code/game/objects/items/storage/pouch.dm @@ -128,10 +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/draw_cooldown_interval = 1 SECONDS 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) @@ -149,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 + draw_cooldown_interval + 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 84e053388826..d0e3b77d70c5 100644 --- a/code/modules/clothing/under/ties.dm +++ b/code/modules/clothing/under/ties.dm @@ -593,6 +593,12 @@ icon_state = "vest_knives" hold = /obj/item/storage/internal/accessory/knifeharness +/obj/item/clothing/accessory/storage/knifeharness/attack_hand(mob/user, mods) + if(!mods || !mods["alt"] || !length(hold.contents)) + return ..() + + hold.contents[length(contents)].attack_hand(user, mods) + /obj/item/storage/internal/accessory/knifeharness storage_slots = 5 max_storage_space = 5 @@ -603,6 +609,32 @@ /obj/item/attachable/bayonet, /obj/item/weapon/throwing_knife, ) + storage_flags = STORAGE_ALLOW_QUICKDRAW|STORAGE_FLAGS_POUCH + + COOLDOWN_DECLARE(draw_cooldown) + +/obj/item/storage/internal/accessory/knifeharness/fill_preset_inventory() + for(var/i = 1 to storage_slots) + new /obj/item/weapon/throwing_knife(src) + +/obj/item/storage/internal/accessory/knifeharness/attack_hand(mob/user, mods) + . = ..() + + 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) + COOLDOWN_START(src, draw_cooldown, BAYONET_DRAW_DELAY) + +/obj/item/storage/internal/accessory/knifeharness/_item_insertion(obj/item/inserted_item, prevent_warning = 0) + ..() + playsound(src, 'sound/weapons/gun_shotgun_shell_insert.ogg', 15, TRUE) + +/obj/item/storage/internal/accessory/knifeharness/_item_removal(obj/item/removed_item, atom/new_location) + ..() + playsound(src, 'sound/weapons/gun_shotgun_shell_insert.ogg', 15, TRUE) /obj/item/clothing/accessory/storage/knifeharness/duelling name = "decorated harness" diff --git a/code/modules/projectiles/gun_helpers.dm b/code/modules/projectiles/gun_helpers.dm index d8ea29cd92f8..62f7378191a5 100644 --- a/code/modules/projectiles/gun_helpers.dm +++ b/code/modules/projectiles/gun_helpers.dm @@ -554,6 +554,12 @@ As sniper rifles have both and weapon mods can change them as well. ..() deals w var/obj/item/storage/internal/accessory/holster/holster = cycled_holster.hold if(holster.current_gun) return holster.current_gun + + for(var/obj/item/clothing/accessory/storage/cycled_accessory in w_uniform.accessories) + var/obj/item/storage/internal/accessory/accessory_storage = cycled_accessory.hold + if(accessory_storage.storage_flags & STORAGE_ALLOW_QUICKDRAW) + return accessory_storage + return FALSE if(istype(slot) && (slot.storage_flags & STORAGE_ALLOW_QUICKDRAW))