Skip to content

Commit

Permalink
smarter allowed ammo types (#3429)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
deal with cell sizes, snowflaked gun inits for diffrent mags and evil
subtypes
a basic unit test to make sure it works
you can now pass a arg to empty a guns, ammo boxes, and cells in new so
we don't need 8 billion sub types for that.
using that, gun cases now are easier to make and have a sub type which
grabs guns from the tile its on for mappers.

cool regex if stuff conflict merges
cell_type = (\/[\w\/]+)    or    mag_type = (\/[\w\/]+)
default_ammo_type = $1\n\tallowed_ammo_types = list(\n\t\t$1,\n\t)

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
fix: ammo
refactor: refactored ammo types to not be snowflaked when handling
spawning subtyped guns
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
FalloutFalcon authored Oct 22, 2024
1 parent ba953a2 commit 8c635bd
Show file tree
Hide file tree
Showing 54 changed files with 856 additions and 538 deletions.
2 changes: 1 addition & 1 deletion _maps/RandomRuins/IceRuins/icemoon_ice_lodge.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@
projectile_type = null
},
/obj/item/gun/ballistic/automatic/smg/firestorm{
spawnwithmagazine = 0
default_ammo_type = 0
},
/turf/open/floor/wood/maple{
icon_state = "wood-broken4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@
/area/ruin/unpowered/listening_post)
"te" = (
/obj/item/gun/ballistic/automatic/smg/cobra{
spawnwithmagazine = 0
default_ammo_type = 0
},
/obj/item/ammo_box/magazine/m45_cobra{
start_empty = 1
Expand Down
4 changes: 2 additions & 2 deletions _maps/shuttles/independent/independent_kilo.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@
},
/obj/item/storage/box/ammo/a12g_rubbershot,
/obj/item/gun/ballistic/shotgun/doublebarrel/presawn{
spawnwithmagazine = 0
default_ammo_type = 0
},
/obj/structure/cable/pink{
icon_state = "4-10"
Expand Down Expand Up @@ -1876,7 +1876,7 @@
},
/obj/effect/decal/cleanable/oil,
/obj/item/storage/box/ammo/a12g_buckshot,
/obj/item/gun/ballistic/shotgun/doublebarrel/no_mag,
/obj/item/gun/ballistic/shotgun/doublebarrel/empty,
/turf/open/floor/plasteel/patterned,
/area/ship/cargo)
"Vd" = (
Expand Down
48 changes: 21 additions & 27 deletions _maps/shuttles/inteq/inteq_talos.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5309,12 +5309,21 @@
/obj/structure/sign/poster/retro/lasergun_new{
pixel_x = -32
},
/obj/item/gun/ballistic/shotgun/automatic/bulldog/inteq/no_mag{
pixel_x = -8;
pixel_y = 8
/obj/item/storage/guncase/inherit{
pixel_x = 2;
pixel_y = -2
},
/obj/item/gun/ballistic/shotgun/automatic/bulldog/inteq/no_mag{
pixel_x = -12
/obj/item/gun/ballistic/shotgun/automatic/bulldog/inteq/no_mag,
/obj/item/ammo_box/magazine/m12g_bulldog,
/obj/item/ammo_box/magazine/m12g_bulldog,
/obj/item/storage/guncase/inherit{
pixel_y = 2;
pixel_x = -2
},
/obj/item/gun/ballistic/shotgun/automatic/bulldog/inteq/no_mag,
/obj/item/ammo_box/magazine/m12g_bulldog,
/obj/item/ammo_box/magazine/m12g_bulldog{
pixel_y = -1
},
/turf/open/floor/plasteel/tech/grid,
/area/ship/security/armory)
Expand Down Expand Up @@ -6534,25 +6543,9 @@
/obj/structure/sign/poster/official/ion_carbine{
pixel_x = -32
},
/obj/item/ammo_box/magazine/m12g_bulldog{
pixel_x = 5;
pixel_y = 5
},
/obj/item/ammo_box/magazine/m12g_bulldog{
pixel_x = 5;
pixel_y = 5
},
/obj/item/ammo_box/magazine/m12g_bulldog{
pixel_x = -5
},
/obj/item/ammo_box/magazine/m12g_bulldog{
pixel_x = -5
},
/obj/item/ammo_box/magazine/co9mm{
pixel_x = 5
},
/obj/item/ammo_box/magazine/co9mm{
pixel_x = -5
/obj/item/toy/plush/moth/deadhead{
pixel_x = 3;
pixel_y = 3
},
/turf/open/floor/plasteel/tech/grid,
/area/ship/security/armory)
Expand Down Expand Up @@ -7415,9 +7408,10 @@
/obj/structure/rack,
/obj/effect/turf_decal/siding/thinplating/dark,
/obj/effect/decal/cleanable/dirt,
/obj/item/gun/ballistic/automatic/pistol/commander/inteq{
pixel_y = 5
},
/obj/item/storage/guncase/pistol/inherit,
/obj/item/gun/ballistic/automatic/pistol/commander/inteq,
/obj/item/ammo_box/magazine/co9mm,
/obj/item/ammo_box/magazine/co9mm,
/turf/open/floor/plasteel/tech/grid,
/area/ship/security/armory)
"Wr" = (
Expand Down
6 changes: 3 additions & 3 deletions _maps/shuttles/minutemen/minutemen_atlas.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
name = "captain's locker";
req_access_txt = "20"
},
/obj/item/storage/pistolcase/cm23,
/obj/item/storage/guncase/pistol/cm23,
/obj/item/clothing/suit/armor/clip_capcoat{
pixel_x = -14
},
Expand Down Expand Up @@ -746,7 +746,7 @@
name = "first officer's locker";
req_access_txt = "19"
},
/obj/item/storage/pistolcase/cm23{
/obj/item/storage/guncase/pistol/cm23{
pixel_y = -4
},
/obj/item/clothing/head/clip/slouch/officer{
Expand Down Expand Up @@ -1165,7 +1165,7 @@
/obj/machinery/airalarm/directional/north,
/obj/structure/guncloset,
/obj/item/gun/ballistic/automatic/assault/cm82{
spawnwithmagazine = 0;
default_ammo_type = 0;
pixel_x = -4;
pixel_y = 8
},
Expand Down
8 changes: 4 additions & 4 deletions _maps/shuttles/nanotrasen/nanotrasen_ranger.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
/obj/item/gps,
/obj/item/ammo_box/magazine/co9mm,
/obj/item/storage/belt/security/webbing,
/obj/item/storage/pistolcase/commander,
/obj/item/storage/guncase/pistol/commander,
/obj/item/clothing/glasses/hud/security/sunglasses,
/obj/structure/window/reinforced/tinted{
dir = 4
Expand Down Expand Up @@ -4187,7 +4187,7 @@
pixel_x = 7;
pixel_y = -20
},
/obj/item/storage/pistolcase/egun,
/obj/item/storage/guncase/energy/egun,
/obj/item/megaphone/command,
/obj/structure/closet/secure_closet/lp/lieutenant,
/obj/effect/turf_decal/techfloor{
Expand Down Expand Up @@ -6250,14 +6250,14 @@
name = "Armory";
req_ship_access = 1
},
/obj/item/storage/pistolcase/commander,
/obj/item/storage/guncase/pistol/commander,
/obj/item/ammo_box/magazine/co9mm,
/obj/item/clothing/suit/armor/nanotrasen/slim,
/obj/item/clothing/suit/armor/nanotrasen/slim,
/obj/item/ammo_box/magazine/smgm9mm,
/obj/item/ammo_box/magazine/smgm9mm,
/obj/item/ammo_box/magazine/smgm9mm,
/obj/item/storage/pistolcase,
/obj/item/storage/guncase/pistol,
/obj/effect/turf_decal/steeldecal/steel_decals10{
dir = 5
},
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/roumain/srm_elder.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@
},
/obj/item/storage/backpack/satchel/leather,
/obj/item/storage/box/ammo/a44roum,
/obj/item/storage/pistolcase/montagne,
/obj/item/storage/guncase/pistol/montagne,
/obj/item/clothing/accessory/waistcoat/roumain,
/turf/open/floor/wood/mahogany,
/area/ship/bridge)
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/solgov/solgov_chronicle.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
/obj/item/clothing/suit/armor/solgov_trenchcoat,
/obj/item/spacecash/bundle/loadsamoney,
/obj/item/clothing/neck/cloak/solgovcap,
/obj/item/storage/pistolcase/modelh,
/obj/item/storage/guncase/pistol/modelh,
/obj/item/storage/box/ammo/ferroslug,
/turf/open/floor/carpet/royalblue,
/area/ship/crew/office)
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/solgov/solgov_inkwell.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5933,7 +5933,7 @@
/obj/item/fish_feed,
/obj/item/pen/fountain/solgov,
/obj/item/clothing/neck/cloak/solgovcap,
/obj/item/storage/pistolcase/modelh,
/obj/item/storage/guncase/pistol/modelh,
/obj/item/storage/box/ammo/ferroslug,
/turf/open/floor/wood/maple,
/area/ship/crew/dorm/dormtwo)
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/solgov/solgov_paracelsus.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3581,7 +3581,7 @@
/obj/item/fish_feed,
/obj/item/pen/fountain/solgov,
/obj/item/clothing/neck/cloak/solgovcap,
/obj/item/storage/pistolcase/modelh,
/obj/item/storage/guncase/pistol/modelh,
/obj/item/storage/box/ammo/ferroslug,
/turf/open/floor/carpet/royalblue,
/area/ship/crew)
Expand Down
4 changes: 2 additions & 2 deletions _maps/shuttles/syndicate/syndicate_gorlex_hyena.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
/obj/effect/decal/cleanable/dirt/dust,
/obj/item/ammo_box/a357/match,
/obj/item/pen/edagger,
/obj/item/storage/pistolcase/a357,
/obj/item/storage/guncase/pistol/a357,
/obj/item/storage/box/ammo/a357,
/turf/open/floor/carpet/black,
/area/ship/bridge)
Expand Down Expand Up @@ -2504,7 +2504,7 @@
/obj/item/clothing/suit/ngr,
/obj/item/clothing/head/hardhat/ngr/foreman,
/obj/item/tank/jetpack/suit,
/obj/item/storage/pistolcase/ringneck,
/obj/item/storage/guncase/pistol/ringneck,
/turf/open/floor/carpet/red,
/area/ship/cargo/office)
"QW" = (
Expand Down
6 changes: 3 additions & 3 deletions _maps/shuttles/syndicate/syndicate_twinkleshine.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@
/obj/item/codespeak_manual{
charges = 2
},
/obj/item/storage/pistolcase/a357,
/obj/item/storage/guncase/pistol/a357,
/obj/item/megaphone/sec{
name = "syndicate megaphone"
},
Expand Down Expand Up @@ -7375,7 +7375,7 @@
keyslot = null
},
/obj/item/storage/belt/sabre/solgov,
/obj/item/storage/pistolcase/modelh,
/obj/item/storage/guncase/pistol/modelh,
/obj/item/storage/box/ammo/ferroslug,
/turf/open/floor/mineral/plastitanium,
/area/ship/bridge)
Expand Down Expand Up @@ -8865,7 +8865,7 @@
/obj/item/megaphone/sec{
name = "syndicate megaphone"
},
/obj/item/storage/pistolcase/ringneck,
/obj/item/storage/guncase/pistol/ringneck,
/obj/item/clothing/head/HoS/beret/syndicate,
/obj/item/radio/headset/syndicate/alt/leader,
/obj/item/clothing/gloves/krav_maga/combatglovesplus,
Expand Down
2 changes: 1 addition & 1 deletion check_regex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ standards:
- exactly: [1, "/area text paths", '"/area']
- exactly: [16, "/datum text paths", '"/datum']
- exactly: [4, "/mob text paths", '"/mob']
- exactly: [35, "/obj text paths", '"/obj']
- exactly: [33, "/obj text paths", '"/obj']
- exactly: [0, "/turf text paths", '"/turf']
- exactly: [114, "text2path uses", "text2path"]

Expand Down
4 changes: 0 additions & 4 deletions code/__DEFINES/guns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@
///ammo box will have a different state for full and empty; <icon_state>-max_ammo and <icon_state>-0
#define AMMO_BOX_FULL_EMPTY 2

#define MAG_SIZE_SMALL 1
#define MAG_SIZE_MEDIUM 2
#define MAG_SIZE_LARGE 3

//Projectile Reflect
#define REFLECT_NORMAL (1<<0)
#define REFLECT_FAKEPROJECTILE (1<<1)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/porta_turret/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ DEFINE_BITFIELD(turret_flags, list(

/obj/item/gun/ballistic/get_turret_properties()
. = ..()
var/obj/item/ammo_box/mag = mag_type
var/obj/item/ammo_box/mag = default_ammo_type
var/obj/item/ammo_casing/primary_ammo = initial(mag.ammo_type)

.["base_icon_state"] = "syndie"
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/suit_storage_unit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@
else if(istype(AM, /obj/item/mod/control) && !storage)
AM.forceMove(src)
mod = AM
else if(istype(AM, /obj/item) && !storage)
else if(istype(AM, /obj/item) && !AM.anchored && !storage)
AM.forceMove(src)
storage = AM
update_appearance()
Expand Down
Loading

0 comments on commit 8c635bd

Please sign in to comment.