Thermal Performance Threshold & Thermal Override

Items will switch themselves off below a customizable threshold to avoid damage
Player can toggle thermal override to disable safety shutdown
Selecting an item allows player to select whether the item will override
Clicking on the background of an inventory panel will display general ship settings (including thermal shutdown threshold)
Performance Stat evaluation has been moved to EquippedItem, slight performance improvement
Item online and active status are now reactive properties
Created player settings file to store e.g. shutdown threshold
Fixed crash when entering wormhole while enemies are visible
This commit is contained in:
Reinier Vens 2021-03-07 01:10:31 +00:00
commit 1092159063
66 changed files with 756 additions and 206 deletions

View file

@ -94,26 +94,38 @@ public class Ship : Entity
_forwardThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.Reversed));
RecalculateForwardThrust();
foreach (var thruster in _forwardThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateForwardThrust());
_reverseThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.None));
RecalculateReverseThrust();
foreach (var thruster in _reverseThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateReverseThrust());
_rightThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.CounterClockwise));
RecalculateRightStrafeThrust();
foreach (var thruster in _rightThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateRightStrafeThrust());
_leftThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.Clockwise));
RecalculateLeftStrafeThrust();
foreach (var thruster in _leftThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateLeftStrafeThrust());
_counterClockwiseThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Torque < -ItemManager.GameplaySettings.TorqueFloor));
RecalculateCounterClockwiseTorque();
foreach (var thruster in _counterClockwiseThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateCounterClockwiseTorque());
_clockwiseThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Torque > ItemManager.GameplaySettings.TorqueFloor));
RecalculateClockwiseTorque();
foreach (var thruster in _clockwiseThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateClockwiseTorque());
}
public Ship(ItemManager itemManager, Zone zone, EquippableItem hull) : base(itemManager, zone, hull)
@ -138,8 +150,6 @@ public class Ship : Entity
}
ItemDamage.Select(x => x.item).Subscribe(CheckForThruster);
ItemOffline.Subscribe(CheckForThruster);
ItemOnline.Subscribe(CheckForThruster);
}
#region ThrustCalculation
@ -149,7 +159,7 @@ public class Ship : Entity
ForwardThrust = 0;
foreach (var thruster in _forwardThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
ForwardThrust += thruster.Thrust;
}
}
@ -159,7 +169,7 @@ public class Ship : Entity
ReverseThrust = 0;
foreach (var thruster in _reverseThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
ReverseThrust += thruster.Thrust;
}
}
@ -170,7 +180,7 @@ public class Ship : Entity
LeftStrafeTotalTorque = 0;
foreach (var thruster in _leftThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
{
LeftStrafeThrust += thruster.Thrust;
LeftStrafeTotalTorque += thruster.Torque * thruster.Thrust;
@ -187,7 +197,7 @@ public class Ship : Entity
RightStrafeTotalTorque = 0;
foreach (var thruster in _rightThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
{
RightStrafeThrust += thruster.Thrust;
RightStrafeTotalTorque += thruster.Torque * thruster.Thrust;
@ -203,7 +213,7 @@ public class Ship : Entity
ClockwiseTorque = 0;
foreach (var thruster in _clockwiseThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
ClockwiseTorque += thruster.Torque;
}
}
@ -213,7 +223,7 @@ public class Ship : Entity
CounterClockwiseTorque = 0;
foreach (var thruster in _counterClockwiseThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
CounterClockwiseTorque -= thruster.Torque;
}
}