Splits ammo box multiload into a bitflag, adds a icon for .223, adds a desc for toy magazines (#92409)

## About The Pull Request

Ammo box `multiload` var was changed into a bitflag covering
`AMMO_BOX_MULTILOAD_IN`, and `AMMO_BOX_MULTILOAD_OUT`, respectively. By
default, ammo boxes have both multiloading in and out, while magazines
only have multiloading in, which means you can't use magazines as
speedloaders, but you can still feed ammo into magazines quickly if you
had, say, an ammo box for that magazine's caliber. Or... something.

---

Also adds an icon state for .223 casings, which is just an edit of the
old 7.62 casings to be shorter.
<img width="403" height="89" alt="image"
src="https://github.com/user-attachments/assets/b3206b94-c2b3-4b90-8162-b4c620bbe4cf"
/>

---

Also adds a description for toy gun magazines.

## Why It's Good For The Game

Splitting ammo box multiload into "multiload in" and "multiload out"
means you can't use an ammo box as a speedloader, which I thought was
silly. Emergent gameplay, sure, but also silly.

.223 having a unique icon instead of just looking like any other pistol
casing is nice (read: pistol-caliber casings from a rifle round annoyed
me).

Toy gun magazine thing was for funsies at this point.

## Changelog

🆑
code: Ammo boxes' multiload variable is now a bitflag that determines if
a magazine can be multiloaded into or out of. Ammo boxes can multiload
in or out, while magazines can only multiload in.
image: .223 ammo now has a distinct casing icon.
fix: Foam force magazines now have a proper description.
/🆑

---------

Co-authored-by: Hatterhat <Hatterhat@users.noreply.github.com>
This commit is contained in:
Hatterhat
2025-08-11 13:03:31 -05:00
committed by GitHub
parent b9d0b36ded
commit 8e350f1f86
11 changed files with 37 additions and 18 deletions

View File

@@ -147,7 +147,7 @@
continue
if (boolets > 0)
box.update_appearance()
to_chat(user, span_notice("You collect [boolets] shell\s. [box] now contains [box.stored_ammo.len] shell\s."))
to_chat(user, span_notice("You collect [boolets] [box.casing_phrasing]\s. [box] now contains [box.stored_ammo.len] [box.casing_phrasing]\s."))
else
to_chat(user, span_warning("You fail to collect anything!"))
else

View File

@@ -2,7 +2,7 @@
/obj/item/ammo_casing/strilka310
name = ".310 Strilka bullet casing"
desc = "A .310 Strilka bullet casing. Casing is a bit of a fib, there is no case, it's just a block of red powder."
desc = "A .310 Strilka bullet casing. Casing is a bit of a fib; there is no case, it's just a block of red powder."
icon_state = "310-casing"
caliber = CALIBER_STRILKA310
projectile_type = /obj/projectile/bullet/strilka310
@@ -14,7 +14,7 @@
/obj/item/ammo_casing/strilka310/surplus
name = ".310 Strilka surplus bullet casing"
desc = "A surplus .310 Strilka bullet casing. Casing is a bit of a fib, there is no case, it's just a block of red powder. Damp red powder at that."
desc = parent_type::desc + " Damp red powder at that."
projectile_type = /obj/projectile/bullet/strilka310/surplus
/obj/item/ammo_casing/strilka310/enchanted
@@ -22,13 +22,14 @@
/obj/item/ammo_casing/strilka310/phasic
name = ".310 Strilka phasic bullet casing"
desc = "A phasic .310 Strilka bullet casing. "
desc = "A phasic .310 Strilka bullet casing."
projectile_type = /obj/projectile/bullet/strilka310/phasic
// .223 (M-90gl Carbine)
/obj/item/ammo_casing/a223
name = ".223 bullet casing"
desc = "A .223 bullet casing."
icon_state = "223-casing"
caliber = CALIBER_A223
projectile_type = /obj/projectile/bullet/a223

View File

@@ -29,14 +29,15 @@
var/multiple_sprite_use_base = FALSE
///String, used for checking if ammo of different types but still fits can fit inside it; generally used for magazines
var/caliber
///Allows multiple bullets to be loaded in from one click of another box/magazine
var/multiload = TRUE
/// Determines whether ammo boxes can multiload in or out.
var/ammo_box_multiload = AMMO_BOX_MULTILOAD_BOTH
///Whether the magazine should start with nothing in it
var/start_empty = FALSE
/// If this and ammo_band_icon aren't null, run update_ammo_band(). Is the color of the band, such as blue on the detective's Iceblox.
var/ammo_band_color
/// If this and ammo_band_color aren't null, run update_ammo_band() Is the greyscale icon used for the ammo band.
/// If this and ammo_band_color aren't null, run update_ammo_band(). Is the greyscale icon used for the ammo band.
var/ammo_band_icon
/// Is the greyscale icon used for the ammo band when it's empty of bullets, only if it's not null.
var/ammo_band_icon_empty
@@ -161,8 +162,7 @@
/obj/item/ammo_box/proc/can_load(mob/user)
return TRUE
/obj/item/ammo_box/attackby(obj/item/tool, mob/user, params, silent = FALSE, replace_spent = 0)
/obj/item/ammo_box/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(IS_WRITING_UTENSIL(tool))
if(!ammo_band_icon)
balloon_alert(user, "no indicator support!")
@@ -173,6 +173,10 @@
update_appearance()
return
if(try_load(user, tool))
return ITEM_INTERACT_SUCCESS
/obj/item/ammo_box/proc/try_load(mob/living/user, obj/item/tool, silent = FALSE, replace_spent = FALSE)
var/num_loaded = 0
if(!can_load(user))
return
@@ -184,7 +188,7 @@
if(did_load)
other_box.stored_ammo -= casing
num_loaded++
if(!did_load || !multiload)
if(!did_load || !(ammo_box_multiload & AMMO_BOX_MULTILOAD_IN) || !(other_box.ammo_box_multiload & AMMO_BOX_MULTILOAD_OUT))
break
if(num_loaded)
@@ -253,7 +257,8 @@
/obj/item/ammo_box/magazine
name = "A magazine (what?)"
desc = "A magazine of rounds, they look like error signs..."
desc = "A magazine of rounds, they look like error signs... this should probably be reported somewhere."
ammo_box_multiload = AMMO_BOX_MULTILOAD_IN // so you can't use a magazine like a bootleg speedloader
drop_sound = 'sound/items/handling/gun/ballistics/magazine/magazine_drop1.ogg'
pickup_sound = 'sound/items/handling/gun/ballistics/magazine/magazine_pickup1.ogg'

View File

@@ -1,5 +1,6 @@
/obj/item/ammo_box/magazine/toy
name = "foam force META magazine"
desc = "A magazine specifically designed for foam force \"firearms\". Probably not great for actually killing your fellow spaceman."
ammo_type = /obj/item/ammo_casing/foam_dart
caliber = CALIBER_FOAM

View File

@@ -15,7 +15,7 @@
ammo_type = /obj/item/ammo_casing/c357
caliber = CALIBER_357
max_ammo = 6
multiload = FALSE
ammo_box_multiload = AMMO_BOX_MULTILOAD_NONE // presumably so you don't teleport in a full cylinder and end up shooting yourself immediately
start_empty = TRUE
/obj/item/ammo_box/magazine/internal/cylinder/rus357/Initialize(mapload)

View File

@@ -4,7 +4,6 @@
ammo_type = /obj/item/ammo_casing/strilka310
caliber = CALIBER_STRILKA310
max_ammo = 5
multiload = TRUE
/obj/item/ammo_box/magazine/internal/boltaction/surplus
ammo_type = /obj/item/ammo_casing/strilka310/surplus
@@ -69,7 +68,6 @@
ammo_type = /obj/item/ammo_casing/strilka310
caliber = CALIBER_STRILKA310
max_ammo = 10
multiload = TRUE
/obj/item/ammo_box/magazine/internal/sks/empty
start_empty = TRUE

View File

@@ -3,7 +3,8 @@
ammo_type = /obj/item/ammo_casing/shotgun/beanbag
caliber = CALIBER_SHOTGUN
max_ammo = 4
multiload = FALSE
// this inherits regular magazines' AMMO_BOX_MULTILOAD_IN, which means that regular shotguns shouldn't be multiloading from Bulldog magazines
// if someone has the bright idea to add shotgun speedloaders, i certainly hope they know what they're inviting by doing so
/obj/item/ammo_box/magazine/internal/shot/tube
name = "dual feed shotgun internal tube"

View File

@@ -549,7 +549,7 @@
magazine.stored_ammo -= chambered
chambered = null
var/num_loaded = magazine?.attackby(ammo, user, silent = TRUE)
var/num_loaded = magazine?.try_load(user, ammo, silent = TRUE)
if (!num_loaded)
return FALSE