Aetheria/Assets/Scripts/Gameplay/Weapons
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens 95d6fd3b14 F4/F5: shield restore survives inactivity, and CanTakeHit stops mutating
F4: a hit that breaks the shield usually also cooks it (TakeHit's own
AddHeat), which can knock the item thermally offline in the same tick. The
reserve's recharge and its Broken-clearing check lived inside Execute, which
Entity.Update only runs while Item.Active is true -- so a shield broken by a
hit that also shuts it down could never come back, no matter how long
RestoreDuration allows for. That logic now lives in Shield.Update
(IAlwaysUpdatedBehavior), which Entity.Update calls every tick unconditionally
(Cooldown.cs already relies on the same interface for the same reason).

F5: CanTakeHit broke the shield and drained the reserve as a side effect of
the query itself, on the premise that every caller queries it exactly once
per hit. That premise was false: RaycastAll/SphereCastAll/OverlapSphere hand
every caller under Assets/Scripts/Gameplay/Weapons both the shield collider
and the hull collider for one shot, so the same shield's CanTakeHit was
queried twice per hit. CanTakeHit is now a pure read (Broken + the reserve's
own CanSpend); the mutation moved to a new Shield.Break(), idempotent, called
by each weapon file exactly where it already decided to route a hit past the
shield instead of absorbing it.

Pinned in tests/Aetheria.Shared.Tests/ShieldReserveTests.cs:
RestorationProceedsWhileTheItemIsInactive (F4),
CanTakeHitNeverMutatesRegardlessOfHowManyTimesItIsCalled and
BreakIsIdempotentAcrossRepeatedCalls (F5). Updated every existing test that
relied on CanTakeHit's old mutating side effect to call Break() explicitly,
matching the new caller pattern.

Cannot compile-verify Assets/Scripts/Gameplay/Weapons/*.cs here (UnityEngine,
Unity batchmode unavailable in this environment) -- reviewed by hand for
brace/control-flow correctness; Self or a Unity batchmode pass should confirm.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 05:32:29 +02:00
..
ChargeEffectManager.cs Charged Weapons & Hitscan Weapons 2021-01-30 01:02:11 +00:00
ChargeEffectManager.cs.meta Charged Weapons & Hitscan Weapons 2021-01-30 01:02:11 +00:00
ConstantLaser.cs F4/F5: shield restore survives inactivity, and CanTakeHit stops mutating 2026-09-19 05:32:29 +02:00
ConstantLaser.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantLaserManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantLaserManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantLightning.cs Swap Unity.Mathematics usings for CultMath 2026-09-14 17:39:12 +02:00
ConstantLightning.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantLightningManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantLightningManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantParticleWeapon.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantParticleWeapon.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantParticleWeaponManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantParticleWeaponManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantWeaponEffectManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ConstantWeaponEffectManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
GuidedProjectile.cs F4/F5: shield restore survives inactivity, and CanTakeHit stops mutating 2026-09-19 05:32:29 +02:00
GuidedProjectile.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
GuidedProjectileManager.cs Convert engine types through CultMath.UnityBridge 2026-09-14 17:47:33 +02:00
GuidedProjectileManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
HitscanEffect.cs Swap Unity.Mathematics usings for CultMath 2026-09-14 17:39:12 +02:00
HitscanEffect.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
HitscanManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
HitscanManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
InstantWeaponEffectManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
InstantWeaponEffectManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
Laser.cs F4/F5: shield restore survives inactivity, and CanTakeHit stops mutating 2026-09-19 05:32:29 +02:00
Laser.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
LaserManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
LaserManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
Lightning.cs F4/F5: shield restore survives inactivity, and CanTakeHit stops mutating 2026-09-19 05:32:29 +02:00
Lightning.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
LightningGunManager.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
LightningGunManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
Mine.cs F4/F5: shield restore survives inactivity, and CanTakeHit stops mutating 2026-09-19 05:32:29 +02:00
Mine.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
MineManager.cs Swap Unity.Mathematics usings for CultMath 2026-09-14 17:39:12 +02:00
MineManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ParticleChargeEffect.cs Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ParticleChargeEffect.cs.meta Charged Weapons & Hitscan Weapons 2021-01-30 01:02:11 +00:00
Projectile.cs F4/F5: shield restore survives inactivity, and CanTakeHit stops mutating 2026-09-19 05:32:29 +02:00
Projectile.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
ProjectileManager.cs Swap Unity.Mathematics usings for CultMath 2026-09-14 17:39:12 +02:00
ProjectileManager.cs.meta Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
WeaponChargeEffect.cs Charged Weapons & Hitscan Weapons 2021-01-30 01:02:11 +00:00
WeaponChargeEffect.cs.meta Charged Weapons & Hitscan Weapons 2021-01-30 01:02:11 +00:00