AddChamberTriggerToEveryGun
Add chamber triggers to every gun so you can manually insert a round into the chamber.
By Niko666
CHANGELOG
Changelog
1.0.1
- A shit ton of things
Show Detail
- Fixed: the chamber trigger patch was never actually applied. 1.0.0 registered no Harmony patch, so it did nothing at all - no gun ever got a trigger.
- Fixed: a chamber now also gets the
FVRFireArmChambertag. A round only offers itself to a collider sitting on an object with that tag, so the trigger alone would not have been enough. - Added: the trigger collider can be configured -
CenterX/CenterY/CenterZ,RadiusandHeight, in the chamber's own local space. The defaults are the old hardcoded values (0, 0, -0.03 / 0.011 / 0.13), so a gun that behaved one way before still behaves that way. - Added: a
Debugsection withShowTriggerCollidersandTriggerAlpha. Every trigger the mod added is drawn as a semi transparent capsule, so you can see where it sits while tuning. - Added: config hot reload. Editing the
.cfgin a text editor (or changing a value in the ConfigurationManager) is picked up within a second and applied to every gun already in the scene - no restart and no scene reload. - Added: an
Enabledmaster switch, which stops new triggers from being added and switches off the ones already added. - Added:
VerboseLogging, which names every chamber a trigger was added to. - Changed: the trigger this mod adds now runs along the chamber's Z axis (along the barrel) instead of standing up along Y.
- Added:
Direction(Auto/X/Y/Z). Auto is Z for a trigger this mod adds, and the axis the gun's own trigger already had when one is taken over; X, Y or Z forces that axis on both. - Added:
IncludeVanillaColliders. Off, guns that already have a trigger of their own are still left alone. On, those chambers are taken over as well - the collider the game put there is moved and resized by the same settings, tagged and made manually chamberable - and it is put back exactly as the game had it (position, size, flags, tag,IsManuallyChamberable) the moment the option is switched off again. - Added: per weapon settings in
BepInEx/config/Niko666.AddChamberTriggerToEveryGun.json, keyed by the weapon's ItemID. Every field is optional and falls back to the.cfg,"Enabled": falseexempts a gun. An entry is a statement about that gun, so it takes the gun over whichever wayIncludeVanillaCollidersis set. The file is created with an example on first run, is reloaded when it changes on disk, and a broken file only costs the overrides (VerboseLoggingprints the key of every gun it sees, ready to paste in). - Added:
Debug/ShowVanillaTriggers, which extends the semi transparent view to chambers this mod does not touch, drawn from the collider the game already put there, so an untouched gun's trigger can be compared with the settings. - Added: the debug view now matches the trigger's real shape - capsule, sphere or box - including a capsule's own axis.
- Fixed: closed-bolt guns (every AK, AR, FAL and friends) never actually took the round, even though the trigger was there and the round touched it. The trigger was never the whole story: a round only offers itself to a chamber while
FVRFireArmChamber.IsAccessibleis true, and while every other action in the game publishes that from its own state (a pistol from its slide, an open-bolt receiver and a tube-fed shotgun from their bolts),FistVR.ClosedBoltnever sets it at all, so it stayed false forever. Those guns now get the rule a pistol already uses - out of reach while the bolt is fully forward, reachable as soon as it comes back - which is the difference between "the trigger is there" and "the round goes in". - Added:
ClosedBoltAccessibility(the switch for the fix above, default on). Off, the trigger is still added and drawn but those guns stay exactly as they are in vanilla, where they cannot be hand loaded at all. - Added:
HeldRoundPassThrough+HeldRoundPassRange. On, while a round is held in a hand and comes within that range of a trigger this mod added, the gun it belongs to stops blocking it - so the round can be pushed through the frame into the chamber instead of being stopped by the receiver. It works by ignoring the collision pairs between the round's colliders and that gun's frame colliders (Physics.IgnoreCollision), one gun at a time and only while the round is held and close, and the gun's trigger colliders are deliberately not part of it, so the chamber still catches the round exactly the way it does on a gun that never blocked it. The round itself is untouched: it still collides with the world, other items and other guns. - Added:
OpenBoltAccessWithoutLock. Open bolt guns (Sten, MP40, Uzi and friends) only gave up their chamber while the bolt was held on its catch - withFistVR.OpenBoltReceiverBolt.IsBoltLockbackRequiredForChamberAccessibilityset to false they now open it as soon as the bolt is not fully forward, the rule the rest of the game uses. The value the prefab had is remembered and put back when the option (or the master switch) is turned off. - Fixed:
HeldRoundPassThroughignored the wrong colliders - it took the gun's trigger colliders instead of its frame, so the frame went on blocking the round and, worse, the chamber's own trigger stopped seeing a held round (a round could only be chambered by letting go of it, which reset the pairs). It now collects the non-trigger colliders on both sides, from a helper named for what it returns so the filter cannot be passed the wrong way round, andVerboseLoggingprints how many colliders are being ignored against which gun. - Added:
HandFeedAnyRound. Half the hand feeding gate is on the round, not the gun: a held round only starts looking at chambers at all while its ownFistVR.FVRFireArmRound.isManuallyChamberableis true (OnTriggerEnterandUpdateboth bail out on that flag before they ever look at a collider), and 28 of the game's round prefabs ship with it false - every 4.6x30mm (MP7A1), 5.7x28mm (P90, Five-seveN), 5.8x42mm (QBZ95), 4.7x33mm, 8mm Bergmann, 5mm Bergmann, 8mm Roth-Steyr, .38 ACP, 9x23mm Steyr, .36 Moses, .46 Ball, 2x50mm Caseless and aCpbp round. On those guns a round could not be hand loaded however the chamber was set up, and it looked exactly like the mod doing nothing: the round was never recognised, not even when it was sitting on the trigger. With this on, the round the mod is holding is opened up, and every round it touched is put back when this (or the master switch) is switched off. - Added:
FixChamberRoundType. A round only offers itself to a chamber while the two are marked with the same round type, and some guns' prefabs disagree with themselves about which round that is - 21 of the ~470 firearm prefabs in every weapon bundle that holds guns (rifle, SMG, pistol and MF2; AR-15, historical, shotgun and support are clean), including nearly every one whose caliber is otherwise unambiguous: AR10, G3A3, G3SG1, PSG1 (7.62x51mm guns whose chambers say 9x19mm), QBZ95 (5.8x42mm, chamber says 5.56x45mm), Mp7a1_HL (the Half-Life MP7A1 - its own hand-load chamber is marked 40mm caseless), KrissVector45, SpectreM4, APC9, APC45, USP_Match9, Ruby, UnionPistol, AutomagII, Degle. The magazine type the game files each of those guns under (mG3A3_762_51mm,mAR10_762_51mm,mQBZ95_58x42mm,mUSP_9mm,mRuby_32ACP, ...) agrees with the gun's own round type in every one of them, so that is what a chamber is brought in line with (the inserted magazine wins when there is one). A chamber is only ever changed when it disagrees with the gun and only to a type the ammo system has; nothing is changed on a gun the game says nothing about. Put back when this (or the master switch) is switched off. A chamber's round type is not read by magazine feeding at all, which is why those guns played normally until someone tried to hand feed them. - Fixed: MP7A1 and QBZ95 could not be hand loaded, and neither could the rest of that group (P90 / Five-seveN by way of their 5.7x28mm rounds, plus the odd cartridges listed above). Those guns had two gates closed, not one: the round side above, and their chamber, which is the same gap every other gun had (no collider,
IsManuallyChamberablefalse) plus a round type of its own that was never checked because the round was already refusing to look. With one side opened and the other brought in line, a round of the gun's own ammo now reaches the chamber on the MP7A1, the QBZ95 and everything else that shipped this way.
1.0.0
- Initial release