Restore reticle-owned weapon locking
This commit is contained in:
parent
387f4fba70
commit
83ce86c75e
3 changed files with 89 additions and 8 deletions
|
|
@ -74,6 +74,11 @@ else if (args.Contains("--patrol", StringComparer.Ordinal))
|
|||
checks.RunPatrol();
|
||||
Console.WriteLine("Daemon generated-agent patrol smoke passed.");
|
||||
}
|
||||
else if (args.Contains("--combat-lock", StringComparer.Ordinal))
|
||||
{
|
||||
checks.RunCombatLock();
|
||||
Console.WriteLine("Daemon look-direction weapon-lock smoke passed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
checks.Run();
|
||||
|
|
@ -86,6 +91,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
|
||||
public void RunGravity() => RunCheck(PositiveGravityDepthAttractsAndProjectsAsAWell);
|
||||
|
||||
public void RunCombatLock() => RunCheck(InstantWeaponRequestSurvivesLockAcquisition);
|
||||
|
||||
public void RunLoadout() => DaemonLoadoutsRespectFactionAvailabilityAndHullRoles();
|
||||
|
||||
public void RunPickup()
|
||||
|
|
@ -3797,7 +3804,10 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
private static void InstantWeaponRequestSurvivesLockAcquisition()
|
||||
{
|
||||
var source = Entity(0, 0, "player");
|
||||
source.DirectionX = 1;
|
||||
source.DirectionX = 0;
|
||||
source.DirectionY = 1;
|
||||
source.LookDirectionX = 1;
|
||||
source.LookDirectionY = 0;
|
||||
source.VelocityX = 1;
|
||||
source.TargetEntityIndex = 1;
|
||||
source.Contacts = [new AetheriaRuntimeEntityContactCommit
|
||||
|
|
@ -3871,7 +3881,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
|
||||
Require(run.ShotReceipts.Count == 1 && run.ShotReceipts[0].SourceEntityIndex == source.EntityIndex,
|
||||
$"one instant weapon request must remain pending until daemon lock acquisition commits its shot; " +
|
||||
$"receipts={run.ShotReceipts.Count}, direction={source.DirectionX},{source.DirectionY}, contacts={string.Join(";", (source.Contacts ?? []).Select(value => $"{value.TargetEntityIndex}:{value.InfoGathered}"))}, states={string.Join(";", (source.WeaponStates ?? []).Select(value => $"{value.BehaviorKind}:pending={value.TriggerPending}:lock={value.LockProgress}:target={value.LockTargetEntityIndex}:burst={value.BurstRemaining}"))}");
|
||||
$"receipts={run.ShotReceipts.Count}, hull={source.DirectionX},{source.DirectionY}, look={source.LookDirectionX},{source.LookDirectionY}, contacts={string.Join(";", (source.Contacts ?? []).Select(value => $"{value.TargetEntityIndex}:{value.InfoGathered}"))}, states={string.Join(";", (source.WeaponStates ?? []).Select(value => $"{value.BehaviorKind}:pending={value.TriggerPending}:lock={value.LockProgress}:target={value.LockTargetEntityIndex}:burst={value.BurstRemaining}"))}");
|
||||
Require(run.GameEvents.Count(value => value.Kind == "weapon.lock.started" &&
|
||||
value.SourceEntityIndex == 0 && value.TargetEntityIndex == 1) == 1 &&
|
||||
run.GameEvents.Count(value => value.Kind == "weapon.lock.acquired" &&
|
||||
|
|
@ -3989,7 +3999,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
value.TargetEntityIndex == 2) == 1,
|
||||
"idle authored lock behavior must continue progressive acquisition without duplicating transition events");
|
||||
|
||||
source.DirectionX = -1;
|
||||
source.LookDirectionX = -1;
|
||||
source.LookDirectionY = 0;
|
||||
AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
NewPhysics(), catalog, 18, 1.8);
|
||||
|
|
@ -4000,9 +4011,10 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
run.GameEvents.Count(value => value.Kind == "weapon.lock.lost" &&
|
||||
value.TargetEntityIndex == 2 && value.Reason == "angle") == 1,
|
||||
$"crossing the authored lock angle must publish one loss transition while continued decay remains silent; " +
|
||||
$"direction={source.DirectionX},{source.DirectionY} source={source.PositionX:0.###},{source.PositionZ:0.###} target={secondTarget.PositionX:0.###},{secondTarget.PositionZ:0.###} progress={state.LockProgress:0.###} events={string.Join('|', run.GameEvents.Where(value => value.Kind.StartsWith("weapon.lock.", StringComparison.Ordinal)).Select(value => $"{value.Kind}:{value.TargetEntityIndex}:{value.Reason}:{value.AuxiliaryValue:0.###}->{value.ScalarValue:0.###}"))}");
|
||||
$"hull={source.DirectionX},{source.DirectionY} look={source.LookDirectionX},{source.LookDirectionY} source={source.PositionX:0.###},{source.PositionZ:0.###} target={secondTarget.PositionX:0.###},{secondTarget.PositionZ:0.###} progress={state.LockProgress:0.###} events={string.Join('|', run.GameEvents.Where(value => value.Kind.StartsWith("weapon.lock.", StringComparison.Ordinal)).Select(value => $"{value.Kind}:{value.TargetEntityIndex}:{value.Reason}:{value.AuxiliaryValue:0.###}->{value.ScalarValue:0.###}"))}");
|
||||
|
||||
source.DirectionX = 1;
|
||||
source.LookDirectionX = 1;
|
||||
source.LookDirectionY = 0;
|
||||
for (var frame = 20; frame <= 21; frame++)
|
||||
AetheriaRuntimeDaemonSimulation.Step(run, new AetheriaRuntimeDaemonIntentState(), 0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
|
|
@ -4043,6 +4055,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
var source = Entity(0, 0, "player");
|
||||
source.DirectionX = 1;
|
||||
source.LookDirectionX = 1;
|
||||
source.TargetEntityIndex = 1;
|
||||
source.Contacts = [new AetheriaRuntimeEntityContactCommit
|
||||
{
|
||||
|
|
@ -4150,6 +4163,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
payload.Fields);
|
||||
var ordinary = Entity(0, 0, "player");
|
||||
ordinary.DirectionX = 1;
|
||||
ordinary.LookDirectionX = 1;
|
||||
ordinary.TargetEntityIndex = 1;
|
||||
ordinary.Contacts = source.Contacts;
|
||||
ordinary.WeaponGroups = [new[] { 0 }];
|
||||
|
|
@ -4195,6 +4209,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
var source = Entity(0, 0, "player");
|
||||
source.DirectionX = 1;
|
||||
source.LookDirectionX = 1;
|
||||
source.TargetEntityIndex = 1;
|
||||
source.Contacts = [new AetheriaRuntimeEntityContactCommit
|
||||
{
|
||||
|
|
@ -4658,6 +4673,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
var source = Entity(0, 0, "player");
|
||||
source.DirectionX = 1;
|
||||
source.LookDirectionX = 1;
|
||||
source.VelocityX = 1;
|
||||
source.TargetEntityIndex = 1;
|
||||
source.Contacts = [new AetheriaRuntimeEntityContactCommit
|
||||
|
|
@ -9220,6 +9236,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
{
|
||||
var source = Entity(0, 0, "player");
|
||||
source.DirectionX = 1;
|
||||
source.LookDirectionX = 1;
|
||||
source.TargetEntityIndex = 1;
|
||||
source.Contacts =
|
||||
[
|
||||
|
|
|
|||
|
|
@ -2224,6 +2224,70 @@ public class DaemonRuntimeDocumentTests
|
|||
obj.IconAsset.AssetKey == "aetheria.asset.sprite.game.projectile"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DaemonWeaponLockUsesLookDirectionRatherThanHullDirection()
|
||||
{
|
||||
var attacker = new AetheriaRuntimeEntitySnapshotCommit
|
||||
{
|
||||
EntityIndex = 0,
|
||||
Kind = "ship",
|
||||
FactionKey = "player",
|
||||
IsActive = true,
|
||||
TargetEntityIndex = 1,
|
||||
DirectionX = 0,
|
||||
DirectionY = 1,
|
||||
LookDirectionX = 1,
|
||||
LookDirectionY = 0,
|
||||
Contacts = new[]
|
||||
{
|
||||
new AetheriaRuntimeEntityContactCommit
|
||||
{
|
||||
TargetEntityIndex = 1,
|
||||
InfoGathered = 1,
|
||||
Visible = true,
|
||||
Hostile = true
|
||||
}
|
||||
}
|
||||
};
|
||||
var target = new AetheriaRuntimeEntitySnapshotCommit
|
||||
{
|
||||
EntityIndex = 1,
|
||||
Kind = "ship",
|
||||
FactionKey = "raider",
|
||||
IsActive = true,
|
||||
PositionX = 80,
|
||||
PositionZ = 0
|
||||
};
|
||||
var run = new AetheriaRuntimeRunCheckpointCommit
|
||||
{
|
||||
RunId = "look-direction-lock-run",
|
||||
CurrentZoneIndex = 0,
|
||||
CurrentEntityKey = "zone.0.entity.0",
|
||||
Zones = new[]
|
||||
{
|
||||
new AetheriaRuntimeZoneSnapshotCommit
|
||||
{
|
||||
ZoneIndex = 0,
|
||||
Entities = new[] { attacker, target }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AetheriaRuntimeDaemonSimulation.Step(
|
||||
run,
|
||||
new AetheriaRuntimeDaemonIntentState(),
|
||||
0.1,
|
||||
AetheriaRuntimeDaemonSimulationSettings.AetheriaDefault,
|
||||
new PassthroughWorldPhysics());
|
||||
|
||||
Assert.Greater(attacker.WeaponStates.Single().LockProgress, 0,
|
||||
"A target under the reticle must acquire lock even when the hull faces elsewhere.");
|
||||
Assert.AreEqual(0, attacker.DirectionX, 0.0001,
|
||||
"Weapon aiming must not rotate the hull as a compensating authority.");
|
||||
Assert.AreEqual(1, attacker.DirectionY, 0.0001,
|
||||
"Weapon aiming must not rotate the hull as a compensating authority.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DaemonSimulationSettingsDriveAetheriaCombatGameFeel()
|
||||
{
|
||||
|
|
@ -3939,8 +4003,8 @@ public class DaemonRuntimeDocumentTests
|
|||
var player = run.Zones[0].Entities[0];
|
||||
Assert.AreEqual(3, result.AppliedCommandIds.Count);
|
||||
Assert.AreEqual(0, result.RejectedCommandIds.Count);
|
||||
Assert.AreEqual(0.316227766, player.DirectionX, 0.0001);
|
||||
Assert.AreEqual(-0.948683298, player.DirectionY, 0.0001);
|
||||
Assert.AreEqual(0.316227766, player.LookDirectionX, 0.0001);
|
||||
Assert.AreEqual(-0.948683298, player.LookDirectionY, 0.0001);
|
||||
Assert.AreEqual(0.8, player.TractorPower, 0.0001);
|
||||
Assert.IsTrue(player.HeatsinksEnabled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1267,7 +1267,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
var previousProgress = weaponState.LockProgress;
|
||||
var targetDirection = Normalize(target.PositionX - attacker.PositionX, target.PositionZ - attacker.PositionZ);
|
||||
var lookDirection = Normalize(attacker.DirectionX, attacker.DirectionY);
|
||||
var lookDirection = Normalize(attacker.LookDirectionX, attacker.LookDirectionY);
|
||||
var dot = Math.Max(-1.0, Math.Min(1.0,
|
||||
targetDirection.X * lookDirection.X + targetDirection.Y * lookDirection.Y));
|
||||
var angleDegrees = Math.Acos(dot) * 180.0 / Math.PI;
|
||||
|
|
|
|||
Loading…
Reference in a new issue