From 2a20396d184ef328535747e829496076cf8f875c Mon Sep 17 00:00:00 2001 From: Auris456852 <37984520+Auris456852@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:48:23 +0300 Subject: [PATCH] Lets you take rounds out of a pocket ammo box (#2387) ## 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: --- .../projectiles/boxes_magazines/_box_magazine.dm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/code/modules/projectiles/boxes_magazines/_box_magazine.dm b/code/modules/projectiles/boxes_magazines/_box_magazine.dm index 932c438ff1699..c3989e7a4952f 100644 --- a/code/modules/projectiles/boxes_magazines/_box_magazine.dm +++ b/code/modules/projectiles/boxes_magazines/_box_magazine.dm @@ -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, "You remove a round from [src]!") @@ -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