Garry's Mod

Garry's Mod

319 ratings
Simple Magazine System
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Effects
Addon Tags: Fun, Realism
File Size
Posted
4.952 MB
12 Sep @ 9:25pm
2 Change Notes ( view )

Subscribe to download
Simple Magazine System

Description
--SIMPLE MAGAZINE SYSTEM: Magazine Cache System & HUD--

This is an adjustment the vanilla reload mechanic.

**YOU HAVE TO MANUALLY PREVENT ROUNDS-RELOAD WEAPONS FROM USING THE SYSTEM VIA "MAG_BLACKLIST_ADD" CVAR WITH THE WEAPON EQUIPPED**.

Instead of reloading from a reserve that vacuums up ammo and fills in your gun, reloading removes all ammo from the weapon and stores the remainder in a partial magazine. When you don't have any more full magazines, you will begin reloading from these partial magazines, starting with the highest capacity one.

This comes with a new HUD for displaying ammo, which displays all the magazines as progress bars. There's also a keybind that displays the current ammo in the equipped weapon. Weapons that do not use magazines have a different HUD that shows the individual rounds as stacked tick marks. Also, alt ammo is displayed in a new HUD element that displays ammo as ticks.

It seems to me that this is like the bare minimum that any fps game should have as far as reloading/ammo mechanics. Yet the vacuum reload remains the standard.

USAGE TIPS:
-Use the mag_blacklist_add to instantly prevent the equipped weapon from using the mag system. Weapons with 1 bullet capacity (or weapons that don't reload) are automatically excluded, but 'rounds reload' style weapons have to be manually toggled. Mag_blacklist_remove will remove your current weapon from the blacklist.
-Bind either +CheckReload (to your reload key) or +mag_checkammo to see ammo remaining in your weapon.
-mag_set_limit will set limits for non-vanilla ammo types of the current equipped weapon - you should set it to the same limit that whatever mod you have uses. Vanilla ammo types will reference 'sk_max...' cvars, so edit those if your target weapon uses vanilla ammo.
-There is a config file (GarrysMod/garrysmod/data/mag_system/config.json) that stores blacklisted weapons and ammo limits. You can edit it directly or use console commands. You may have to switch weapons or use magconfig_reload to get the config to refresh.
-Check out the console commands - there is a lot to customize. For example, you can dump mags instead of saving them, or enable '1 in the chamber' reloads.
-The mod will save your current cached magazines when you quit, and restore them on load. Magsave and magload console commands let you use specific named cache loadouts. If you're saving/loading games, unfortunately Lua data is not written to save files -- you can manually save and load mag loadouts through the console.
-This was designed to be compatible with multiplayer, but not tested.

This is intended to have a light touch and be compatible, so there are some limitations:
-Weapons that use the same ammo type will share ammo, but once you reload, that magazine is committed to the current weapon.
-If your ammo limit is not an even multiple of you weapon's max capacity, you will have 1 mag that you won't be able to fill all the way. This mod references sk_max cvars (i.e. sk_max_smg1) for ammo limits, so you can set those to even multiples of your choosing to neatly correspond to your chosen weapon.
-SWEPs with 'chambered' rounds - like where you reload a weapon and keep 1 in the chamber. I implemented my own version of this, along with overrides for MW Base, ArcCW, and TFA. Some other weapons get a little weird and it's possible a SWEP implements this in its own atypical way, meaning it won't function exactly as intended.
-Be wary of extended mag attachments and anything that messes with ammo capacity. I think they will work, but depending how they're implemented, there might be issues. Or if you switch magazine capacity while you have some active magazines, things could get a little weird.


Console:

📘MAGAZINE CACHE SYSTEM & HUD

[Server Console Variables:]

mag_blacklist_add — Add current weapon to blacklist. (admin-only)
mag_blacklist_remove — Remove current weapon from blacklist. (admin-only)
mag_set_limit <n> — Set ammo limit for current weapon’s ammo type (non-vanilla ammo). (admin-only)
mag_dump_on_reload 0/1 — Instead of storing removed partial mags, removes them entirely (think Helldivers 2). Removes all stored mags for all weapons once you reload.
mag_chamber_enabled 0/1 - If 1, reloading from non-empty will leave one round in the chamber, and 1 less in the stored magazine.
mag_clear_on_death 0/1 — If 1, clear cached magazines on player death. (saved to JSON)
mag_load_reserve_ammo 0/1 — If 1, save and restore reserve ammo (in addition to magazines) in cache saves.
sk_max... - Garry's Mod's values for sk_max are used by this mod for vanilla ammo types.


[Console Commands:]

mag_clearmags — Remove all stored mags from the player.

Cache save/load:
magsave <name> — Save current mags to a named file.
magload <name> — Load named cache, and ammo if you have the cvar active. (admin-only)
magconfig_reload — Reload config from disk and broadcast to clients. (admin-only)

Debug ammo/mags:
mag_ammo <n> — Give current weapon reserve -non-magazine- ammo. (admin-only)
mag_setammo <n> — Set reserve ammo count. (admin-only)
mag_setclip <n> — Set current weapon clip. (admin-only)
mag_mag <n> — Add a cached mag of n rounds for current weapon. (admin-only)
mag_weaponclass — Print current weapon class to console.
mag_ammoclass — Print current weapon’s primary ammo class/ID.
mag_PruneMags — Remove excess cached mags beyond config limits. Mod should do so automatically but just in case.


[HUD offsets/colors:]

Magazine HUD:
maghud_mag_x <n> / maghud_mag_y <n> — Magazine HUD offsets from bottom-right.
maghud_mag_barw <n> / maghud_mag_barh <n> — Mag bar dimensions.
maghud_mag_header <n> — Height of “AMMO” header.
maghud_displaymax <n> — Maximum number of mags that will be displayed, regardless of how much ammo you actually have.

Non-mag HUD (for weapons that don't use mags):
maghud_res_x <n> / maghud_res_y <n> — HUD offsets.
maghud_res_bulletw <n> / — maghud_res_bulleth <n> — bullet/tick dimensions.

Secondary Ammo HUD:
maghud_sec_x <n> / maghud_sec_y <n> — Secondary/alt ammo HUD offsets.

Colors:
maghud_color_r/maghud_color_g/maghud_color_b/maghud_color_a — HUD color (RGB, Alpha).

Other:
maghud_hide_ammo 0/1 — Hide vanilla HL2 ammo HUD (1 = hide).

📘AMMO CHECKING SYSTEM & HUD

[Keybinds:]

+CheckReload — dual-purpose keybind: tap = reload, hold = ammo check. Rebind +reload if you uninstall.
+mag_checkammo — keybind strictly for ammo check HUD, will not trigger a reload on tap.

[Console Variables:]

Reload:
mag_ammocheck_rholdthreshold <n> — Max tap time to count as reload. Otherwise will be considered a hold.

Black fade / background:
mag_ammocheck_bgfadestart <n> — Delay before fade begins.
mag_ammocheck_bgfadein <n> — Fade-in speed of background.
mag_ammocheck__bgfadeout <n> — Fade-out time of background.
mag_ammocheck_bgmaxalpha <n> — Max opacity of background overlay.
mag_ammocheck_barfadespeed <n> — Alpha per second for bar fade.

Blur background:
mag_ammocheck_blurstrength <n> — Max blur strength.
mag_ammocheck_blurpasses <n> — Number of blur passes.

Ammo bar/text:
mag_ammocheck_bardelay <n> — Delay before bar appears.
mag_ammocheck_barwidth <n> — Bar width.
mag_ammocheck_barheight <n> — Bar height.
mag_ammocheck_baroffsety <n> — Vertical offset below center.
mag_ammocheck_textoffsety <n> — Text vertical offset.
mag_ammocheck_textoffsetx <n> — Text horizontal offset.
mag_ammocheck_colorr <n> — Ammo bar color R.
mag_ammocheck_colorg <n> — Ammo bar color G.
mag_ammocheck_colorb <n> — Ammo bar color B.

Capacity warning color:
mag_ammocheck_dangerratio <n> — Clip ratio threshold for danger color.
mag_ammocheck_cautionratio <n> — Clip ratio threshold for caution color.



Ammo check sound effect courtesy of fesliyanstudios.com
Popular Discussions View All (2)
5
29 Sep @ 9:27pm
Bug Reports
shwowsh
37 Comments
Ganz 24 Sep @ 6:05pm 
Please add a feature where the HUD appears while reloading the weapon and disappears after a specified amount of time.
STΛRBIRD (SHE/HER) 23 Sep @ 3:04pm 
капля поноса, are you reloading when the weapon is not fully depleted? if so, that's because arc9 is adding one extra round to your total count to simulate an unfired cartridge in the chamber of the gun. This is intended and this is how it works in real life.
капля поноса 23 Sep @ 12:32pm 
i wanted to write a whole essay about a bug with ARC9 and i almost understood why its happening but then i found out i was wrong. idk why theres an extra round in mag sometimes. wish that would get fixed.
LenZi 22 Sep @ 10:33pm 
And I already disabled the ammo limiter I got just to check if it was conflicting. It was just your mod.
LenZi 22 Sep @ 10:30pm 
Really wish that it didnt limit ammo. I already got a mod for that. Your mod limits my pulse rifle ammo to 60 and your console commands listed for limiting ammo aren't working.
hery75us 22 Sep @ 4:29pm 
Link freeman thats the canals
Yoda 22 Sep @ 10:42am 
how do i reset it to default? i dont see it now
Whaddafrak 22 Sep @ 9:29am 
really cool, i feel like the HUD should be more customizable and the mod should have a config menu in spawnmenu though, the amount of console commands is difficult to keep track of
Link Freeman 22 Sep @ 9:01am 
is that....some kind of maps based on HL2 Beta or I wasnt paying enough attention? because I swear there was one screenshot of the map somewhere, and it was similar in location to this.
Rukrio 22 Sep @ 6:19am 
shit like this is why i want more 'weird'/niche mods. you really can turn GMod into anything.