Command seam fixes: the player's switches, ping and stance flips are PilotCommand presses; triggers, switches and ping are internal

ActivatedBehavior replaces IActivatedBehavior so Activate/Deactivate can be internal under Unity's C# 9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-22 04:33:20 +02:00
commit bc05417450
14 changed files with 70 additions and 66 deletions

View file

@ -87,10 +87,15 @@ public abstract class Behavior
}
}
public interface IActivatedBehavior
// A behaviour its pilot triggers. Only PilotApplier pulls and releases it, from the pilot's PilotCommand (Pull, Release),
// so Activate and Deactivate are internal to the simulation: no script outside it triggers one in place.
public abstract class ActivatedBehavior : Behavior
{
void Activate();
void Deactivate();
protected ActivatedBehavior(BehaviorData data, EquippedItem item) : base(data, item) { }
protected ActivatedBehavior(BehaviorData data, ConsumableItemEffect consumable) : base(data, consumable) { }
internal abstract void Activate();
internal abstract void Deactivate();
}
public interface IEventBehavior

View file

@ -167,7 +167,7 @@ public class ChargedWeapon : InstantWeapon
return base.Execute(dt);
}
public override void Activate()
internal override void Activate()
{
// CanFire also holds a weapon whose released charge has a burst pending: its cooldown starts at its first round,
// so a charge started before then would overlap it.
@ -180,7 +180,7 @@ public class ChargedWeapon : InstantWeapon
}
}
public override void Deactivate()
internal override void Deactivate()
{
if (_charging)
{

View file

@ -198,7 +198,7 @@ public class ConstantWeapon : Weapon, IProgressBehavior, IEventBehavior, IPowerC
return true;
}
public override void Activate()
internal override void Activate()
{
// A refused beam never starts (operator ruling 2026-09-30): OnStartFiring drives the beam's visuals and
// audio, so starting it only for Execute to stop it a tick later would flash a beam that fires nothing.
@ -209,7 +209,7 @@ public class ConstantWeapon : Weapon, IProgressBehavior, IEventBehavior, IPowerC
}
}
public override void Deactivate()
internal override void Deactivate()
{
if (_firing)
{

View file

@ -286,7 +286,7 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior, IPowerCo
return true;
}
public override void Activate()
internal override void Activate()
{
if(CanFire)
Trigger();

View file

@ -136,7 +136,7 @@ public class Sensor : Behavior, IEventBehavior, IPowerConsumer
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Utility -- everything else.
public int DefaultPowerTier => PowerTiers.Utility;
public void Ping()
internal void Ping()
{
// Whole-or-nothing against the ping's own input capacitor -- fires only at full charge (operator
// ruling: no fraction of a shot). A consumable-hosted instance (Item == null) has no PowerBus entry, so

View file

@ -20,11 +20,11 @@ public class SwitchData : BehaviorData
}
}
public class Switch : Behavior, IActivatedBehavior
public class Switch : ActivatedBehavior
{
private SwitchData _data;
public bool Activated { get; set; }
public bool Activated { get; private set; }
public Switch(SwitchData data, EquippedItem item) : base(data, item)
{
@ -40,12 +40,12 @@ public class Switch : Behavior, IActivatedBehavior
return Activated;
}
public void Activate()
internal override void Activate()
{
Activated = true;
}
public void Deactivate()
internal override void Deactivate()
{
Activated = false;
}

View file

@ -20,9 +20,9 @@ public class TriggerData : BehaviorData
}
}
public class Trigger : Behavior, IActivatedBehavior
public class Trigger : ActivatedBehavior
{
public bool _pulled;
private bool _pulled;
public Trigger(TriggerData data, EquippedItem item) : base(data, item) { }
public Trigger(TriggerData data, ConsumableItemEffect item) : base(data, item) { }
@ -38,12 +38,12 @@ public class Trigger : Behavior, IActivatedBehavior
return false;
}
public void Activate()
internal override void Activate()
{
_pulled = true;
}
public void Deactivate()
internal override void Deactivate()
{
}
}

View file

@ -100,7 +100,7 @@ public abstract class WeaponData : BehaviorData
public float RatedRange => Range.Max;
}
public abstract class Weapon : Behavior, IActivatedBehavior
public abstract class Weapon : ActivatedBehavior
{
private WeaponData _data;
@ -179,12 +179,12 @@ public abstract class Weapon : Behavior, IActivatedBehavior
return true;
}
public virtual void Activate()
internal override void Activate()
{
_firing = true;
}
public virtual void Deactivate()
internal override void Deactivate()
{
_firing = false;
}