Give verb: a stop is a verb with no receiver, and the type pattern skipped it; tests: second bay at a free cell
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7ac8f38901
commit
c1aab929b1
2 changed files with 4 additions and 4 deletions
|
|
@ -148,10 +148,10 @@ public static class PilotApplier
|
|||
for (var i = 0; i < command.Pings; i++) entity.Sensor?.Ping();
|
||||
foreach (var hail in command.Hails) entity.SetMessage(hail);
|
||||
foreach (var consumable in command.Uses) entity.TryActivateConsumable(consumable);
|
||||
if (command.GiveVerb is (Entity receiver, ItemInstance given, int quantity))
|
||||
if (command.GiveVerb is { } give)
|
||||
{
|
||||
if (receiver == null) CargoTransfer.End(entity, GiveEnd.Stopped);
|
||||
else if (!ReferenceEquals(receiver, entity)) CargoTransfer.Begin(entity, new GiveOrder(receiver, given, quantity));
|
||||
if (give.Receiver == null) CargoTransfer.End(entity, GiveEnd.Stopped);
|
||||
else if (!ReferenceEquals(give.Receiver, entity)) CargoTransfer.Begin(entity, new GiveOrder(give.Receiver, give.Item, give.Quantity));
|
||||
}
|
||||
if (command.Aim is float3 aim) entity.Aim = aim;
|
||||
foreach (var (behavior, pull) in command.Triggers)
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ public sealed class CargoTransferTests : IDisposable
|
|||
{
|
||||
// Two stacks in two bays: the order is for the design, not for the stack it was named with.
|
||||
var (giver, receiver, ore) = Alongside(3);
|
||||
Assert.True(giver.TryEquip(Mint("Crate"), new int2(3, 3)));
|
||||
Assert.True(giver.TryEquip(Mint("Crate"), new int2(2, 2)));
|
||||
Assert.True(giver.CargoBays[1].TryStore(Commodity("Ore", 4)));
|
||||
giver.Command.Give(receiver, ore, 7);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue