diff --git a/code/modules/projectiles/ammunition/_ammunition.dm b/code/modules/projectiles/ammunition/_ammunition.dm index 5b7317972175..1ded57bbafe6 100644 --- a/code/modules/projectiles/ammunition/_ammunition.dm +++ b/code/modules/projectiles/ammunition/_ammunition.dm @@ -38,6 +38,8 @@ var/list/bounce_sfx_override // if true, overrides the bouncing sfx from the turf to this one + var/bullet_per_box + /obj/item/ammo_casing/spent name = "spent bullet casing" diff --git a/code/modules/projectiles/ammunition/ballistic/lmg.dm b/code/modules/projectiles/ammunition/ballistic/lmg.dm index 90030e7b0944..d46001951ba4 100644 --- a/code/modules/projectiles/ammunition/ballistic/lmg.dm +++ b/code/modules/projectiles/ammunition/ballistic/lmg.dm @@ -6,6 +6,7 @@ icon_state = "rifle-steel" caliber = "7.12x82mm" projectile_type = /obj/projectile/bullet/mm712x82 + bullet_per_box = 100 /obj/item/ammo_casing/mm712x82/ap name = "7.12x82mm armor-piercing bullet casing" diff --git a/code/modules/projectiles/ammunition/ballistic/pistol.dm b/code/modules/projectiles/ammunition/ballistic/pistol.dm index a105ae6602ee..0f37b5426d2d 100644 --- a/code/modules/projectiles/ammunition/ballistic/pistol.dm +++ b/code/modules/projectiles/ammunition/ballistic/pistol.dm @@ -6,6 +6,7 @@ icon_state = "pistol-steel" caliber = "10mm" projectile_type = /obj/projectile/bullet/c10mm + bullet_per_box = 50 /obj/item/ammo_casing/c10mm/surplus name = "10mm surplus bullet casing" @@ -45,6 +46,7 @@ icon_state = "pistol-brass" caliber = "9mm" projectile_type = /obj/projectile/bullet/c9mm + bullet_per_box = 50 /obj/item/ammo_casing/c9mm/surplus name = "9mm surplus bullet casing" @@ -84,6 +86,7 @@ icon_state = "pistol-steel" caliber = ".45" projectile_type = /obj/projectile/bullet/c45 + bullet_per_box = 50 /obj/item/ammo_casing/c45/surplus name = ".45 surplus bullet casing" @@ -122,6 +125,7 @@ desc = "A .50 AE bullet casing." caliber = ".50 AE" projectile_type = /obj/projectile/bullet/a50AE + bullet_per_box = 20 /obj/item/ammo_casing/a50AE/hp name = ".50 AE hollow point bullet casing" @@ -134,4 +138,5 @@ desc = "A .22 LR bullet casing." projectile_type = /obj/projectile/bullet/c22lr caliber = "22lr" + bullet_per_box = 75 diff --git a/code/modules/projectiles/ammunition/ballistic/revolver.dm b/code/modules/projectiles/ammunition/ballistic/revolver.dm index d5684e834e3d..fa77095de9b9 100644 --- a/code/modules/projectiles/ammunition/ballistic/revolver.dm +++ b/code/modules/projectiles/ammunition/ballistic/revolver.dm @@ -6,6 +6,7 @@ caliber = ".357" icon_state = "magnum-brass" projectile_type = /obj/projectile/bullet/a357 + bullet_per_box = 50 /obj/item/ammo_casing/a357/match name = ".357 match bullet casing" @@ -28,6 +29,7 @@ caliber = ".45-70" icon_state = "magnum-brass" projectile_type = /obj/projectile/bullet/a4570 + bullet_per_box = 12 /obj/item/ammo_casing/a4570/match name = ".45-70 match bullet casing" @@ -53,6 +55,7 @@ desc = "A .38 Special bullet casing." caliber = ".38" projectile_type = /obj/projectile/bullet/c38 + bullet_per_box = 50 /obj/item/ammo_casing/c38/surplus name = ".38 surplus bullet casing" diff --git a/code/modules/projectiles/ammunition/ballistic/rifle.dm b/code/modules/projectiles/ammunition/ballistic/rifle.dm index 5b93bfaa2463..57592185aff6 100644 --- a/code/modules/projectiles/ammunition/ballistic/rifle.dm +++ b/code/modules/projectiles/ammunition/ballistic/rifle.dm @@ -6,6 +6,7 @@ icon_state = "rifle-brass" caliber = "8x50mmR" projectile_type = /obj/projectile/bullet/a8_50r + bullet_per_box = 20 /obj/item/ammo_casing/a8_50rhp name = "8x50mmR hollow point bullet casing" @@ -23,6 +24,7 @@ icon_state = "caseless" caliber = "a858" projectile_type = /obj/projectile/bullet/a858 + bullet_per_box = 20 // .300 Magnum (Smile Rifle) @@ -32,6 +34,7 @@ icon_state = "rifle-steel" caliber = "a300" projectile_type = /obj/projectile/bullet/a300 + bullet_per_box = 20 // 5.56x39mm (M-90gl Carbine & P-16) @@ -41,6 +44,7 @@ icon_state = "rifle-brass" caliber = "5.56x45mm" projectile_type = /obj/projectile/bullet/a556_45 + bullet_per_box = 80 // 5.45x39mm (SKM-24v) @@ -51,6 +55,7 @@ caliber = "5.45x39mm" randomspread = TRUE projectile_type = /obj/projectile/bullet/a545_39 + bullet_per_box = 80 /obj/item/ammo_casing/a545_39/recycled name = "recycled 5.45x39mm bullet casing" @@ -67,6 +72,7 @@ icon_state = "rifle-brass" caliber = "7.62x40mm" projectile_type = /obj/projectile/bullet/a762_40 + bullet_per_box = 80 // .300 Blackout (Polymer Survivor Rifle) @@ -76,6 +82,7 @@ icon_state = "rifle-steel" caliber = ".300 BLK" projectile_type = /obj/projectile/bullet/aac_300blk + bullet_per_box = 20 /obj/item/ammo_casing/aac_300blk/recycled name = "recycled .300 BLK bullet casing" @@ -91,6 +98,7 @@ icon_state = "rifle-brass" caliber = ".308" projectile_type = /obj/projectile/bullet/a308 + bullet_per_box = 20 /obj/item/ammo_casing/caseless/c299 name = ".229 Eoehoma caseless bullet casing" @@ -98,3 +106,4 @@ icon_state = "caseless" caliber = ".299 caseless" projectile_type = /obj/projectile/bullet/c299 + bullet_per_box = 80 diff --git a/code/modules/projectiles/ammunition/ballistic/shotgun.dm b/code/modules/projectiles/ammunition/ballistic/shotgun.dm index b297ee30e776..8e5f2e128ac7 100644 --- a/code/modules/projectiles/ammunition/ballistic/shotgun.dm +++ b/code/modules/projectiles/ammunition/ballistic/shotgun.dm @@ -8,6 +8,7 @@ caliber = "12ga" custom_materials = list(/datum/material/iron=4000) projectile_type = /obj/projectile/bullet/slug + bullet_per_box = 25 bounce_sfx_override = 'sound/weapons/gun/general/bulletcasing_shotgun_bounce.ogg' diff --git a/code/modules/projectiles/ammunition/ballistic/smg.dm b/code/modules/projectiles/ammunition/ballistic/smg.dm index d947736d5f25..74bb35b1ec2e 100644 --- a/code/modules/projectiles/ammunition/ballistic/smg.dm +++ b/code/modules/projectiles/ammunition/ballistic/smg.dm @@ -6,6 +6,7 @@ icon_state = "rifle-brass" caliber = "4.6x30mm" projectile_type = /obj/projectile/bullet/c46x30mm + bullet_per_box = 50 /obj/item/ammo_casing/c46x30mm/ap name = "4.6x30mm armor-piercing bullet casing" @@ -18,6 +19,7 @@ desc = "A 4.6x30mm incendiary bullet casing." bullet_skin = "incen" projectile_type = /obj/projectile/bullet/incendiary/c46x30mm + bullet_per_box = 50 // 4.73x33mm caseless (Solar) @@ -27,6 +29,7 @@ icon_state = "caseless" caliber = "4.73x33mm caseless" projectile_type = /obj/projectile/bullet/c47x33mm + bullet_per_box = 50 // 5.56mm HITP caseless (Pistole C) diff --git a/code/modules/projectiles/ammunition/ballistic/sniper.dm b/code/modules/projectiles/ammunition/ballistic/sniper.dm index af7369204e6d..e4b668c2228f 100644 --- a/code/modules/projectiles/ammunition/ballistic/sniper.dm +++ b/code/modules/projectiles/ammunition/ballistic/sniper.dm @@ -6,6 +6,7 @@ icon_state = "big-steel" caliber = ".50 BMG" projectile_type = /obj/projectile/bullet/p50 + bullet_per_box = 20 /obj/item/ammo_casing/p50/soporific name = ".50 BMG soporific bullet casing" diff --git a/code/modules/projectiles/ammunition/caseless/foam.dm b/code/modules/projectiles/ammunition/caseless/foam.dm index 3c71d31eb5ed..0051680fd1e8 100644 --- a/code/modules/projectiles/ammunition/caseless/foam.dm +++ b/code/modules/projectiles/ammunition/caseless/foam.dm @@ -9,6 +9,7 @@ custom_materials = list(/datum/material/iron = 11.25) harmful = FALSE var/modified = FALSE + bullet_per_box = 40 /obj/item/ammo_casing/caseless/foam_dart/update_icon_state() . = ..() diff --git a/code/modules/projectiles/boxes_magazines/_box_magazine.dm b/code/modules/projectiles/boxes_magazines/_box_magazine.dm index 87f47b99d36d..08a87e017aad 100644 --- a/code/modules/projectiles/boxes_magazines/_box_magazine.dm +++ b/code/modules/projectiles/boxes_magazines/_box_magazine.dm @@ -51,7 +51,7 @@ if(!start_empty) for(var/i = 1, i <= max_ammo, i++) stored_ammo += new ammo_type(src) - update_appearance() + update_ammo_count() ///gets a round from the magazine, if keep is TRUE the round will stay in the gun /obj/item/ammo_box/proc/get_round(keep = FALSE) @@ -107,8 +107,8 @@ if(!silent) playsound(get_turf(attacking_box), 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE) //src is nullspaced, which means internal magazines won't properly play sound, thus we use attacking_box num_loaded++ - attacking_obj.update_appearance() - update_appearance() + attacking_box.update_ammo_count() + update_ammo_count() if(istype(attacking_obj, /obj/item/ammo_casing)) var/obj/item/ammo_casing/casing_to_insert = attacking_obj @@ -117,7 +117,7 @@ if(!silent) playsound(casing_to_insert, 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE) num_loaded++ - update_appearance() + update_ammo_count() if(num_loaded) diff --git a/code/modules/projectiles/boxes_magazines/generic_ammo_box.dm b/code/modules/projectiles/boxes_magazines/generic_ammo_box.dm new file mode 100644 index 000000000000..2c88824623e2 --- /dev/null +++ b/code/modules/projectiles/boxes_magazines/generic_ammo_box.dm @@ -0,0 +1,53 @@ +/obj/item/ammo_box/generic + name = "generic ammo box" + desc = "A generic, unbranded box of ammo. It doesn't have great capacity, but it can hold a variety of different calibers." + max_ammo = 20 + start_empty = TRUE + icon_state = "generic-ammo" + /// Does the box currently have an ammo type set? + var/ammo_set = FALSE + /// Name of the currently set ammo type + var/ammo_name + +/obj/item/ammo_box/generic/update_ammo_count() + . = ..() + if(LAZYLEN(stored_ammo) == 0) + ammo_set = FALSE + ammo_type = /obj/item/ammo_casing + +/obj/item/ammo_box/generic/proc/update_max_ammo(obj/item/ammo_casing/ammo) + if(ammo.bullet_per_box) + max_ammo = round(ammo.bullet_per_box) + else + max_ammo = 10 + + return + +/obj/item/ammo_box/generic/attackby(obj/item/attacking_obj, mob/user, params, silent, replace_spent) + . = ..() + + if(!ammo_set && istype(attacking_obj, /obj/item/ammo_casing)) + var/obj/item/ammo_casing/ammo_load = attacking_obj.type + ammo_type = ammo_load + ammo_set = TRUE + ammo_name = attacking_obj.name + update_max_ammo(attacking_obj) + to_chat(user, span_notice("You set the box to hold [attacking_obj]!")) + + if(istype(attacking_obj, /obj/item/pen)) + if(!user.is_literate()) + to_chat(user, span_notice("You scribble illegibly on the cover of [src]!")) + return + var/inputvalue = stripped_input(user, "What would you like to label the box?", "Box Labelling", "", MAX_NAME_LEN) + + if(!inputvalue) + return + + if(user.canUseTopic(src, BE_CLOSE)) + name = "[initial(src.name)][(inputvalue ? " - '[inputvalue]'" : null)]" + +/obj/item/ammo_box/generic/examine(mob/user) + . = ..() + . += span_notice("[ammo_set ? "It's set to hold [ammo_name]\s. The box can hold up to [max_ammo] rounds." : "It doesn't have an ammo type set. Use a bullet on the box to set it."]") + . += span_notice("You can use a pen on it to rename the box.") + diff --git a/code/modules/research/designs/autolathe_designs.dm b/code/modules/research/designs/autolathe_designs.dm index 7c43c3fc5acb..8a0c572015db 100644 --- a/code/modules/research/designs/autolathe_designs.dm +++ b/code/modules/research/designs/autolathe_designs.dm @@ -870,6 +870,22 @@ build_path = /obj/item/ammo_box/c556mmHITP/surplus category = list("initial", "Security", "Ammo") +/datum/design/generic_ammo_box + name = "Generic Ammo Box" + id = "ammo-generic" + build_type = AUTOLATHE | PROTOLATHE + materials = list(/datum/material/iron = 1500) + build_path = /obj/item/ammo_box/generic + category = list("initial", "Security", "Ammo") + +/datum/design/ammo_can + name = "Ammo Can" + id = "ammo-can" + build_type = AUTOLATHE | PROTOLATHE + materials = list(/datum/material/iron = 500) + build_path = /obj/item/storage/toolbox/ammo + category = list("initial", "Security", "Ammo") + /datum/design/cleaver name = "Butcher's Cleaver" id = "cleaver" diff --git a/icons/obj/ammo.dmi b/icons/obj/ammo.dmi index 4f2f029a96b7..6fac77253d60 100644 Binary files a/icons/obj/ammo.dmi and b/icons/obj/ammo.dmi differ diff --git a/shiptest.dme b/shiptest.dme index af3c472e4e6b..96e5da4f13d4 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -3006,6 +3006,7 @@ #include "code\modules\projectiles\ammunition\special\syringe.dm" #include "code\modules\projectiles\boxes_magazines\_box_magazine.dm" #include "code\modules\projectiles\boxes_magazines\ammo_boxes.dm" +#include "code\modules\projectiles\boxes_magazines\generic_ammo_box.dm" #include "code\modules\projectiles\boxes_magazines\external\gauss.dm" #include "code\modules\projectiles\boxes_magazines\external\grenade.dm" #include "code\modules\projectiles\boxes_magazines\external\lmg.dm"