Skip to content

Commit

Permalink
Lets you take rounds out of a pocket ammo box (#2387)
Browse files Browse the repository at this point in the history
## About The Pull Request

Exactly what it says on the tin. If an ammo box is in your pocket,
alt-clicking on it will, instead of taking the box, take a round out of
the box. ~~You can take it into your hand like you would a deck of cards
- by click-dragging.~~ With the action moved to alt-click, other
interactions of an ammo box should be unaffected.

## Why It's Good For The Game

Manual reload style points. I love reloading in the middle of a battle!

## Changelog

:cl:
tweak: You can now take individual rounds out of an ammo box in your
pocket by alt-clicking!
/:cl:
  • Loading branch information
Auris456852 authored Oct 11, 2023
1 parent 7ed554a commit 2a20396
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion code/modules/projectiles/boxes_magazines/_box_magazine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
return

A.forceMove(drop_location())
if(!user.is_holding(src) || !user.put_in_hands(A)) //incase they're using TK
var/mob/living/carbon/human/H = user
if(!(user.is_holding(src) || H.l_store == src || H.r_store == src) || !user.put_in_hands(A)) //incase they're using TK
A.bounce_away(FALSE, NONE)
playsound(src, 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE)
to_chat(user, "<span class='notice'>You remove a round from [src]!</span>")
Expand Down Expand Up @@ -159,6 +160,19 @@
temp_materials[material] = (bullet_cost[material] * stored_ammo.len) + base_cost[material]
set_custom_materials(temp_materials)

/obj/item/ammo_box/AltClick(mob/user)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if((user.is_holding(src) ||H.l_store == src || H.r_store == src) && !(caliber || istype(src, /obj/item/ammo_box/magazine) || instant_load)) //caliber because boxes have none, instant load because speedloaders use the base ammo box type with instant load on, and magazine for the obvious.
attack_self(user)
return
..()

/obj/item/ammo_box/examine(mob/user)
. = ..()
if(!(caliber || istype(src, /obj/item/ammo_box/magazine) || instant_load))
. += "Alt-click on [src] while it in a pocket or your off-hand to take out a round while it is there."

/obj/item/ammo_box/magazine
w_class = WEIGHT_CLASS_SMALL //Default magazine weight, only differs for tiny mags and drums

Expand Down

0 comments on commit 2a20396

Please sign in to comment.