From 13b8bacec182cfbe6b05f1aada83c33c7340b4d2 Mon Sep 17 00:00:00 2001 From: Gristlebee <56049844+Gristlebee@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:02:50 -0700 Subject: [PATCH] bandlolier --- code/game/objects/items/storage/belt.dm | 6 +++++- .../boxes_magazines/_box_magazine.dm | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index fbe1bbc73131..924ebfb61bb8 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -680,7 +680,7 @@ /obj/item/storage/belt/bandolier name = "bandolier" - desc = "A bandolier for holding ammunition. Does not hold magazines" + desc = "A bandolier for holding ammunition. Does not hold magazines." icon_state = "bandolier" item_state = "bandolier" @@ -694,6 +694,10 @@ /obj/item/ammo_casing )) +/obj/item/storage/belt/bandolier/examine(mob/user) + . = ..() + . += span_notice("The bandolier can be directly loaded by clicking on it with an ammo box.") + /obj/item/storage/belt/fannypack name = "fannypack" desc = "A dorky fannypack for keeping small items in." diff --git a/code/modules/projectiles/boxes_magazines/_box_magazine.dm b/code/modules/projectiles/boxes_magazines/_box_magazine.dm index 3b1bdbc6eb1c..7f92dfad16a6 100644 --- a/code/modules/projectiles/boxes_magazines/_box_magazine.dm +++ b/code/modules/projectiles/boxes_magazines/_box_magazine.dm @@ -125,6 +125,26 @@ to_chat(user, "You load [num_loaded] cartridge\s into \the [src]!") return num_loaded +/obj/item/ammo_box/afterattack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + var/num_loaded = 0 + var/obj/item/storage/belt/bandolier/to_load + if(istype(target,/obj/item/storage/belt/bandolier)) + to_load = target + var/datum/component/storage/storage_to_load = to_load.GetComponent(/datum/component/storage) + for(var/obj/item/ammo_casing/casing_to_insert in stored_ammo) + if(!((to_load.contents.len >= storage_to_load.get_max_volume()) || do_after(user, 0.5 SECONDS, src))) + break + if(!storage_to_load.can_be_inserted(casing_to_insert,TRUE,user)) + break + storage_to_load.handle_item_insertion(casing_to_insert,TRUE,user) + stored_ammo -= casing_to_insert + playsound(get_turf(src), 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE) + num_loaded++ + update_ammo_count() + if(num_loaded) + to_chat(user, "You load [num_loaded] cartridge\s into \the [to_load]!") + return /obj/item/ammo_box/attack_self(mob/user) var/obj/item/ammo_casing/A = get_round() if(!A)