Skip to content

Commit

Permalink
Empty Gun Helper (#2954)
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

Makes all the current var edited and manually typed spawnwithmag = false
guns to be done with a helper you can slap under any gun you need it for

<!-- 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

The defines are alot quicker to do if you need it for something not
mapped, for mapping, it might still be better to var-edit.
At some point im probably going to detach the spawned mag for valid mag
types which this will make easier to change. Why?

![image](https://github.com/shiptest-ss13/Shiptest/assets/86381784/876ae8d8-931c-46f1-b46c-8606013dea9d)
Not hating on retlaw. this was the only way to do it with how we have it
set up rn


<!-- 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:
refactor: spawning guns without mags are handled with a define
/: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. -->

---------

Signed-off-by: FalloutFalcon <[email protected]>
Co-authored-by: Sun-Soaked <[email protected]>
  • Loading branch information
FalloutFalcon and Sun-Soaked authored Jun 2, 2024
1 parent 24de872 commit f7fd03a
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
},
/area/overmap_encounter/planetoid/cave/explored)
"dX" = (
/obj/item/gun/ballistic/automatic/pistol{
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/pistol/no_mag,
/turf/open/floor/plating/asteroid/whitesands,
/area/overmap_encounter/planetoid/cave/explored)
"eg" = (
Expand Down
12 changes: 3 additions & 9 deletions _maps/RandomRuins/SpaceRuins/bigderelict1.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,7 @@
/turf/open/floor/plasteel,
/area/ruin/space/has_grav/derelictoutpost/powerstorage)
"bI" = (
/obj/item/gun/ballistic/automatic/pistol/candor{
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/pistol/candor/no_mag,
/turf/open/floor/plasteel,
/area/ruin/space/has_grav/derelictoutpost/powerstorage)
"bJ" = (
Expand Down Expand Up @@ -1333,9 +1331,7 @@
desc = "A thick gelatinous surface covers the floor. Someone get the golashes.";
name = "gelatinous floor"
},
/obj/item/gun/ballistic/automatic/pistol/candor{
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/pistol/candor/no_mag,
/obj/item/ammo_box/magazine/m45,
/turf/open/floor/plating/asteroid,
/area/ruin/space/has_grav/derelictoutpost)
Expand Down Expand Up @@ -1493,9 +1489,7 @@
/turf/open/floor/plating,
/area/ruin/space/has_grav/derelictoutpost)
"dJ" = (
/obj/item/gun/ballistic/automatic/pistol/candor{
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/pistol/candor/no_mag,
/obj/structure/alien/weeds{
color = "#4BAE56";
desc = "A thick gelatinous surface covers the floor. Someone get the golashes.";
Expand Down
4 changes: 1 addition & 3 deletions _maps/RandomRuins/SpaceRuins/ntfacility.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1619,9 +1619,7 @@
/turf/open/floor/plasteel/dark,
/area/ruin/powered)
"KJ" = (
/obj/item/gun/ballistic/revolver/detective{
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/revolver/detective/no_mag,
/obj/effect/decal/cleanable/blood,
/obj/effect/decal/cleanable/dirt,
/obj/effect/decal/cleanable/dirt/dust,
Expand Down
6 changes: 2 additions & 4 deletions _maps/shuttles/inteq/inteq_talos.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3417,14 +3417,12 @@
/obj/structure/sign/poster/retro/lasergun_new{
pixel_x = -32
},
/obj/item/gun/ballistic/shotgun/bulldog/inteq{
/obj/item/gun/ballistic/shotgun/bulldog/inteq/no_mag{
pixel_x = -8;
pixel_y = 8;
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/shotgun/bulldog/inteq{
/obj/item/gun/ballistic/shotgun/bulldog/inteq/no_mag{
pixel_x = -12;
spawnwithmagazine = 0
},
/turf/open/floor/plasteel/tech/grid,
/area/ship/security/armory)
Expand Down
3 changes: 1 addition & 2 deletions _maps/shuttles/inteq/inteq_vaquero.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,9 @@
/obj/item/ammo_box/magazine/co9mm{
pixel_x = -5
},
/obj/item/gun/ballistic/shotgun/bulldog/inteq{
/obj/item/gun/ballistic/shotgun/bulldog/inteq/no_mag{
pixel_x = -4;
pixel_y = 5;
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/pistol/commander/inteq,
/obj/item/gun/ballistic/automatic/pistol/commander/inteq{
Expand Down
24 changes: 8 additions & 16 deletions _maps/shuttles/syndicate/syndicate_twinkleshine.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -4672,8 +4672,7 @@
pixel_x = 6;
pixel_y = 1
},
/obj/item/gun/ballistic/automatic/sniper_rifle/syndicate{
spawnwithmagazine = 0;
/obj/item/gun/ballistic/automatic/sniper_rifle/syndicate/no_mag{
pixel_x = -3;
pixel_y = 6
},
Expand Down Expand Up @@ -5609,15 +5608,13 @@
/area/ship/security)
"Gm" = (
/obj/structure/rack,
/obj/item/gun/ballistic/automatic/ebr{
/obj/item/gun/ballistic/automatic/ebr/no_mag{
pixel_x = -16;
pixel_y = 7;
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/ebr{
/obj/item/gun/ballistic/automatic/ebr/no_mag{
pixel_x = -9;
pixel_y = 2;
spawnwithmagazine = 0
},
/obj/item/ammo_box/magazine/ebr{
pixel_x = 10;
Expand Down Expand Up @@ -7502,15 +7499,13 @@
/area/ship/hallway/aft)
"Rv" = (
/obj/structure/rack,
/obj/item/gun/ballistic/shotgun/bulldog{
/obj/item/gun/ballistic/shotgun/bulldog/no_mag{
pixel_x = -7;
pixel_y = 7;
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/shotgun/bulldog{
/obj/item/gun/ballistic/shotgun/bulldog/no_mag{
pixel_y = -3;
pixel_x = 2;
spawnwithmagazine = 0
},
/obj/machinery/light/directional/north,
/obj/item/ammo_box/magazine/m12g{
Expand Down Expand Up @@ -8841,19 +8836,16 @@
/area/ship/engineering/engine)
"YO" = (
/obj/structure/rack,
/obj/item/gun/ballistic/automatic/smg/c20r{
/obj/item/gun/ballistic/automatic/smg/c20r/no_mag{
pixel_x = 2;
pixel_y = 8;
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/smg/c20r{
/obj/item/gun/ballistic/automatic/smg/c20r/no_mag{
pixel_y = 3;
spawnwithmagazine = 0
},
/obj/item/gun/ballistic/automatic/smg/c20r{
/obj/item/gun/ballistic/automatic/smg/c20r/no_mag{
pixel_y = -2;
pixel_x = 3;
spawnwithmagazine = 0
},
/obj/item/ammo_box/magazine/smgm45,
/obj/item/ammo_box/magazine/smgm45,
Expand Down
5 changes: 5 additions & 0 deletions code/modules/projectiles/guns/ballistic.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#define EMPTY_GUN_HELPER(gun_type) \
/obj/item/gun/ballistic/##gun_type/no_mag { \
spawnwithmagazine = FALSE; \
}

///Subtype for any kind of ballistic gun
///This has a shitload of vars on it, and I'm sorry for that, but it does make making new subtypes really easy
/obj/item/gun/ballistic
Expand Down
4 changes: 4 additions & 0 deletions code/modules/projectiles/guns/ballistic/automatic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
can_suppress = TRUE
can_unsuppress = TRUE

EMPTY_GUN_HELPER(automatic/sniper_rifle/syndicate)

// Old Semi-Auto Rifle //

/obj/item/gun/ballistic/automatic/surplus
Expand Down Expand Up @@ -146,6 +148,8 @@
wield_slowdown = 2
spread = -4

EMPTY_GUN_HELPER(automatic/ebr)

/obj/item/gun/ballistic/automatic/gal
name = "\improper CM-GAL-S"
desc = "The standard issue DMR of CLIP. Dates back to the Xenofauna War, this particular model is in a carbine configuration, and, as such, is shorter than the standard model. Chambered in .308."
Expand Down
17 changes: 6 additions & 11 deletions code/modules/projectiles/guns/ballistic/pistol.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

muzzleflash_iconstate = "muzzle_flash_light"

/obj/item/gun/ballistic/automatic/pistol/no_mag
spawnwithmagazine = FALSE
EMPTY_GUN_HELPER(automatic/pistol)

/obj/item/gun/ballistic/automatic/pistol/suppressed/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -65,20 +64,18 @@
eject_empty_sound = 'sound/weapons/gun/pistol/candor_unload.ogg'
recoil = -2

/obj/item/gun/ballistic/automatic/pistol/candor/no_mag
spawnwithmagazine = FALSE
EMPTY_GUN_HELPER(automatic/pistol/candor)

/obj/item/gun/ballistic/automatic/pistol/candor/factory //also give this to the srm, their candors should probably look factory fresh from how well taken care of they are
desc = "A classic semi-automatic handgun, widely popular throughout the Frontier. An engraving on the slide marks it as a product of Hunter's Pride. This example has been kept in especially good shape, and may as well be fresh out of the workshop. Chambered in .45."
item_state = "hp_generic_fresh"

EMPTY_GUN_HELPER(automatic/pistol/candor/factory)

/obj/item/gun/ballistic/automatic/pistol/candor/factory/update_overlays()
. = ..()
. += "[initial(icon_state)]_factory"

/obj/item/gun/ballistic/automatic/pistol/candor/factory/no_mag
spawnwithmagazine = FALSE

/obj/item/gun/ballistic/automatic/pistol/candor/phenex
name = "\improper HP Phenex"
desc = "A uniquely modified version of the Candor, famously created by Hunter's Pride. Named after the daemonic Phoenix of legend that the Ashen Huntsman had once slain, this hell-kissed weapon is more visually intimidating than its original counterpart, but mechanically acts the same. Chambered in .45."
Expand Down Expand Up @@ -160,8 +157,7 @@
eject_sound = 'sound/weapons/gun/pistol/mag_release.ogg'
eject_empty_sound = 'sound/weapons/gun/pistol/mag_release.ogg'

/obj/item/gun/ballistic/automatic/pistol/commander/no_mag
spawnwithmagazine = FALSE
EMPTY_GUN_HELPER(automatic/pistol/commander)

/obj/item/gun/ballistic/automatic/pistol/commander/inteq
name = "\improper Commissioner"
Expand All @@ -170,8 +166,7 @@
item_state = "commander-inteq"
manufacturer = MANUFACTURER_INTEQ

/obj/item/gun/ballistic/automatic/pistol/commander/inteq/no_mag
spawnwithmagazine = FALSE
EMPTY_GUN_HELPER(automatic/pistol/commander/inteq)

/obj/item/gun/ballistic/automatic/pistol/commissar
name = "\improper Commissar"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/projectiles/guns/ballistic/revolver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
user.visible_message("<span class='notice'>[user] spins the [src] around their finger by the trigger. That’s pretty badass.</span>")
playsound(src, 'sound/items/handling/ammobox_pickup.ogg', 20, FALSE)
return

/obj/item/gun/ballistic/revolver/detective
name = "\improper HP Detective Special"
desc = "A small law enforcement firearm. Originally commissioned by Nanotrasen for their Private Investigation division, it has become extremely popular among independent civilians as a cheap, compact sidearm. Uses .38 Special rounds."
Expand All @@ -486,6 +487,8 @@

recoil = 0 //weaker than normal revolver, no recoil

EMPTY_GUN_HELPER(revolver/detective)

/obj/item/gun/ballistic/revolver/detective/ComponentInitialize()
. = ..()
AddComponent(/datum/component/ammo_hud/revolver) //note that the hud at the moment only supports 6 round revolvers, 7 or 5 isn't supported rn
Expand Down
4 changes: 4 additions & 0 deletions code/modules/projectiles/guns/ballistic/shotgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
wield_slowdown = 0.6
wield_delay = 0.65 SECONDS

EMPTY_GUN_HELPER(shotgun/bulldog)

/obj/item/gun/ballistic/shotgun/bulldog/inteq
name = "\improper Mastiff Shotgun"
desc = "A variation of the Bulldog, seized from Syndicate armories by deserting troopers then modified to IRMG's standards."
Expand All @@ -240,6 +242,8 @@
mag_type = /obj/item/ammo_box/magazine/m12g
manufacturer = MANUFACTURER_INTEQ

EMPTY_GUN_HELPER(shotgun/bulldog/inteq)

/obj/item/gun/ballistic/shotgun/bulldog/suns
name = "\improper Bulldog-C Shotgun"
desc = "A variation of the Bulldog manufactured by Scarborough Arms for SUNS. Its shorter barrel is intended to provide additional maneuverability in personal defense scenarios."
Expand Down
7 changes: 4 additions & 3 deletions code/modules/projectiles/guns/ballistic/smg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
empty_indicator = TRUE
manufacturer = MANUFACTURER_SCARBOROUGH

EMPTY_GUN_HELPER(automatic/smg/c20r)

/obj/item/gun/ballistic/automatic/smg/c20r/ComponentInitialize()
. = ..()
AddComponent(/datum/component/automatic_fire, 0.13 SECONDS)
Expand Down Expand Up @@ -251,13 +253,12 @@
fire_sound = 'sound/weapons/gun/smg/smg_heavy.ogg'
manufacturer = MANUFACTURER_MINUTEMAN

EMPTY_GUN_HELPER(automatic/smg/cm5)

/obj/item/gun/ballistic/automatic/smg/cm5/ComponentInitialize()
. = ..()
AddComponent(/datum/component/automatic_fire, 0.13 SECONDS)

/obj/item/gun/ballistic/automatic/smg/cm5/no_mag
spawnwithmagazine = FALSE

/obj/item/gun/ballistic/automatic/smg/cm5/compact
name = "\improper CM-5c"
desc = "The compact conversion of the CM-5. While not exactly restricted, it is looked down upon due to CLIP's doctrine on medium-longrange combat, however it excels at close range and is very lightweight. You feel like this gun is mildly unfinished. Chambered in 9mm."
Expand Down

0 comments on commit f7fd03a

Please sign in to comment.