From 3de64d944842836da7390addddee12db7d8fef39 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 17 Jul 2026 03:46:33 +0100 Subject: [PATCH] Advertise held weapon group controls --- Aetheria.State.Daemon.Smoke/Program.cs | 56 +++++++++++++++++++ ...AetheriaRuntimeInputCapabilityDocuments.cs | 23 +++++++- docs/aetheria-perfect-machine-map.md | 8 ++- docs/original-game-migration-matrix.md | 2 +- 4 files changed, 85 insertions(+), 4 deletions(-) diff --git a/Aetheria.State.Daemon.Smoke/Program.cs b/Aetheria.State.Daemon.Smoke/Program.cs index a11213412..d942c58bd 100644 --- a/Aetheria.State.Daemon.Smoke/Program.cs +++ b/Aetheria.State.Daemon.Smoke/Program.cs @@ -178,6 +178,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks ResourceBehaviorsStopEquipmentChainsInAuthoredOrder, ThermotoggleSeedsAndGatesFromDaemonOwnedTarget, InputCapabilityPublishesExactBehaviorLevers, + InputCapabilityPublishesHeldWeaponGroupLever, ReflectorUsesSharedStellarLightFieldWithoutAccumulating, SensorPingIsActorScopedEnergyGatedAndReconnectable, TurretControllerAcquiresAimsAndTriggersExactWeapons, @@ -612,6 +613,61 @@ internal sealed class AetheriaDaemonYmirSmokeChecks "offline equipment must retain stable action identity while advertising current unavailability"); } + private static void InputCapabilityPublishesHeldWeaponGroupLever() + { + var entity = Entity(0, 0, "player"); + entity.WeaponGroups = [new[] { 0 }]; + var run = new AetheriaRuntimeRunCheckpointCommit + { + RunId = "weapon-input-smoke", + CurrentZoneIndex = 0, + Zones = [new AetheriaRuntimeZoneSnapshotCommit { ZoneIndex = 0, Entities = [entity] }] + }; + run.CurrentEntityKey = run.EntityRecordKey(0, entity.EntityIndex); + var frame = AetheriaRuntimeDaemonFrameDocument.Create(run, "smoke", "weapon-input", 1, 0.1, 0.1); + var capability = AetheriaRuntimeInputCapabilityDocument.FromFrame(frame); + var action = capability.Actions.Single(value => value.ActionId == "weapon-group.0.fire"); + RequireEqual("aetheria.daemon.commands.SetWeaponGroupActive", action.Operation, + "weapon input must advertise the daemon's press/release owner instead of the one-shot compatibility command"); + RequireEqual("button-hold.v1", action.InputValue?.Model ?? "", + "generic Eve clients must know that weapon firing is a held control"); + RequireEqual("active", action.InputValue?.PayloadKey ?? "", + "weapon press/release values must route into the typed active field"); + + AetheriaRuntimeDaemonCommandDocument Translate(string active) + { + var request = new EveSurfaceCommandRequest( + capability.ProviderId, + AetheriaRuntimeDaemonGameSurfaceBuilder.PilotSurfaceId, + CultMesh.OperationInvocation(action.Operation), + CultMesh.OperationPayload( + ("entityId", run.CurrentEntityKey), + ("weaponGroup", "0"), + ("active", active)), + DateTimeOffset.UtcNow, + "weapon-input-smoke"); + Require(AetheriaRuntimeDaemonOperationsClient.TryCreateSurfaceCommandDocument( + request, frame, ".", "weapon-input-smoke", "weapon-input", out var command) && + command?.Kind == AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupActive, + $"generic weapon input value {active} must translate into the typed held-fire command"); + return command!; + } + + var pressed = AetheriaRuntimeDaemonOperations.Execute( + run, [Translate("1")], new AetheriaRuntimeDaemonOperationContext()); + RequireEqual(1, pressed.Intents.WeaponGroups.Count, + "weapon press must reach the daemon intent owner exactly once"); + Require(pressed.Intents.WeaponGroups[0].Active, + "weapon press must activate the exact advertised group"); + + var released = AetheriaRuntimeDaemonOperations.Execute( + run, [Translate("0")], new AetheriaRuntimeDaemonOperationContext()); + RequireEqual(1, released.Intents.WeaponGroups.Count, + "weapon release must reach the daemon intent owner exactly once"); + Require(!released.Intents.WeaponGroups[0].Active, + "weapon release must deactivate the exact advertised group"); + } + private static void DockedRefitSurfacePublishesGenericCommands() { var hull = HullCatalogItem("surface-hull", 9, 7, 100); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputCapabilityDocuments.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputCapabilityDocuments.cs index d039f800d..dbc4cadfc 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputCapabilityDocuments.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeInputCapabilityDocuments.cs @@ -91,7 +91,7 @@ namespace GameCult.Aetheria.State.Verse } if (entity != null) { - actions.AddRange((entity.WeaponGroups ?? Array.Empty>()).Select((_, index) => Action($"weapon-group.{index}.fire", $"Fire Weapon Group {index + 1}", "FireWeaponGroup", "weapon-group", $"{run.CurrentEntityKey}#weapon-group/{index}", ("weaponGroup", index.ToString())))); + actions.AddRange((entity.WeaponGroups ?? Array.Empty>()).Select((_, index) => WeaponGroupAction(run, index))); actions.AddRange(EquipmentBehaviorActions(run, entity, catalog)); actions.AddRange((entity.CargoContents ?? Array.Empty()) .SelectMany(bay => bay.Items) @@ -188,6 +188,27 @@ namespace GameCult.Aetheria.State.Verse } } + private static AetheriaRuntimeInputActionDocument WeaponGroupAction( + AetheriaRuntimeRunCheckpointCommit run, + int weaponGroup) + { + var action = Action( + $"weapon-group.{weaponGroup}.fire", + $"Fire Weapon Group {weaponGroup + 1}", + "SetWeaponGroupActive", + "weapon-group", + $"{run.CurrentEntityKey}#weapon-group/{weaponGroup}", + ("weaponGroup", weaponGroup.ToString()), + ("active", "0"), + ("currentValue", "0")); + action.InputValue = new AetheriaRuntimeInputValueDocument + { + Model = "button-hold.v1", + PayloadKey = "active" + }; + return action; + } + private static bool ReadBool(AetheriaRuntimeBehaviorPayload payload, int key) => (payload.Fields ?? Array.Empty()) .FirstOrDefault(field => field != null && field.Key == key)?.Value?.BoolValue ?? false; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 8f8e52ebc..e134cd0c4 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -107,13 +107,17 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. methods instead of writing the input collections directly. The action bar also uses typed runtime catalog category rows to reject non-consumable inventory drops and creates consumable bindings around typed - catalog rows. The provider input capability derives equipment controls from + catalog rows. Weapon groups publish the fossil press/release lifecycle as + generic `button-hold.v1` values routed to the daemon-owned + `SetWeaponGroupActive` command; `FireWeaponGroup` remains a one-shot + compatibility operation but is not the public binding contract. The provider + input capability derives equipment controls from exact installed payload indices: `Switch` and `Trigger` publish generic `button-hold.v1` values, while adjustable `Thermotoggle` publishes a `scalar.v1` Kelvin target with the daemon-owned current value. Fixed and non-interactive behaviors publish no counterfeit action; offline equipment retains stable action identity but is unavailable. Generic Eve requests for - both operations translate into their typed daemon commands. The capability + every value operation translates into its typed daemon command. The capability identifies provider `aetheria`; `aetheria.daemon.commands` remains only the operation boundary and cannot replace provider identity. Missing typed rows are rejected for consumable binding instead of falling through to legacy DTO classification. Slot-binding drag/drop now diff --git a/docs/original-game-migration-matrix.md b/docs/original-game-migration-matrix.md index 74692e1b2..88f9eda0d 100644 --- a/docs/original-game-migration-matrix.md +++ b/docs/original-game-migration-matrix.md @@ -31,7 +31,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity. | Wormhole travel | `ActionGameManager.EnterWormhole` plus `Ship` enter/exit state | daemon fixed-step transition plus Ymir exclusion | current-entity transition state and feedback chronology | provider-selected generic transition lowering | command acceptance no longer moves an entity immediately; player interact, explicit travel, and agent routing derive the same canonical adjacent-zone wormhole and proximity gate, then persist four-second `entering`, authoritative transfer, four-second `exiting`, and one-frame `completed` phases. The daemon owns smootherstep XZ motion, the fossil 1000-unit visual-depth lever, deterministic 20-unit exit direction, 50-unit exit radius, target-adjacency discovery, and exactly-once start/transfer/completion events. Flight and every world-physics implementation receive no transitioning body; Ymir resumes on the tick after completion. Smoke serializes and rehydrates mid-entry and proves agents traverse multi-edge routes through the same command boundary | generic provider transition effect/camera lowering and live multi-zone pilot witness | | Inventory/equipment | `Entity.ItemFits`, `TryEquip`, `TryUnequip`, `EquippedCargoBay.ItemFits`/`TryStore`, inventory panels + ServerShared | daemon atomic inventory transactions | typed inventory/equipment state, commands, exact receipts | generic UI | generated cargo and docking bays now occupy their typed collections instead of masquerading as ordinary equipment; docked equip/reposition/store validates the complete destination on cloned state before committing either side, uses authored hull interior and hardpoint geometry, forces hardpoint rotation, rejects occupied cells and deployed ships, preserves exact item instance fields and weapon-group membership, routes bay categories with aligned content/assignment arrays, and refuses to unequip nonempty/occupied bays. Cargo transfer now uses the same plan-first rule with typed bay interiors, rotated item footprints, deterministic free-cell search, exact stack maxima, and no partial source/destination mutation on rejection; exact reasons reach generic Eve receipts | live generic refit controls, reconnect after accepted and rejected moves, commodity multi-stack chronology, and full fossil inventory feedback parity | | Trade | trade UI/economy | daemon | stock, quote, purchase/sale commands | generic UI | daemon derives station, stock row, catalog item, current price, quantity, credits, target capacity, and hull-vs-cargo result; purchases ignore client opinions about price and destination kind. Docked sales identify only the source stack and quantity: the daemon derives station, instance-sensitive value, payout, deterministic typed stock placement, and commits cargo/credits atomically; generic Eve advertises available buy and sell actions. The generic Unity live witness receives an authoritative purchase receipt while paused | live sale receipt witness, quote expiry, contested stock, and full trade surface parity | -| Action bar/input | input shell and rebinding UI | daemon advertises actions; client owns bindings | input capability and action descriptors | universal binding UI | contracts wired; cargo actions are catalog-filtered to consumables the current actor can actually activate, including suppression of active non-stackable items. Equipment actions now derive from exact installed catalog payload/state pairs instead of blindly activating behavior zero: Switch and Trigger expose generic hold values, adjustable Thermotoggle exposes a scalar Kelvin target/current value, fixed/non-interactive rows are omitted, and offline rows retain identity as unavailable. Both action forms translate through generic Eve requests into typed daemon commands under provider identity `aetheria` | runtime action-bar quantity/fill proof and generic scalar-control lowering | +| Action bar/input | input shell and rebinding UI | daemon advertises actions; client owns bindings | input capability and action descriptors | universal binding UI | contracts wired; cargo actions are catalog-filtered to consumables the current actor can actually activate, including suppression of active non-stackable items. Weapon groups advertise the fossil press/release lifecycle as generic `button-hold.v1` values routed to `SetWeaponGroupActive`; the one-shot compatibility command is no longer the public input contract. Equipment actions derive from exact installed catalog payload/state pairs instead of blindly activating behavior zero: Switch and Trigger expose generic hold values, adjustable Thermotoggle exposes a scalar Kelvin target/current value, fixed/non-interactive rows are omitted, and offline rows retain identity as unavailable. Every value form translates through generic Eve requests into typed daemon commands under provider identity `aetheria` | runtime action-bar quantity/fill proof and generic scalar-control lowering | | Pilot camera | ARPG follow/dock cameras | Eve view semantics + runtime | camera rig and semantic view id | EveUnity camera rig | daemon dock state selects distinct contracts instead of collapsing both fossil cameras: undocked flight advertises the entity-forward `Third Person Rig` framing (distance 30, screen 0.64/0.19, FOV 60, lens 1-4096) and the shared `aim.presentation` convergence point as its look-at; Aetheria translates the fossil Cinemachine top-origin screen Y of `0.81` to Eve's bottom-origin viewport Y of `0.19`; EveUnity solves native pose while preserving both optical aim and advertised entity framing, without provider types; the retained dock projection remains separate | reproduce the dock camera's separate follow/look-at subjects, blend timeline, noise, and reconnect state | | Render channels | Unity layers/culling masks | provider surface policy + runtime asset variant | semantic channel exclusions | EveUnity native layer mapping | wired, exclusive, and lowered: the pilot surface excludes the semantic `map` channel; the Unity asset variant maps `map` to its authored native layer; EveUnity subtracts that layer from the configured camera mask; portable state contains no Unity layer or mask; provider conversion preserves the source icon shader's unlit lighting model; the released witness proves the pilot camera excludes map glyphs while the map camera retains readable white glyphs without a scene light | preserve the channel proof while world presentation and transport continue to evolve | | Minimap/tactical map | `ZoneRenderer`, map cameras | daemon world facts | explicit map projections | Unity and Electron | facts fragmented; generic lowerers absent | same state in both runtimes |