Merge remote-tracking branch 'origin/codex/power-tiers' into codex/item-provenance
This commit is contained in:
commit
8a717542a4
17 changed files with 634 additions and 28 deletions
|
|
@ -111,6 +111,9 @@ public class AetherDrive : Behavior, IPowerConsumer
|
|||
return (draw.x + draw.y + draw.z) * dt;
|
||||
}
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Medium -- mobility, same as Thruster.
|
||||
public int DefaultPowerTier => PowerTiers.Medium;
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
var rotorSpeed = Rpm * _data.RotorDiameter / 100;
|
||||
|
|
|
|||
|
|
@ -124,11 +124,6 @@ public interface IProgressBehavior
|
|||
float Progress { get; }
|
||||
}
|
||||
|
||||
public interface IOrderedBehavior
|
||||
{
|
||||
int Order { get; }
|
||||
}
|
||||
|
||||
public interface IPopulationAssignment
|
||||
{
|
||||
int AssignedPopulation { get; set; }
|
||||
|
|
@ -140,9 +135,14 @@ public interface IPopulationAssignment
|
|||
// point -- a resolved stat and, where the map calls for one, a behaviour-supplied scalar such as Thruster's
|
||||
// throttle axis (set externally before the tick) -- never from work Execute itself would otherwise do. The
|
||||
// behaviour reads back how much of its own request was granted from Item.PowerSupply during its own Execute.
|
||||
//
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3): every kind of consumer also names the priority tier (PowerTiers.cs)
|
||||
// it defaults to. EquippedItem reads this exactly once, to seed EquippableItem.PowerTier the first time an item
|
||||
// without a player-chosen tier gets equipped -- after that the stored field is what PowerBus reads, never this.
|
||||
public interface IPowerConsumer
|
||||
{
|
||||
float PowerRequest(float dt);
|
||||
int DefaultPowerTier { get; }
|
||||
}
|
||||
|
||||
[Inspectable,
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ public class ConstantWeapon : Weapon, IProgressBehavior, IEventBehavior, IPowerC
|
|||
// Deactivate) before Entity.Update calls PowerBus.Step, so it is already current when this runs.
|
||||
public float PowerRequest(float dt) => _firing && StanceAllowsFire ? Evaluate(_data.Energy) * dt : 0f;
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Low -- offense, same as InstantWeapon.
|
||||
public int DefaultPowerTier => PowerTiers.Low;
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
base.Execute(dt);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public class EnergyDraw : Behavior, IPowerConsumer
|
|||
// direct Entity.TryConsumeEnergy spend that used to happen inside Execute.
|
||||
public float PowerRequest(float dt) => Evaluate(_data.EnergyDraw) * (_data.PerSecond ? dt : 1);
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Utility -- the generic/unclassified draw. An item
|
||||
// that declares power use without asking for a specific tier should not accidentally outrank a named one.
|
||||
public int DefaultPowerTier => PowerTiers.Utility;
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
// A consumable-hosted instance (Item null) has no PowerBus entry (§1.2's grants are keyed by
|
||||
|
|
|
|||
|
|
@ -143,6 +143,10 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior, IPowerCo
|
|||
return _capacitor.RequestedFill(dt);
|
||||
}
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Low -- offense. The ruling's own example of what
|
||||
// a reactor throttle should sacrifice first.
|
||||
public int DefaultPowerTier => PowerTiers.Low;
|
||||
|
||||
// Cut 4: whole-or-nothing against this behaviour's own input capacitor -- the operator's ruling ("no item
|
||||
// ever receives a fraction of a shot") means a fire attempt only ever succeeds at full charge, so the cost
|
||||
// spent is always exactly Capacity, never the possibly-stale cached Energy. A consumable-hosted instance
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ public class Radiator : Behavior, IAlwaysUpdatedBehavior, IInitializableBehavior
|
|||
return Evaluate(_data.EnergyUsage) * tempRatio * dt;
|
||||
}
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Critical -- the closest thing this game has to
|
||||
// life support. A starved radiator cascades into wear and shutdown across every other item on the hull.
|
||||
public int DefaultPowerTier => PowerTiers.Critical;
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
PumpedHeat = Evaluate(_data.PumpedHeat);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class ReactorData : BehaviorData
|
|||
}
|
||||
}
|
||||
|
||||
public class Reactor : Behavior, IOrderedBehavior
|
||||
public class Reactor : Behavior
|
||||
{
|
||||
private ReactorData _data;
|
||||
|
||||
|
|
@ -44,8 +44,9 @@ public class Reactor : Behavior, IOrderedBehavior
|
|||
|
||||
public float CurrentLoadRatio { get; private set; }
|
||||
|
||||
public int Order => 100;
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3): IOrderedBehavior/Order (was 100, the highest, so Reactor always
|
||||
// ran last) is deleted -- the bus now steps before any equipment's Execute regardless of order, and nothing
|
||||
// else claimed IOrderedBehavior, so the whole interface goes with its only implementer (§7 O3).
|
||||
public Reactor(ReactorData data, EquippedItem item) : base(data, item)
|
||||
{
|
||||
_data = data;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ public class Sensor : Behavior, IEventBehavior, IPowerConsumer
|
|||
return _capacitor.RequestedFill(dt);
|
||||
}
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Utility -- everything else.
|
||||
public int DefaultPowerTier => PowerTiers.Utility;
|
||||
|
||||
public void Ping()
|
||||
{
|
||||
// Whole-or-nothing against the ping's own input capacitor -- fires only at full charge (operator
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ public class Shield : Behavior, IProgressBehavior, IPowerConsumer
|
|||
return _reserve.RequestedFill(dt);
|
||||
}
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): High -- hull survival the player is actively
|
||||
// trading power for, but not the life-support constant Radiator is, so it sits one tier below.
|
||||
public int DefaultPowerTier => PowerTiers.High;
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
Efficiency = Evaluate(_data.Efficiency);
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ public class Thruster : Behavior, IAnalogBehavior, IPowerConsumer
|
|||
// PowerBus.Step, so it is already current when this runs.
|
||||
public float PowerRequest(float dt) => _input > .01f ? _input * Evaluate(_data.EnergyUsage) : 0f;
|
||||
|
||||
// Cut 5 (docs/stats-and-power-cut.md §1.3, PowerTiers.cs): Medium -- mobility. Losing thrust for a tick
|
||||
// under brownout is an inconvenience, not the cascading failure a starved radiator or shield causes.
|
||||
public int DefaultPowerTier => PowerTiers.Medium;
|
||||
|
||||
public override bool Execute(float dt)
|
||||
{
|
||||
Item.SetAudioParameter(SpecialAudioParameter.Intensity, _input);
|
||||
|
|
|
|||
Loading…
Reference in a new issue