Actor: the Start goal's entry resolve applies at construction
A puppet started in rage (Start = a goal with EntryResolve) began at resolve 1.0 because only goal changes applied the entry effect. The pain-box golden and the seed-1 body hashes are unchanged (no fixture Start goal carries an entry resolve). Addresses finding start-goal-entry-ignored. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
91a3c6ffd0
commit
9c26a5509a
3 changed files with 17 additions and 1 deletions
|
|
@ -50,6 +50,11 @@ namespace Lodur
|
|||
_driveP = drive;
|
||||
_brain = brain;
|
||||
_goal = brain.Start;
|
||||
// The Start goal takes over at construction: its entry effect applies like any other goal's.
|
||||
if (brain.Goals[brain.Start].EntryResolve is double startEntry)
|
||||
{
|
||||
_drive.Enter(drive, startEntry);
|
||||
}
|
||||
_latency = Math.Max(1, (long)Math.Round(brain.DeliberateLatencySeconds / tickSeconds));
|
||||
_dwell = new long[brain.Goals.Count];
|
||||
_onset = new long[brain.Goals.Count];
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Lodur
|
|||
public double MinDwellSeconds { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The resolve the character has the tick this goal takes over, in [0, 1]; null leaves resolve as it is. Rage is what
|
||||
/// The resolve the character has the tick this goal takes over (for the Start goal, at construction), in [0, 1]; null leaves resolve as it is. Rage is what
|
||||
/// the will breaking leads to, and it resets the will (lodur:ruling:rage-involuntary-onset-then-voluntary).
|
||||
/// </summary>
|
||||
public double? EntryResolve { get; init; }
|
||||
|
|
|
|||
|
|
@ -386,4 +386,15 @@ public sealed class WillTests
|
|||
Assert.Equal(ticks, firstDrain);
|
||||
Assert.Equal(ticks, firstWeighted);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_puppet_that_starts_in_a_goal_with_an_entry_resolve_begins_at_it()
|
||||
{
|
||||
var brain = new Brain { Start = 1, Goals = new[] { new GoalSpec { Id = "calm", Behaviour = Pose }, new GoalSpec { Id = "rage", EntryResolve = 0.6, Behaviour = Pose } } };
|
||||
var actor = new Actor(0.01, 1, new NerveParameters(), new WithdrawalParameters(), new DriveParameters(), brain);
|
||||
Assert.Equal(0.6, actor.Drive.Resolve);
|
||||
|
||||
var calm = new Actor(0.01, 1, new NerveParameters(), new WithdrawalParameters(), new DriveParameters(), brain with { Start = 0 });
|
||||
Assert.Equal(1.0, calm.Drive.Resolve);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue