The way AttachedWeaponDefinitions in media/lua/shared/Definitions/ are implemented is suboptimal, because instead of adding to the Definitions, they are simply redefined.
This is not good for multiple reasons
vanilla updates to are overwritten, meaning you technically would have to re-check those on every update to be sure your mod does not cause any issues like for example items that got added to the default definitions not spawning in.
mods that load prior to your mod and add to vanilla definitions in a non intrusive way get removed, e.g. if some mod adds some entries into weapons of handgunHolster your mod will undo that.
The only change over vanilla are additional entries in outfit , yet the entire handgunHolster entry is redefined.
It would be more sensible for forward compatibility (pz-updates) and mod interoperability to do something like the following (I did not specifically test this, just quickly written it down for exemplary reasons)
Yeah this is the one file I need to clean house on. I have not rewritten the file in nearly a year, so it uses outdated and overwriting methods that I am not using anymore. I will resolve this soon.
The way AttachedWeaponDefinitions in
media/lua/shared/Definitions/
are implemented is suboptimal, because instead of adding to the Definitions, they are simply redefined.This is not good for multiple reasons
weapons
ofhandgunHolster
your mod will undo that.For Example:
Vanilla
Your Version https://github.com/AuthenticPeach/AuthenticZ/blob/e195d07c10dcf5fc98eca726a786f2baaa97f06f/Contents/mods/Authentic%20Z%20-%20Current/media/lua/shared/Definitions/xAuthenticZ_AttachedWeaponDefinitions.lua#L271-L288
The only change over vanilla are additional entries in
outfit
, yet the entirehandgunHolster
entry is redefined.It would be more sensible for forward compatibility (pz-updates) and mod interoperability to do something like the following (I did not specifically test this, just quickly written it down for exemplary reasons)
This is also loosely mentioned in the Zomboid Modding Guide https://github.com/FWolfe/Zomboid-Modding-Guide/blob/master/api/README.md#overwriting-vanilla-code (while that guide mostly talks about functions in the broader sense, this applies to lua tables as well)
I could also prepare a pull request, if desired.