Skip to content

Commit

Permalink
Show geo survey % progress, hide atmosphere and minerals on entity wi…
Browse files Browse the repository at this point in the history
…ndow if not geo surveyed
  • Loading branch information
behindcurtain3 committed Mar 27, 2024
1 parent 5af15fc commit 43bfabf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ namespace Pulsar4X.Engine.Orders
{
public class MoveToNearestGeoSurveyAction : MoveToNearestAction
{
public override string Name => "Move to Nearest Geo Survey";
public override string Name => "Geo Survey Nearest";
public override string Details => "Moves the fleet to the nearest system body that can be geo surveyed.";
private bool GeoSurveyFilter(Entity entity)
{
return entity.HasDataBlob<SystemBodyInfoDB>()
&& !entity.HasDataBlob<StarInfoDB>()
&& (!entity.HasDataBlob<GeoSurveyableDB>() || !entity.GetDataBlob<GeoSurveyableDB>().IsSurveyComplete(RequestingFactionGuid));
return entity.HasDataBlob<GeoSurveyableDB>()
&& !entity.GetDataBlob<GeoSurveyableDB>().IsSurveyComplete(RequestingFactionGuid);
}

public static MoveToNearestGeoSurveyAction CreateCommand(int factionId, Entity commandingEntity)
Expand Down
6 changes: 4 additions & 2 deletions Pulsar4X/Pulsar4X.Client/EntityManagement/EntityWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,16 @@ private void DisplayConditionalTabs()
{
if(Entity.Manager == null) return;

bool isGeoSurveyed = Entity.HasDataBlob<GeoSurveyableDB>() ? Entity.GetDataBlob<GeoSurveyableDB>().IsSurveyComplete(_uiState.Faction.Id) : false;

foreach(var db in Entity.Manager.GetAllDataBlobsForEntity(Entity.Id))
{
if(db is AtmosphereDB && ImGui.BeginTabItem("Atmosphere"))
if(isGeoSurveyed && db is AtmosphereDB && ImGui.BeginTabItem("Atmosphere"))
{
((AtmosphereDB)db).Display(EntityState, _uiState);
ImGui.EndTabItem();
}
else if(db is MineralsDB && ImGui.BeginTabItem("Minerals"))
else if(isGeoSurveyed && db is MineralsDB && ImGui.BeginTabItem("Minerals"))
{
((MineralsDB)db).Display(EntityState, _uiState);
ImGui.EndTabItem();
Expand Down
13 changes: 2 additions & 11 deletions Pulsar4X/Pulsar4X.Client/GalaxyManagement/SystemTreeViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ private void PrintEntity(Entity entity, int depth = 0)
}
else
{
ImGui.Text("In Progress");
float percent = (1f - (float)geoSurveyableDB.GeoSurveyStatus[_uiState.Faction.Id] / (float)geoSurveyableDB.PointsRequired) * 100;
ImGui.Text(percent.ToString("#.##") + "%%");
}
}
else
Expand Down Expand Up @@ -186,15 +187,5 @@ private void PrintEntity(Entity entity, int depth = 0)
{
ImGui.TableNextRow();
}


// DisplayHelpers.PrintRow("Tectonic Activity", bodyInfoDb.Tectonics.ToDescription());
// DisplayHelpers.PrintRow("Gravity", Stringify.Velocity(bodyInfoDb.Gravity));
// DisplayHelpers.PrintRow("Temperature", bodyInfoDb.BaseTemperature.ToString("#.#") + " C");
// DisplayHelpers.PrintRow("Length of Day", bodyInfoDb.LengthOfDay.TotalHours + " hours");
// DisplayHelpers.PrintRow("Tilt", bodyInfoDb.AxialTilt.ToString("#") + "°");
// DisplayHelpers.PrintRow("Magnetic Field", bodyInfoDb.MagneticField.ToString("#") + " μT");
// DisplayHelpers.PrintRow("Radiation Level", bodyInfoDb.RadiationLevel.ToString("#"));
// DisplayHelpers.PrintRow("Atmospheric Dust", bodyInfoDb.AtmosphericDust.ToString("#"), separator: false);
}
}

0 comments on commit 43bfabf

Please sign in to comment.