Skip to content

Fix NRE in GetTweakScaleDryCost + Explosion Armor Damage Fixes + Misc. Fixes#791

Merged
BrettRyland merged 48 commits intoBrettRyland:devfrom
BillNyeTheIE:dev
Apr 9, 2026
Merged

Fix NRE in GetTweakScaleDryCost + Explosion Armor Damage Fixes + Misc. Fixes#791
BrettRyland merged 48 commits intoBrettRyland:devfrom
BillNyeTheIE:dev

Conversation

@BillNyeTheIE
Copy link
Copy Markdown

No description provided.

Fix NRE in GetTweakScaleDryCost when not using a fork that has a `DryCost` field, resulting in HitpointTracker malfunctioning.
Use mass multiplier instead of scale multiplier for TweakScale dryCost fallback method
Comment thread BDArmory/Damage/HitpointTracker.cs Outdated
- Fix incorrect `GetTweakScaleMultiplier` use (good catch Doc!)
- Update `_tweakScaleMassMultiplier` while performing fallback TweakScale `dryCost` calculation since we're getting it anyways.
- Slightly improve function organization
- Return dataIndex in RadarUpdateMissileLock instead of resetting the whole array, allowing for slightly less GC pressure
- Improve debug statements, prefix the missile's shortName to their debug statements and add more debug statements
- Disable kappa debug statement, likely not used by too many people for tuning, and spams the log pretty hard
- Allow RWR to record same vessel multiple times, but ONLY if these have a different signalType
- Also have missile lock warnings flash instead of remaining solid
- Add support for acoustic torpedoes in PointDefenseTurretFiring
- Prevent torps from being launched at missiles and missiles at torps
- Fix CruisePopup persistence
- Update MissileIsThreat so we can ignore interceptor missiles targeting other missiles in point-defense avoiding missile conga lines
- IRST was returning instead of continuing when it detected terrain
- Make sure we skip underwater targets for IRST
- Try to fix the various instances of the missile team being set to neutral
- Removed the contact detonation modifiers from CalcExplosiveArmorDamage as they resulted in unintuitive behavior, in particular for non-directional blasts
- Replaced string concat with interpolated strings for various debug outputs
Sidestrafe's log showed nullrefs in these two locations, I'm not entirely sure what's causing them.
- Fix various errors in conversions in CalculateExplosiveArmorDamage causing smaller than expected armor damage values
Shrapnel code, specifically shrapnel penetration, has to be looked at for a couple of reasons. For now contact detonation calcs are disabled due to the double jeopardy effect you get with the shrapnel calc + the blast damage calc which really increases the amount of armor that gets damaged during a contact detonation.
Points to look at:
- Currently it's based on an empirical equation that doesn't consider preceding armor. To some extent this is mitigated by equations used in ExplosionFX but this should be looked at more.
- The empirical equations are only for steel, there's some fudge factors being used to apply it to other armor types but this should be looked at.
Personally, I think we should replace the current equations with a model based on Gurney and Mott's formulas, we determine an acceptable "representative" shrapnel energy based on those (maybe like the mean shrapnel energy, or maybe the 68th percentile, as like a standard deviation thing), getting a penetration value, then just subtracting the thickness of intermediate armor from that pen. Or maybe we get some kind of inverse relationship between armor pen and % of shrapnel above that penetration, allowing us to more accurately scale shrapnel damage.
Moving outside of maxOffBoresight doesn't immediately cause the missile to go dumb, instead we use radarLOAL behavior
Fix PD nullref due to missing `multiLauncher` null check
Comment thread BDArmory/UI/BDATargetManager.cs
BillNyeTheIE and others added 9 commits March 27, 2026 16:06
Added better debug statements for radars
Clamp spallArea in CalculateExplosiveArmorDamage via a linear fit of the blast pressure curve.
- Oops, messed up the merge on the web UI
Swap the linear fit to an inverse square fit to clamp the spall area for blasts
- Remove `blowthroughFactor` factor from spall area calculations except for where it is being used to limit damage and is clamped between 0 and 1. (This is already accounted for in the spallArea clamping)
- Put the 0.66 case before the 0.33 case so it'll properly trigger
Some functions were using `Armour` instead of `Armor`
Also fix the `UI_FloatRange` for `Armor` applying to all `UI_Scene`s (technically making `Armour` redundant)
- Because we degrade armor at 1.5x the rate we call for, this causes the thickness and the "real" thickness of the armor that would result from dividing `totalArmorQty` by the density and armorVolume (actually armorArea but we'll ignore that...) to fall out of sync. Performing damage calculations thus requires that we calculate the "real" armor thickness.
- Also made the way we calculate and input the armor volume to be reduced in `CalculateExplosiveArmorDamage` consistent amongst all the different options (aside from ceramics which use their own logic).
- Fix ModularMissileMagazine not properly disabling the scale fields when no ScaleTransform is found
- Fix HitpointTracker NRE due to removing the Armor Field's (disabled) flight UI
- Remove unnecessary cast
- Add probability to the Fire diceroll debug statement
- Increment turret rotation timeout timer if the turret is not making progress towards the target
- For now use non-resetting method
The loops were getting unwieldy and weren't required (as many didn't have custom conditionals) so they were replaced with Coroutines.
@BillNyeTheIE BillNyeTheIE changed the title Fix NRE in GetTweakScaleDryCost Fix NRE in GetTweakScaleDryCost + Explosion Armor Damage Fixes + Misc. Fixes Mar 30, 2026
- Updated changelog
- Slightly modified missile debug telemetry formatting
Comment thread BDArmory/Control/MissileFire.cs Outdated
- Remove unnecessary waits in GMR originating from commit 8c5cc26
- Default to name if localizationName isn't available for Armor and Material configs
Comment thread BDArmory/Distribution/GameData/BDArmory/BulletDefs/BD_Materials.cfg
- Fix MMLs setting `guidanceActive` to true for all missiles launched causing dumb bombs to try to steer...
- Uncomment PD missile debug statements, may as well have a better idea of what's going on, and we're not really saving that much on performance.
- Fix a conditional in MissilesAway
- Account for bombs whose rigidbody (and parent rigidbody) are null via a simple vessel velocity + angular velocity calc
Due to an error made when revamping the turret loops, we stopped checking for the presence of turrets before going into the turret loops, result in fixed missiles still waiting on turrets.
Lots of string comparisons were being used with a bunch of .ToLower()s, converting them to an Enum should at least make things a bit faster.
Mostly prep for cluster-based torpedo-on-a-missile kind of weapons
- SARH guidance re-lock now respects engagement envelope and IFF
Oops, forgot weapons used this
- Extend missile debug window size a bit
- Format notch data better
Notch in all 3 dimensions!
- It ain't pretty, but it'll have to do, mostly because messing with resources is gonna be costly and messy. Use basic linear scale multiplier cubed as the pseudo-mass scale. It won't be accurate for many parts, but hey, it's better than having the mod just not work.
- Update Changelog
Comment thread BDArmory/Control/BDModulePilotAI.cs Outdated
Comment thread BDArmory/Control/BDModulePilotAI.cs
Comment thread BDArmory/Control/MissileFire.cs Outdated
- Add comments to explain what all the functions do
- Fix sign convention for crossy (it worked the way it was but if I'm gonna call it "crossy" I better actually make it be the y-component of the cross product)
- Remove the notch angle changes in Kinematic Evasion per Josue
- Limit adjustable armor thickness to the min of either the length or width
- Finally track down the origin of the (0, 0, 0) bug for INS missiles
- Previously if the turret was destroyed, we'd perform the simple check, but if it's destroyed something catastrophic has probably happened
- May as well add that in for radar missiles too, in case their turret has a fixed radar on it.
- Update ChangeLog.txt
@BrettRyland BrettRyland merged commit cea7409 into BrettRyland:dev Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants