Magazine API

If you liked this item, please rate it up on Steam Workshop page.

Author: N0wh3re

Last revision: 15 Mar, 2025 at 05:19 UTC

File size: 163.26 KB

On Steam Workshop

Description:
If you want buy me a coffee? then hit the UP & Favorite button instead giving me some dollars. I can buy coffee myself 😀

(or some steam points.. I want to buy new profile wallpapers..)


Description

This mod does not add any weapons or magazines.

This mod allows other modders to use multiple magazine types on the same firearm.
For example, an AK with a 30-round mag AND 95-round RPK drum mag.

>>Example Mod (Vanilla Firearm Magazine Expansion)<<

Main Feature
  • For modder: Single line per a weapon. simple.
  • Tooltip will be automatically generated by API. You can see that in the screenshot. will be fancy in the future tho.
  • Best Magazine will always be "magazine that has highest ammo count" no matter magazine types.
  • Also, when you are inserting bullets in your spare magazine, mod try to insert bullet into where the Best Magazine is.
  • When you are inserting bullets, If you don’t have any bullets for Best Magazine, mod will try to find next magazine type.
  • Regarding above, you can use multiple type of ammo for single firearm. (for now, single type per single magazine however will be changed.)
  • When there’s no ammo in all of your magazines, magazine which has highest Max Capacity will be the best magazine.
  • If you want to change your magazine manually, not automatically selected magazine, right-click your weapon and find "select magazine" menu

How To Use
  • MagAPI.defineParam(weapon, mag1, mag2, … mag99, mag100) — This is all you have to do.

Example

require = "MagAPI" MagAPI.defineParam("Base.AssaultRifle", "Base.9mmClip", "Base.556Clip", "Base.M14Clip", "Base.44Clip")

If you need more detailed description, check the pinned discussion.

Stability & Compatibility & Performance

It’s pretty stable as I believe, but I’m not sure about performance when there are many magazine types.
I believe it will be okay too, but anyway, this is why I’m saying this is in testing.

About Compatibility, since weapon mods does not allow to use more than one weapon mod, it will be okay.
Also, you can fix & edit my code freely unless you are gonna set this mod as required of your mod.

About MP
I will try when B42 MP is out, but honestly, I have not played MP in the last 11 years of PZ.
So I’m not sure.

Future?

Known Issue

Tooltip will show correct maxAmmo and currentAmmo, However, name of magazine will not be changed.


This is my first API mod and also my first medium-sized mod, so anything bad can happen.
I wrote this code in 6 hours, but the idea came 1-2 months ago.

If you are a developer, You CAN DO ANYTHING you want to implemented by copy&paste my files. You can include files into your mod directly to overwrite API, any actions, any codes. however, you should set this API as requirement.