Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knife webbing fixes and consistency #3899

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions code/game/objects/items/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,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)
Expand All @@ -751,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 + 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!"))
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/storage/pouch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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!"))
Expand Down
32 changes: 32 additions & 0 deletions code/modules/clothing/under/ties.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
6 changes: 6 additions & 0 deletions code/modules/projectiles/gun_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Loading