Replacing the code with this should catch all weapons categorized as pistols automatically
This should include custom pistols, but not tested
A system is included to force-add the Judge (and akimbo variant), which is not categorized as a pistol
local INCLUDE_JUDGE = truelocalfunctiontry_insert(v, e)ifnottable.contains(v, e) thentable.insert(v, e)
endend
Hooks:PostHook( WeaponFactoryTweakData, "_add_charms_to_all_weapons", "pc__add_charms_to_all_weapons", function(self, tweak_data)local force_include
ifnot INCLUDE_JUDGE then
force_include = {}
else
force_include = table.list_to_set({
"judge",
})
for id, x_id inpairs(tweak_data.weapon_akimbo_mappings) do
force_include[x_id] = force_include[id]
endendfor _, data inpairs(tweak_data.upgrades.definitions) dolocal weapon = tweak_data.weapon[data.weapon_id]
local factory = self[data.factory_id]
if force_include[data.weapon_id] or weapon and weapon.categories andtable.contains(weapon.categories, "pistol") thenif factory and factory.uses_parts then
try_insert(factory.uses_parts, "wpn_fps_upg_bonus_concealment_p3")
local factory_npc = self[data.factory_id .. "_npc"]
if factory_npc and factory_npc.uses_parts then
try_insert(factory_npc.uses_parts, "wpn_fps_upg_bonus_concealment_p3")
endendendendend )
I really don't have much of a code experience since this is just a remaster of a existing old mod, so I actually dont have much idea about all of this complex coding, sorry. But I'll try it when i have time and maybe replace it too! Thanks.
Also if I'm not wrong judge is considered as a "wpn_fps_pis_judge". So you might actually not even need the code at the top.
Just had the time to try now, but I can say its amazing and easier because you can now add in almost every gun in the game with just changing some codes. Will replace the code with this in the next update.
59 817
We Use Cookies 🍪We use cookies to improve your user experience. Will you allow us to store them?
Replacing the code with this should catch all weapons categorized as pistols automatically
This should include custom pistols, but not tested
A system is included to force-add the Judge (and akimbo variant), which is not categorized as a pistol
local INCLUDE_JUDGE = true local function try_insert(v, e) if not table.contains(v, e) then table.insert(v, e) end end Hooks:PostHook( WeaponFactoryTweakData, "_add_charms_to_all_weapons", "pc__add_charms_to_all_weapons", function(self, tweak_data) local force_include if not INCLUDE_JUDGE then force_include = {} else force_include = table.list_to_set({ "judge", }) for id, x_id in pairs(tweak_data.weapon_akimbo_mappings) do force_include[x_id] = force_include[id] end end for _, data in pairs(tweak_data.upgrades.definitions) do local weapon = tweak_data.weapon[data.weapon_id] local factory = self[data.factory_id] if force_include[data.weapon_id] or weapon and weapon.categories and table.contains(weapon.categories, "pistol") then if factory and factory.uses_parts then try_insert(factory.uses_parts, "wpn_fps_upg_bonus_concealment_p3") local factory_npc = self[data.factory_id .. "_npc"] if factory_npc and factory_npc.uses_parts then try_insert(factory_npc.uses_parts, "wpn_fps_upg_bonus_concealment_p3") end end end end end )
I really don't have much of a code experience since this is just a remaster of a existing old mod, so I actually dont have much idea about all of this complex coding, sorry. But I'll try it when i have time and maybe replace it too! Thanks.
Also if I'm not wrong judge is considered as a "wpn_fps_pis_judge". So you might actually not even need the code at the top.
The system here cares about WeaponTweakData definitions, where the Judge is not categorized as a pistol
@erushinj Oh, my bad. I didn't notice that
Just had the time to try now, but I can say its amazing and easier because you can now add in almost every gun in the game with just changing some codes. Will replace the code with this in the next update.