Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[CLOSED PR] Guns with firemodes and list-based ammo
#1
Thumbs Down 
PULL REQUEST DETAILS




About the PR
This changes guns to define their own firing modes, and ammo to be more modular.

Ammunition now holds a list of initialized projectiles, which guns read and fire one after another. This list can be customized with multiple different kinds of (compatible) ammunition, such as loading both lethal and stun rounds into a revolver.

Ammunition also comes in five forms: Piles, clips, magazines, boxes, and batteries.

- Piles are loose collections of initialized projectiles intended to be loaded into something. Typically, piles can accept any kind of ammunition, and be merged or split off into separate piles. Use the pile in-hand to pick which projectile to try to load, though if for any reason that projectile won't work, it'll try to load something that will work. They can load magazines and clips one at a time, and load everything that'll fit into boxes.
- Clips are bound-together groups of compatible bullets, intended to be loaded into internal magazines, like revolvers and shotguns. While they are easy to unload, able to move all of its contents into a new pile or valid gun instantly, loading them is done one at a time, and only from piles.
- Magazines are (typically) detachable containers of bullets designed to be quickly loaded and swapped out from certain guns. While swapping out magazines from a gun is quick and easy, loading them with bullets is done one at a time. Some magazines are fixed into the gun and unable to be removed; these can be reloaded with clips and piles, usually.
- Boxes are basically just high-capacity magazines that can be loaded with piles of bullets quickly, like minigun and lmg belts. This is mainly so you don't have to click a hundred times to load an LMG belt, so Im probably just going to axe it and replace it with a quick_to_load_piles var.
- Batteries, which are batteries for energy weapons. While technically all things in /obj/item/ammo can hold charge, these are explicitly(ish) for energy weapons, as they (typically) don't have anything in their projectile-magazine thing.

Guns no longer (entirely) rely on their projectile to set how it fires, (mostly) only *what* it fires. Now, guns can define how many times to shoot per click, how long to wait between each shot / click, what range of angles to shoot them, and (if set) what projectile to shoot. There can also be multiple firemodes, cycled through by clicking on the gun.

Guns can also be unloaded by clicking on them with a free hand, or clickdragging it to a turf. Mainly so you can actually unload two-handed guns.

Every(ish) projectile has a couple new vars associated with them: ammo_ID, ammo_name, and ammo_name_plural. These are used by magazines to form a more concise and player-readable list of what's in the magazine, and allow just about any projectile to be loaded into anything that'll hold it without looking like something broke.

Calibers are all now defines, and also added to projectiles. Because heck remembering what 1.72 means.

Also art guns get 1-3 randomized firemodes, including randomized burst counts, fire rates, and such. Its a disco vomit nightmare.

--

Its far from finished, or even anything resembling finished. For instance:
- Anything involving ammo doesn't make noise
- Zipguns and miniguns have massive capacities for testing
- Stun batons and mining tools are hackilly hacked into working with the new system
- The manifest update proc is not used, instead just rebuilding the whole list whenever called
- Casings aren't ejected properly from non-autoeject weapons
- Guns wont fire if you click on a tile within reach (that's handled by attack and not pixelaction I guess?)
- Piles use a default image and name no matter what's in it
- Speedloaders and such look like their base item even if loaded with other things
- Artguns runtime when spawned, but still (allegedly) work
- Bullets can't be silvered... yet
- Customized .22 mags have been commented out (until I figure out what to do with em)
- Dropping a gun while its in the middle of shooting makes you keep emitting bullets until its done
and a heckload more things I'm probably not thinking of.

Some planned things:
- Actionbars for loading things, looping for loading magazines maybe?
- Casings that get thrown out of the gun instead of just falling on the ground
- Transferring charge from one battery to another by smacking them together.
- Limiting the size of piles, either with hard limits, or making the pile larger as it grows
- Make revolvers have a revolving magazine list thing, and rework the russian revolver to work like that
- Differentiate boxes full of bullets from piles so the box doesnt get eaten when empty
- Move magazine swapping and loading and such to a component so batons and picks can use it without hax

Also, some pics!

[Image: 99744162-0275e180-2a8c-11eb-88c3-f6677ca54e44.png]
[Image: 99744179-099cef80-2a8c-11eb-958c-e962a377ab85.png]
https://www.youtube.com/watch?v=oVT-3L-CUkQ

Changelog


Code:
changelog
(u)Superlagg:
(*)Ammunition can now be unloaded into piles of bullets and loaded back in any order.
(*)Guns can hold multiple different types of ammunition at the same time.


PULL REQUEST DETAILS
Reply
#2
I mean that video was pretty funny and I loved it but I'd have to see this working in a normal round first to see if this was a good idea, maybe a syndie round or admin shenanigans round with a bunch of guns and ammo spawned.
Reply
#3
This is something ive wanted for a while, But as kiki said, it should be tested inround on a nukie/admin shenaigans round, so that people can get used to the new pew pew system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)