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

Toggleable auto-catch and easy restock for revolvers #686

Merged
merged 22 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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/datums/components/magazine_catcher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
/datum/component/magazine_catcher/proc/try_to_catch_magazine(datum/source, obj/item/mag)
if(!storage.can_be_inserted(mag, FALSE))
return FALSE
if(!storage.auto_catch)
return FALSE
return storage.handle_item_insertion(mag, TRUE)
13 changes: 13 additions & 0 deletions code/game/objects/items/storage/holsters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@
underlays -= holstered_item_underlay
QDEL_NULL(holstered_item_underlay)

/obj/item/storage/holster/belt/verb/toggle_auto_catch()
set name = "Toggle Auto Catching Magazines"
set category = "Object"
auto_catch = !auto_catch
if(!auto_catch)
to_chat(usr, "Auto catching disabled.")
else
to_chat(usr, "Auto catching enabled.")
CheBokJam marked this conversation as resolved.
Show resolved Hide resolved

CheBokJam marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/storage/holster/do_quick_equip(mob/user) //Will only draw the specific holstered item, not ammo etc.
if(!holstered_item)
return FALSE
Expand Down Expand Up @@ -718,10 +728,13 @@
/obj/item/storage/holster/belt/revolver
name = "generic revolver belt"
desc = "A revolver belt that is not a pistol belt"
flags_equip_slot = ITEM_SLOT_BELT|ITEM_SLOT_SUITSTORE

/obj/item/storage/holster/belt/revolver/Initialize(mapload, ...)
. = ..()
AddComponent(/datum/component/tac_reload_storage)
AddComponent(/datum/component/magazine_catcher)
AddComponent(/datum/component/easy_restock)
Helg2 marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/storage/holster/belt/revolver/t457
name = "\improper T457 pattern revolver holster rig"
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
var/refill_sound = null
///Flags for specifically storage items
var/flags_storage = NONE
///Auto catching empty magazines: 0 - disabled, 1 - enabled
var/auto_catch = 1
CheBokJam marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/storage/MouseDrop(atom/over_object)
if(!ishuman(usr))
Expand Down
3 changes: 2 additions & 1 deletion code/modules/projectiles/guns/revolvers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@
if(istype(new_magazine.loc, /obj/item/storage))
var/obj/item/storage/S = new_magazine.loc
S.remove_from_storage(new_magazine, get_turf(user), user)
user.put_in_any_hand_if_possible(new_magazine)
//user.put_in_any_hand_if_possible(new_magazine)
reload(new_magazine, user)
SEND_SIGNAL(user, COMSIG_MAGAZINE_DROP, new_magazine) //reload() wont SEND_SIGNAL because revolvers reload without unload() proc
if(!do_after(user, tac_reload_time * 0.2, IGNORE_USER_LOC_CHANGE, new_magazine) && loc == user)
return
unique_gun_close(user)
Expand Down
Loading