Skip to content

Commit

Permalink
kudzu + chemicals in the water
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian321 committed Feb 6, 2025
1 parent 9de3fd2 commit 528618e
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Content.Client/Botany/PlantAnalyzer/PlantAnalyzerWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<RichTextLabel Margin="0 0 8 0" Name="Alive" Visible="false" Text="{Loc 'plant-analyzer-component-alive'}" />
<RichTextLabel Margin="0 0 8 0" Name="Dead" Visible="false" Text="{Loc 'plant-analyzer-component-dead'}" />
<RichTextLabel Margin="0 0 8 0" Name="Unviable" Visible="false" Text="{Loc 'plant-analyzer-component-unviable'}" />
<RichTextLabel Margin="0 0 8 0" Name="Kudzu" Visible="false" Text="{Loc 'plant-analyzer-component-kudzu'}" />
<RichTextLabel Margin="0 0 8 0" Name="Mutating" Visible="false" Text="{Loc 'plant-analyzer-component-mutating'}" />
</BoxContainer>
<GridContainer Name="PlantDataGrid" Margin="0 0 0 5" Columns="6" Visible="false">
Expand Down Expand Up @@ -95,6 +96,10 @@
<Label HorizontalAlignment="Right" Name="WeedResistanceLabel" />
</GridContainer>
<PanelContainer Name="ContainerDivider" Visible="false" StyleClasses="LowDivider" />
<BoxContainer Name="ChemicalsInWaterBox" Visible="false" Orientation="Horizontal" Margin="5">
<RichTextLabel Name="ChemicalsInWaterLabel" SetWidth="290" />
</BoxContainer>
<PanelContainer Name="ChemicalsInWaterDivider" Visible="false" StyleClasses="LowDivider" />
<BoxContainer Name="EnvironmentBox" Visible="false" Orientation="Horizontal" Margin="5">
<RichTextLabel Name="EnvironmentLabel" SetWidth="290" />
</BoxContainer>
Expand Down
21 changes: 21 additions & 0 deletions Content.Client/Botany/PlantAnalyzer/PlantAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void Populate(PlantAnalyzerScannedUserMessage msg)

Unviable.Visible = !msg.PlantData.Viable;
Mutating.Visible = msg.PlantData.Mutating;
Kudzu.Visible = msg.PlantData.Kudzu;

PlantDataGrid.Visible = true;
}
Expand Down Expand Up @@ -129,6 +130,26 @@ public void Populate(PlantAnalyzerScannedUserMessage msg)
}
ContainerDivider.Visible = ContainerGrid.Visible;


// Section 3.5: They are putting chemicals in the water!
if (msg.TrayData?.Chemicals != null)
{
var count = msg.TrayData.Chemicals.Count;
var holder = ContainerLabel.Text;
var chemicals = PlantAnalyzerLocalizationHelper.ChemicalsToLocalizedStrings(msg.TrayData.Chemicals, _prototypeManager);
if (count == 0)
ChemicalsInWaterLabel.Text = Loc.GetString("plant-analyzer-soil-empty", ("holder", holder));
else
ChemicalsInWaterLabel.Text = Loc.GetString("plant-analyzer-soil", ("count", count), ("holder", holder), ("chemicals", chemicals));

ChemicalsInWaterBox.Visible = true;
}
else
{
ChemicalsInWaterBox.Visible = false;
}
ChemicalsInWaterDivider.Visible = ChemicalsInWaterBox.Visible;

// Section 4: Tolerances part 2.
if (msg.TolerancesData is not null)
{
Expand Down
9 changes: 7 additions & 2 deletions Content.Server/Botany/Systems/PlantAnalyzerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using Content.Server.AbstractAnalyzer;
using Content.Server.Botany.Components;
using Content.Server.Popups;
using Content.Shared.Botany.PlantAnalyzer;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Labels.EntitySystems;
Expand All @@ -27,6 +29,7 @@ public sealed class PlantAnalyzerSystem : AbstractAnalyzerSystem<PlantAnalyzerCo
[Dependency] private readonly PaperSystem _paperSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedLabelSystem _labelSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -69,7 +72,8 @@ private PlantAnalyzerScannedUserMessage GatherData(PlantAnalyzerComponent analyz
lifespan: plantHolder.Seed.Lifespan,
dead: plantHolder.Dead,
viable: plantHolder.Seed.Viable,
mutating: plantHolder.MutationLevel > 0f
mutating: plantHolder.MutationLevel > 0f,
kudzu: plantHolder.Seed.TurnIntoKudzu
);
tolerancesData = new PlantAnalyzerTolerancesData(
waterConsumption: plantHolder.Seed.WaterConsumption,
Expand Down Expand Up @@ -99,7 +103,8 @@ private PlantAnalyzerScannedUserMessage GatherData(PlantAnalyzerComponent analyz
nutritionLevel: plantHolder.NutritionLevel,
toxins: plantHolder.Toxins,
pestLevel: plantHolder.PestLevel,
weedLevel: plantHolder.WeedLevel
weedLevel: plantHolder.WeedLevel,
chemicals: plantHolder.SoilSolution?.Comp.Solution.Contents.Select(r => r.Reagent.Prototype).ToList()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ public sealed class PlantAnalyzerScannedUserMessage(NetEntity? targetEntity, boo
/// Everything that is kept independed of a given plant/seed.
/// </summary>
[Serializable, NetSerializable]
public sealed class PlantAnalyzerTrayData(float waterLevel, float nutritionLevel, float toxins, float pestLevel, float weedLevel)
public sealed class PlantAnalyzerTrayData(float waterLevel, float nutritionLevel, float toxins, float pestLevel, float weedLevel, List<string>? chemicals)
{
public float WaterLevel = waterLevel;
public float NutritionLevel = nutritionLevel;
public float Toxins = toxins;
public float PestLevel = pestLevel;
public float WeedLevel = weedLevel;
public List<string>? Chemicals = chemicals;
}


Expand Down Expand Up @@ -54,7 +55,7 @@ public sealed class PlantAnalyzerTolerancesData(float nutrientConsumption, float
/// Information about the plant inside the tray.
/// </summary>
[Serializable, NetSerializable]
public sealed class PlantAnalyzerPlantData(string seedDisplayName, float health, float endurance, float age, float lifespan, bool dead, bool viable, bool mutating)
public sealed class PlantAnalyzerPlantData(string seedDisplayName, float health, float endurance, float age, float lifespan, bool dead, bool viable, bool mutating, bool kudzu)
{
public string SeedDisplayName = seedDisplayName;
public float Health = health;
Expand All @@ -64,6 +65,7 @@ public sealed class PlantAnalyzerPlantData(string seedDisplayName, float health,
public bool Dead = dead;
public bool Viable = viable;
public bool Mutating = mutating;
public bool Kudzu = kudzu;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ plant-analyzer-component-alive = [color=green]ALIVE[color]
plant-analyzer-component-dead = [color=red]DEAD[color]
plant-analyzer-component-unviable = [color=red]UNVIABLE[color]
plant-analyzer-component-mutating = [color=#00ff5f]MUTATING[color]
plant-analyzer-component-kudzu = [color=red]KUDZU[color]
plant-analyzer-soil = There is some [color=white]{$chemicals}[/color] in this {$holder} that {$count ->
[one]has
*[other]have
} not been absorbed.
plant-analyzer-soil-empty = There are no unabsorbed chemicals in this {$holder}.
plant-analyzer-component-environemt = This [color=green]{$seedName}[/color] requires an atmosphere at a pressure level of [color=lightblue]{$kpa}kPa ± {$kpaTolerance}kPa[/color], temperature of [color=lightsalmon]{$temp}°k ± {$tempTolerance}°k[/color] and a light level of [color=white]{$lightLevel} ± {$lightTolerance}[/color].
plant-analyzer-component-environemt-void = This [color=green]{$seedName}[/color] has to be grown [bolditalic]in the vacuum of space[/bolditalic] at a light level of [color=white]{$lightLevel} ± {$lightTolerance}[/color].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
backgroundImageTile: true
backgroundPatchMargin: 6.0, 0.0, 6.0, 0.0
contentMargin: 6.0, 6.0, 6.0, 6.0
maxWritableArea: 375.0, 550.0
maxWritableArea: 375.0, 600.0

0 comments on commit 528618e

Please sign in to comment.