Skip to content

Commit

Permalink
label the printout + print viability
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian321 committed Feb 6, 2025
1 parent a27fb87 commit 9de3fd2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
16 changes: 10 additions & 6 deletions Content.Server/Botany/Systems/PlantAnalyzerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Botany.PlantAnalyzer;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Labels.EntitySystems;
using Content.Shared.Paper;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
Expand All @@ -25,6 +26,7 @@ public sealed class PlantAnalyzerSystem : AbstractAnalyzerSystem<PlantAnalyzerCo
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly PaperSystem _paperSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedLabelSystem _labelSystem = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -135,11 +137,11 @@ private void OnPrint(EntityUid uid, PlantAnalyzerComponent component, PlantAnaly
}

var data = GatherData(component);
var missingDataFtl = "plant-analyzer-printout-missing";
var missingData = Loc.GetString(missingDataFtl);
var missingData = Loc.GetString("plant-analyzer-printout-missing");

var seedName = data.PlantData is not null ? Loc.GetString(data.PlantData.SeedDisplayName) : null;
(string, string)[] parameters = [
("seedName", Loc.GetString(data.PlantData?.SeedDisplayName ?? missingDataFtl)),
("seedName", seedName ?? missingData),
("produce", data.ProduceData is not null ? PlantAnalyzerLocalizationHelper.ProduceToLocalizedStrings(data.ProduceData.Produce, _prototypeManager).Plural : missingData),
("water", data.TolerancesData?.WaterConsumption.ToString("0.00") ?? missingData),
("nutrients", data.TolerancesData?.NutrientConsumption.ToString("0.00") ?? missingData),
Expand All @@ -154,19 +156,21 @@ private void OnPrint(EntityUid uid, PlantAnalyzerComponent component, PlantAnaly
("lightLevel", data.TolerancesData?.IdealLight.ToString("0.00") ?? missingData),
("lightTolerance", data.TolerancesData?.LightTolerance.ToString("0.00") ?? missingData),
("n", data.ProduceData?.Yield.ToString("0") ?? missingData),
("potency", Loc.GetString(data.ProduceData?.Potency ?? missingDataFtl)),
("potency", data.ProduceData is not null ? Loc.GetString(data.ProduceData.Potency) : missingData),
("chemicals", data.ProduceData is not null ? PlantAnalyzerLocalizationHelper.ChemicalsToLocalizedStrings(data.ProduceData.Chemicals, _prototypeManager) : missingData),
("gasesOut", data.ProduceData is not null ? PlantAnalyzerLocalizationHelper.GasesToLocalizedStrings(data.ProduceData.ExudeGasses, _prototypeManager) : missingData),
("endurance", data.PlantData?.Endurance.ToString("0.00") ?? missingData),
("lifespan", data.PlantData?.Lifespan.ToString("0.00") ?? missingData),
("seedless", data.ProduceData is not null ? (data.ProduceData.Seedless ? "yes" : "no") : "other"),
("seeds", data.ProduceData is not null ? (data.ProduceData.Seedless ? "no" : "yes") : "other"),
("viable", data.PlantData is not null ? (data.PlantData.Viable ? "yes" : "no") : "other"),
("indent", " ")
];
var text = new StringBuilder();
for (var i = 0; i < 21; i++)
for (var i = 0; i < 22; i++)
text.AppendLine(Loc.GetString($"plant-analyzer-printout-l{i}", [.. parameters]));

_paperSystem.SetContent((printed, paperComp), text.ToString().TrimEnd('\r', '\n'));
_labelSystem.Label(printed, seedName);
_audioSystem.PlayPvs(component.SoundPrint, uid,
AudioParams.Default
.WithVariation(0.25f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,30 @@ plant-analyzer-printout-missing = N/A
plant-analyzer-printout-l0 = [color=#9FED58][head=2]Plant Analyzer Report[/head][/color]
plant-analyzer-printout-l1 = ──────────────────────────────
plant-analyzer-printout-l2 = [bullet/] Species: {$seedName}
plant-analyzer-printout-l3 = {$indent}[bullet/] Endurance: {$endurance}
plant-analyzer-printout-l4 = {$indent}[bullet/] Lifespan: {$lifespan}
plant-analyzer-printout-l5 = {$indent}[bullet/] Product: [color=#a4885c]{$produce}[/color]
plant-analyzer-printout-l6 = [bullet/] Growth profile:
plant-analyzer-printout-l7 = {$indent}[bullet/] Water: [color=cyan]{$water}[/color]
plant-analyzer-printout-l8 = {$indent}[bullet/] Nutrition: [color=orange]{$nutrients}[/color]
plant-analyzer-printout-l9 = {$indent}[bullet/] Toxins: [color=yellowgreen]{$toxins}[/color]
plant-analyzer-printout-l10 = {$indent}[bullet/] Pests: [color=magenta]{$pests}[/color]
plant-analyzer-printout-l11 = {$indent}[bullet/] Weeds: [color=red]{$weeds}[/color]
plant-analyzer-printout-l12 = [bullet/] Environmental profile:
plant-analyzer-printout-l13 = {$indent}[bullet/] Composition: [bold]{$gasesIn}[/bold]
plant-analyzer-printout-l14 = {$indent}[bullet/] Pressure: [color=lightblue]{$kpa}kPa ± {$kpaTolerance}kPa[/color]
plant-analyzer-printout-l15 = {$indent}[bullet/] Temperature: [color=lightsalmon]{$temp}°k ± {$tempTolerance}°k[/color]
plant-analyzer-printout-l16 = {$indent}[bullet/] Light: [color=gray][bold]{$lightLevel} ± {$lightTolerance}[/bold][/color]
plant-analyzer-printout-l17 = [bullet/] Flowers: [color=lightgreen]{$n} {$potency}[/color]
plant-analyzer-printout-l18 = [bullet/] Seeds: {$seedless ->
[yes][color=red]No[/color]
[no][color=green]Yes[/color]
plant-analyzer-printout-l3 = {$indent}[bullet/] Viable: {$viable ->
[no][color=red]No[/color]
[yes][color=green]Yes[/color]
*[other]{LOC("plant-analyzer-printout-missing")}
}
plant-analyzer-printout-l19 = [bullet/] Chemicals: [color=gray][bold]{$chemicals}[/bold][/color]
plant-analyzer-printout-l20 = [bullet/] Emissions: [bold]{$gasesOut}[/bold]
plant-analyzer-printout-l4 = {$indent}[bullet/] Endurance: {$endurance}
plant-analyzer-printout-l5 = {$indent}[bullet/] Lifespan: {$lifespan}
plant-analyzer-printout-l6 = {$indent}[bullet/] Product: [color=#a4885c]{$produce}[/color]
plant-analyzer-printout-l7 = [bullet/] Growth profile:
plant-analyzer-printout-l8 = {$indent}[bullet/] Water: [color=cyan]{$water}[/color]
plant-analyzer-printout-l9 = {$indent}[bullet/] Nutrition: [color=orange]{$nutrients}[/color]
plant-analyzer-printout-l10 = {$indent}[bullet/] Toxins: [color=yellowgreen]{$toxins}[/color]
plant-analyzer-printout-l11 = {$indent}[bullet/] Pests: [color=magenta]{$pests}[/color]
plant-analyzer-printout-l12 = {$indent}[bullet/] Weeds: [color=red]{$weeds}[/color]
plant-analyzer-printout-l13 = [bullet/] Environmental profile:
plant-analyzer-printout-l14 = {$indent}[bullet/] Composition: [bold]{$gasesIn}[/bold]
plant-analyzer-printout-l15 = {$indent}[bullet/] Pressure: [color=lightblue]{$kpa}kPa ± {$kpaTolerance}kPa[/color]
plant-analyzer-printout-l16 = {$indent}[bullet/] Temperature: [color=lightsalmon]{$temp}°k ± {$tempTolerance}°k[/color]
plant-analyzer-printout-l17 = {$indent}[bullet/] Light: [color=gray][bold]{$lightLevel} ± {$lightTolerance}[/bold][/color]
plant-analyzer-printout-l18 = [bullet/] Flowers: [color=lightgreen]{$n} {$potency}[/color]
plant-analyzer-printout-l19 = [bullet/] Seeds: {$seeds ->
[no][color=red]No[/color]
[yes][color=green]Yes[/color]
*[other]{LOC("plant-analyzer-printout-missing")}
}
plant-analyzer-printout-l20 = [bullet/] Chemicals: [color=gray][bold]{$chemicals}[/bold][/color]
plant-analyzer-printout-l21 = [bullet/] Emissions: [bold]{$gasesOut}[/bold]

0 comments on commit 9de3fd2

Please sign in to comment.