Skip to content

Commit

Permalink
bandlolier
Browse files Browse the repository at this point in the history
  • Loading branch information
Gristlebee committed Sep 2, 2024
1 parent 7810e23 commit 13b8bac
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion code/game/objects/items/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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."
Expand Down
20 changes: 20 additions & 0 deletions code/modules/projectiles/boxes_magazines/_box_magazine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,26 @@
to_chat(user, "<span class='notice'>You load [num_loaded] cartridge\s into \the [src]!</span>")
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, "<span class='notice'>You load [num_loaded] cartridge\s into \the [to_load]!</span>")
return
/obj/item/ammo_box/attack_self(mob/user)
var/obj/item/ammo_casing/A = get_round()
if(!A)
Expand Down

0 comments on commit 13b8bac

Please sign in to comment.