Skip to content

Commit

Permalink
Merge branch 'master' into dfan-parcel
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 authored Sep 14, 2024
2 parents afad96a + c01beff commit 659cc29
Show file tree
Hide file tree
Showing 208 changed files with 3,392 additions and 532 deletions.
3 changes: 2 additions & 1 deletion Content.Client/Power/PowerMonitoringWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed partial class PowerMonitoringWindow : FancyWindow
[Dependency] private IEntityManager _entManager = default!;
private readonly SpriteSystem _spriteSystem;
[Dependency] private IGameTiming _gameTiming = default!;
[Dependency] private SharedTransformSystem _transformSystem = default!; // Frontier modification
private SharedTransformSystem _transformSystem; // Frontier modification

private const float BlinkFrequency = 1f;

Expand All @@ -42,6 +42,7 @@ public PowerMonitoringWindow()
IoCManager.InjectDependencies(this);

_spriteSystem = _entManager.System<SpriteSystem>();
_transformSystem = _entManager.System<SharedTransformSystem>(); // Frontier

// Set trackable entity selected action
NavMap.TrackedEntitySelectedAction += SetTrackedEntityFromNavMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
private bool _isPopulating;

private StationRecordFilterType _currentFilterType;
[Dependency] private readonly IPrototypeManager _prototype = default!; // Frontier

public GeneralStationRecordConsoleWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this); // Frontier

_currentFilterType = StationRecordFilterType.Name;

Expand Down Expand Up @@ -178,10 +180,21 @@ private void PopulateJobsContainer(IReadOnlyDictionary<ProtoId<JobPrototype>, in
JobListing.RemoveAllChildren();
foreach (var (job, amount) in jobList)
{
// Skip overflow jobs.
if (amount < 0 || amount is null)
continue;

// Get proper job names when possible
string jobName;
if (_prototype.TryIndex(job, out var jobProto))
jobName = jobProto.LocalizedName;
else
jobName = job;

var jobEntry = new JobRow
{
Job = job,
JobName = { Text = job },
JobName = { Text = jobName },
JobAmount = { Text = amount.ToString() },
};
jobEntry.DecreaseJobSlot.OnPressed += (args) => { OnJobSubtract?.Invoke(args); };
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Content.Shared._NF.PlantAnalyzer;
using JetBrains.Annotations;

namespace Content.Client._NF.PlantAnalyzer.UI;

[UsedImplicitly]
public sealed class PlantAnalyzerBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private PlantAnalyzerWindow? _window;

public PlantAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();
_window = new PlantAnalyzerWindow(this)
{
Title = Loc.GetString("plant-analyzer-interface-title"),
};
_window.OnClose += Close;
_window.OpenCenteredLeft();
}

protected override void ReceiveMessage(BoundUserInterfaceMessage message)
{
if (_window == null)
return;

if (message is not PlantAnalyzerScannedSeedPlantInformation cast)
return;
_window.Populate(cast);
}

public void AdvPressed(bool scanMode)
{
SendMessage(new PlantAnalyzerSetMode(scanMode));
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

if (_window != null)
_window.OnClose -= Close;

_window?.Dispose();
}
}
50 changes: 50 additions & 0 deletions Content.Client/_NF/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'plant-analyzer-interface-title'}">
<!-- Margin="left,top,right,bottom" -->
<GridContainer Rows="3" Name ="GridCont" Margin="10 5 10 5" VerticalAlignment="Stretch" HorizontalExpand="True">
<BoxContainer Name="Toggle">
<Label Name="AdvMode" Text="{Loc 'plant-analyzer-window-scanmode'}" Margin="5 0 5 0"/>
<Button Name="OnButton" Text="{Loc 'plant-analyzer-window-mode-on'}" StyleClasses="OpenRight"/>
<Button Name="OffButton" Text="{Loc 'plant-analyzer-window-mode-off'}" StyleClasses="OpenLeft"/>
</BoxContainer>
<BoxContainer Name="Top">
<Label Name="NoData" Text="{Loc 'plant-analyzer-window-no-seed-information-text'}" Margin="10 0 0 0"/>
</BoxContainer>
<TabContainer Name="Tabs" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" HorizontalExpand="True">
<BoxContainer Name ="{Loc 'plant-analyzer-window-tab-basics'}" Orientation="Vertical" VerticalAlignment="Stretch" Margin="10 0 5 0">
<Label Name="PlantName" Margin="0 5 0 5"/>
<Label Name="PlantYield" Margin="0 5 0 5"/>
<Label Name="Potency" Margin="0 5 0 5"/>
<Label Name="Repeat" Margin="0 5 0 5"/>
<Label Name="Chemicals" Margin="0 5 0 5"/>
<Label Name="ConsumeGases" Margin="0 5 0 5" />
<Label Name="ExudeGases" Margin="0 5 0 5" />
<Label Name="Lifespan" Margin="0 5 0 5"/>
<Label Name="Maturation" Margin="0 5 0 5"/>
<Label Name="Production" Margin="0 5 0 5"/>
<Label Name="GrowthStages" Margin="0 5 0 5"/>
<Label Name="Endurance" Margin="0 5 0 5"/>
</BoxContainer>
<BoxContainer Name="{Loc 'plant-analyzer-window-tab-tolerances'}" Orientation="Vertical" VerticalAlignment="Stretch" Margin="10 0 5 0">
<Label Name="NutrientUsage" Margin="0 5 0 5"/>
<Label Name="WaterUsage" Margin="0 5 0 5"/>
<Label Name="IdealHeat" Margin="0 5 0 5"/>
<Label Name="HeatTolerance" Margin="0 5 0 5"/>
<Label Name="IdealLight" Margin="0 5 0 5"/>
<Label Name="LightTolerance" Margin="0 5 0 5"/>
<Label Name="ToxinsTolerance" Margin="0 5 0 5"/>
<Label Name="LowPressureTolerance" Margin="0 5 0 5"/>
<Label Name="HighPressureTolerance" Margin="0 5 0 5"/>
<Label Name="PestTolerance" Margin="0 5 0 5"/>
<Label Name="WeedTolerance" Margin="0 5 0 5"/>
</BoxContainer>
<BoxContainer Name="{Loc 'plant-analyzer-window-tab-mutations'}" Orientation="Vertical" VerticalAlignment="Stretch" Margin="10 0 5 0">
<Label Name="PlantSpeciation" Margin="0 5 0 5"/>
<Label Name="Traits" Margin="0 5 0 5"/>
<Label Name="ExtraInfo" Margin="0 5 0 5"/>
</BoxContainer>
</TabContainer>
</GridContainer>
</controls:FancyWindow>
218 changes: 218 additions & 0 deletions Content.Client/_NF/PlantAnalyzer/UI/PlantAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
using Content.Shared._NF.PlantAnalyzer;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using System.Linq;
using System.Text;
using FancyWindow = Content.Client.UserInterface.Controls.FancyWindow;

namespace Content.Client._NF.PlantAnalyzer.UI;

[GenerateTypedNameReferences]
public sealed partial class PlantAnalyzerWindow : FancyWindow
{
private readonly IEntityManager _entityManager;
private readonly ButtonGroup _buttonGroup = new();

private const string IndentedNewline = "\n ";

public PlantAnalyzerWindow(PlantAnalyzerBoundUserInterface owner)
{
RobustXamlLoader.Load(this);

var dependencies = IoCManager.Instance!;
_entityManager = dependencies.Resolve<IEntityManager>();

OnButton.Group = _buttonGroup;
OnButton.ToggleMode = true;
OffButton.Group = _buttonGroup;
OffButton.ToggleMode = true;

OnButton.OnPressed += _ => owner.AdvPressed(true);
OffButton.OnPressed += _ => owner.AdvPressed(false);
}

public void Populate(PlantAnalyzerScannedSeedPlantInformation msg)
{
var target = _entityManager.GetEntity(msg.TargetEntity);
Title = Loc.GetString("plant-analyzer-interface-title");

if (target == null)
{
NoData.Visible = true;
return;
}
NoData.Visible = false;

if (msg.AdvancedInfo is not null)
{
OnButton.Pressed = true;
}
else
{
OffButton.Pressed = true;
}

// Process message fields into strings.
StringBuilder chemString = new();
if (msg.SeedChem != null)
{
foreach (var chem in msg.SeedChem)
{
chemString.Append(IndentedNewline);
chemString.Append(chem);
}
}

StringBuilder exudeGases = GetStringFromGasFlags(msg.ExudeGases);
StringBuilder consudeGases = GetStringFromGasFlags(msg.ConsumeGases);

if (msg.IsTray)
PlantName.Text = Loc.GetString("plant-analyzer-window-label-name-scanned-plant", ("seedName", Loc.GetString(string.IsNullOrEmpty(msg.SeedName) ? "plant-analyzer-unknown-plant" : msg.SeedName)));
else
PlantName.Text = Loc.GetString("plant-analyzer-window-label-name-scanned-seed", ("seedName", Loc.GetString(string.IsNullOrEmpty(msg.SeedName) ? "plant-analyzer-unknown-plant" : msg.SeedName)));
// Basics
PlantYield.Text = Loc.GetString("plant-analyzer-plant-yield-text", ("seedYield", $"{msg.SeedYield:D0}"));
Potency.Text = Loc.GetString("plant-analyzer-plant-potency-text", ("seedPotency", $"{msg.SeedPotency:F0}"));
Repeat.Text = Loc.GetString("plant-analyzer-plant-harvest-text", ("plantHarvestType", Loc.GetString($"plant-analyzer-harvest-{msg.HarvestType}").ToString()));
Endurance.Text = Loc.GetString("plant-analyzer-plant-endurance-text", ("seedEndurance", $"{msg.Endurance:F0}"));
Chemicals.Text = Loc.GetString("plant-analyzer-plant-chemistry-text", ("seedChem", chemString));
ExudeGases.Text = Loc.GetString("plant-analyzer-plant-exude-text", ("gases", exudeGases.Length == 0 ? Loc.GetString("plant-analyzer-plant-gases-none") : exudeGases.ToString()));
ConsumeGases.Text = Loc.GetString("plant-analyzer-plant-consume-text", ("gases", consudeGases.Length == 0 ? Loc.GetString("plant-analyzer-plant-gases-none") : consudeGases.ToString()));
Lifespan.Text = Loc.GetString("plant-analyzer-plant-lifespan-text", ("lifespan", $"{msg.Lifespan:F1}"));
Maturation.Text = Loc.GetString("plant-analyzer-plant-maturation-text", ("maturation", $"{msg.Maturation:F1}"));
Production.Text = Loc.GetString("plant-analyzer-plant-production-text", ("production", $"{msg.Production:F1}"));
GrowthStages.Text = Loc.GetString("plant-analyzer-plant-growthstages-text", ("growthStages", $"{msg.GrowthStages:D0}"));
// Tolerances
var adv = msg.AdvancedInfo;
NutrientUsage.Text = Loc.GetString("plant-analyzer-tolerance-nutrient-usage", ("nutrientUsage", adv is null ? "-" : $"{adv.Value.NutrientConsumption:F2}"));
WaterUsage.Text = Loc.GetString("plant-analyzer-tolerance-water-usage", ("waterUsage", adv is null ? "-" : $"{adv.Value.WaterConsumption:F2}"));
IdealHeat.Text = Loc.GetString("plant-analyzer-tolerance-ideal-heat", ("idealHeat", adv is null ? "-" : $"{adv.Value.IdealHeat:F0}"));
HeatTolerance.Text = Loc.GetString("plant-analyzer-tolerance-heat-tolerance", ("heatTolerance", adv is null ? "-" : $"{adv.Value.HeatTolerance:F1}"));
IdealLight.Text = Loc.GetString("plant-analyzer-tolerance-ideal-light", ("idealLight", adv is null ? "-" : $"{adv.Value.IdealLight:F1}"));
LightTolerance.Text = Loc.GetString("plant-analyzer-tolerance-light-tolerance", ("lightTolerance", adv is null ? "-" : $"{adv.Value.LightTolerance:F1}"));
ToxinsTolerance.Text = Loc.GetString("plant-analyzer-tolerance-toxin-tolerance", ("toxinsTolerance", adv is null ? "-" : $"{adv.Value.ToxinsTolerance:F1}"));
LowPressureTolerance.Text = Loc.GetString("plant-analyzer-tolerance-low-pressure", ("lowPressureTolerance", adv is null ? "-" : $"{adv.Value.LowPressureTolerance:F1}")); ;
HighPressureTolerance.Text = Loc.GetString("plant-analyzer-tolerance-high-pressure", ("highPressureTolerance", adv is null ? "-" : $"{adv.Value.HighPressureTolerance:F1}"));
PestTolerance.Text = Loc.GetString("plant-analyzer-tolerance-pest-tolerance", ("pestTolerance", adv is null ? "-" : $"{adv.Value.PestTolerance:F1}"));
WeedTolerance.Text = Loc.GetString("plant-analyzer-tolerance-weed-tolerance", ("weedTolerance", adv is null ? "-" : $"{adv.Value.WeedTolerance:F1}"));
// Misc

if (adv != null)
{
var advInst = adv.Value;
StringBuilder mutations = new();
if (advInst.Mutations.HasFlag(MutationFlags.TurnIntoKudzu))
{
mutations.Append(IndentedNewline);
mutations.Append(Loc.GetString("plant-analyzer-mutation-turnintokudzu"));
}
if (advInst.Mutations.HasFlag(MutationFlags.Seedless))
{
mutations.Append(IndentedNewline);
mutations.Append(Loc.GetString("plant-analyzer-mutation-seedless"));
}
if (advInst.Mutations.HasFlag(MutationFlags.Slip))
{
mutations.Append(IndentedNewline);
mutations.Append(Loc.GetString("plant-analyzer-mutation-slip"));
}
if (advInst.Mutations.HasFlag(MutationFlags.Sentient))
{
mutations.Append(IndentedNewline);
mutations.Append(Loc.GetString("plant-analyzer-mutation-sentient"));
}
if (advInst.Mutations.HasFlag(MutationFlags.Ligneous))
{
mutations.Append(IndentedNewline);
mutations.Append(Loc.GetString("plant-analyzer-mutation-ligneous"));
}
// if (advInst.Mutations.HasFlag(MutationFlags.Bioluminescent))
// {
// mutations.Append(IndentedNewline);
// mutations.Append(Loc.GetString("plant-analyzer-mutation-bioluminescent"));
// }
if (advInst.Mutations.HasFlag(MutationFlags.CanScream))
{
mutations.Append(IndentedNewline);
mutations.Append(Loc.GetString("plant-analyzer-mutation-canscream"));
}

Traits.Text = Loc.GetString("plant-analyzer-plant-mutations-text", ("traits", mutations.ToString()));
}
else
{
Traits.Text = Loc.GetString("plant-analyzer-plant-mutations-text", ("traits", "-"));
}

StringBuilder speciation = new();
if (msg.Speciation is null)
{
speciation.Append("-");
}
else
{
foreach (var species in msg.Speciation)
{
speciation.Append(IndentedNewline);
speciation.Append(Loc.GetString(species));
}
}

PlantSpeciation.Text = Loc.GetString("plant-analyzer-plant-speciation-text", ("speciation", speciation.ToString()));
}

private StringBuilder GetStringFromGasFlags(GasFlags flags)
{
StringBuilder output = new();
if (flags.HasFlag(GasFlags.Nitrogen))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-nitrogen"));
}
if (flags.HasFlag(GasFlags.Oxygen))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-oxygen"));
}
if (flags.HasFlag(GasFlags.CarbonDioxide))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-co2"));
}
if (flags.HasFlag(GasFlags.Plasma))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-plasma"));
}
if (flags.HasFlag(GasFlags.Tritium))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-tritium"));
}
if (flags.HasFlag(GasFlags.WaterVapor))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-water-vapor"));
}
if (flags.HasFlag(GasFlags.Ammonia))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-ammonia"));
}
if (flags.HasFlag(GasFlags.NitrousOxide))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-n2o"));
}
if (flags.HasFlag(GasFlags.Frezon))
{
output.Append(IndentedNewline);
output.Append(Loc.GetString("gases-frezon"));
}
return output;
}
}
8 changes: 0 additions & 8 deletions Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
using Content.Server.Bank;
using Content.Server.Cargo.Components;
using Content.Server.Labels.Components;
// FRONTIER MERGE: BEGIN CRUFT
using Content.Server.Paper;
using Content.Server.DeviceLinking.Systems;
using Content.Server.Popups;
using Content.Server.Station.Systems;
using Content.Shared.Access.Systems;
using Content.Shared.Administration.Logs;
// FRONTIER MERGE: END CRUFT
using Content.Shared.Bank.Components; // Frontier
using Content.Server.Station.Components;
using Content.Shared.Cargo;
Expand Down
Loading

0 comments on commit 659cc29

Please sign in to comment.