diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 67d176680..0c961c7c7 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -7692,6 +7692,21 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root) string.Join(", ", shieldAuthorityHits)); } + var forbiddenActionBarIntentAcceptanceSymbols = new[] + { + "observer == null || !observer.HasAuthoritativeState || equipmentIndex < 0 || behaviorIndex < 0", + "observer == null || !observer.HasAuthoritativeState || weaponGroup < 0" + }; + var actionBarIntentAcceptanceHits = forbiddenActionBarIntentAcceptanceSymbols + .Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (actionBarIntentAcceptanceHits.Length > 0) + { + throw new InvalidOperationException( + "Unity action-bar intent requests still reject through renderer-local index checks instead of daemon authority: " + + string.Join(", ", actionBarIntentAcceptanceHits)); + } + var requiredTargetAuthoritySymbols = new[] { "ApplySetTarget(run, command)", diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index b3d005343..d5c6c4dd6 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -3956,7 +3956,7 @@ public class ActionGameManager : MonoBehaviour public bool TryRequestDaemonActionBarBehavior(int equipmentIndex, int behaviorIndex, bool active) { var observer = ResolveDaemonObserver(); - if (observer == null || !observer.HasAuthoritativeState || equipmentIndex < 0 || behaviorIndex < 0) + if (observer == null || !observer.HasAuthoritativeState) { return false; } @@ -3976,7 +3976,7 @@ public class ActionGameManager : MonoBehaviour public bool TryRequestDaemonActionBarWeaponGroup(int weaponGroup, bool active) { var observer = ResolveDaemonObserver(); - if (observer == null || !observer.HasAuthoritativeState || weaponGroup < 0) + if (observer == null || !observer.HasAuthoritativeState) { return false; } diff --git a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs index 03f22a60f..8fe2ae778 100644 --- a/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs +++ b/Assets/Scripts/Tests/DaemonRuntimeDocumentTests.cs @@ -2423,18 +2423,26 @@ public class DaemonRuntimeDocumentTests public void DaemonOperationsRejectsWeaponGroupIntentForMissingGroup() { var run = RunWithTwoEntities(); - var fire = AetheriaRuntimeDaemonCommandDocument.Create( + var negative = AetheriaRuntimeDaemonCommandDocument.Create( AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, "codex", "session-intents", 33, "zone.0.entity.0"); - fire.WeaponGroup = 99; + negative.WeaponGroup = -1; + var missing = AetheriaRuntimeDaemonCommandDocument.Create( + AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupActive, + "codex", + "session-intents", + 34, + "zone.0.entity.0"); + missing.WeaponGroup = 99; + missing.ScalarValue = 1.0; - var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { fire }); + var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { negative, missing }); Assert.AreEqual(0, result.AppliedCommandIds.Count); - Assert.AreEqual(1, result.RejectedCommandIds.Count); + Assert.AreEqual(2, result.RejectedCommandIds.Count); Assert.AreEqual(0, result.Intents.WeaponGroups.Count); } @@ -2442,20 +2450,29 @@ public class DaemonRuntimeDocumentTests public void DaemonOperationsRejectsBehaviorIntentForMissingBehavior() { var run = RunWithTwoEntities(); - var behavior = AetheriaRuntimeDaemonCommandDocument.Create( + var negative = AetheriaRuntimeDaemonCommandDocument.Create( AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive, "codex", "session-intents", 34, "zone.0.entity.0"); - behavior.EquipmentIndex = 0; - behavior.BehaviorIndex = 99; - behavior.ScalarValue = 1.0; + negative.EquipmentIndex = -1; + negative.BehaviorIndex = 0; + negative.ScalarValue = 1.0; + var missing = AetheriaRuntimeDaemonCommandDocument.Create( + AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive, + "codex", + "session-intents", + 35, + "zone.0.entity.0"); + missing.EquipmentIndex = 0; + missing.BehaviorIndex = 99; + missing.ScalarValue = 1.0; - var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { behavior }); + var result = AetheriaRuntimeDaemonOperations.Execute(run, new[] { negative, missing }); Assert.AreEqual(0, result.AppliedCommandIds.Count); - Assert.AreEqual(1, result.RejectedCommandIds.Count); + Assert.AreEqual(2, result.RejectedCommandIds.Count); Assert.AreEqual(0, result.Intents.Behaviors.Count); }