Skip to content

Commit

Permalink
Added non fuel cargo volume, and transfer rate and range to shipdesig…
Browse files Browse the repository at this point in the history
…n window statistics
  • Loading branch information
se5a committed Dec 13, 2024
1 parent 52899e8 commit 894d1b0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Pulsar4X/Pulsar4X.Client/Interface/Styles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ public static class Styles
public static Vector4 GoodColor = new (0.25f, 1f, 0.25f, 0.9f);
public static Vector4 DescriptiveColor = new (0.45f, 0.45f, 0.45f, 1f);

public static Vector4 OkColor = new (1.0f, 1.0f, 0.25f, 0.9f);
public static Vector4 BadColor = new (1.0f, 0.25f, 0.25f, 0.9f);
public static Vector4 OkColor = new (1.0f, 1.0f, 0.25f, 0.9f);
public static Vector4 MediocreColor = new (1.0f, 0.75f, 0.25f, 0.9f);
public static Vector4 BadColor = new (1.0f, 0.25f, 0.25f, 0.9f);
public static Vector4 TerribleColor = new (1.0f, 0.05f, 0.05f, 1.0f);

public static Vector4 SelectedColor = new Vector4(0.75f, 0.25f, 0.25f, 1f);
Expand Down
45 changes: 39 additions & 6 deletions Pulsar4X/Pulsar4X.Client/Interface/Windows/ShipDesignWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,33 @@ internal void DisplayStats()
ImGui.TableNextColumn();
ImGui.Text(Stringify.Energy(_estor));

if (_cvol > 0)
{
ImGui.TableNextColumn();
ImGui.Text("Cargo Storage");
ImGui.TableNextColumn();
ImGui.Text(Stringify.VolumeLtr(_cvol));


ImGui.TableNextColumn();
ImGui.Text("Cargo Transfer Rate");
ImGui.TableNextColumn();
if(_trate == 0)
ImGui.PushStyleColor(ImGuiCol.Text, Styles.MediocreColor);
ImGui.Text(Stringify.Mass(_trate));
if(_trate == 0)
ImGui.PopStyleColor();
ImGui.TableNextColumn();
ImGui.Text("Cargo Transfer Range");
ImGui.TableNextColumn();
if(_trnge == 0)
ImGui.PushStyleColor(ImGuiCol.Text, Styles.MediocreColor);
ImGui.Text(Stringify.Velocity(_trnge));
if(_trnge == 0)
ImGui.PopStyleColor();

}

ImGui.EndTable();
}

Expand Down Expand Up @@ -808,11 +835,7 @@ private void UpdateShipStats()

cstore = StorageSpaceProcessor.CalculatedMaxStorage(_workingDesign);
var cargoTransfer = StorageSpaceProcessor.CalcRateAndRange(_workingDesign);
foreach (var store in cstore)
{
if (store.Key != thrusterFuel)
_cvol += store.Value;
}




Expand All @@ -832,7 +855,10 @@ private void UpdateShipStats()
_egen = egen;
_estor = estor;
_trate = cargoTransfer.rate;
_trnge = cargoTransfer.range;
if(double.IsNaN(cargoTransfer.range))
_trnge = 0;
else
_trnge = cargoTransfer.range;
//double fuelMass = 0;
if (thrusterFuel.IsNotNullOrEmpty())
{
Expand All @@ -846,6 +872,13 @@ private void UpdateShipStats()
}
}

_cvol = 0;
foreach (var store in cstore)
{
if (_fuelType == null || store.Key != _fuelType.CargoTypeID)
_cvol += store.Value;
}

_massWet = _massDry + _fuelStoreMass;
_dv = OrbitMath.TsiolkovskyRocketEquation(_massWet, _massDry, ev);

Expand Down

0 comments on commit 894d1b0

Please sign in to comment.