Localization of the Salvage Expedition Console (#30339)

* Localization of the Salvage Expedition Console

* Localization of the Salvage Expedition Console 2
This commit is contained in:
chavonadelal
2024-07-30 17:05:19 +03:00
committed by GitHub
parent 1a672c9c6d
commit 9e1e9b8c34
15 changed files with 94 additions and 29 deletions

View File

@@ -102,12 +102,21 @@ public sealed class SalvageExpeditionConsoleBoundUserInterface : BoundUserInterf
offering.AddContent(new Label offering.AddContent(new Label
{ {
Text = faction, Text = string.IsNullOrWhiteSpace(Loc.GetString(_protoManager.Index<SalvageFactionPrototype>(faction).Description))
? LogAndReturnDefaultFactionDescription(faction)
: Loc.GetString(_protoManager.Index<SalvageFactionPrototype>(faction).Description),
FontColorOverride = StyleNano.NanoGold, FontColorOverride = StyleNano.NanoGold,
HorizontalAlignment = Control.HAlignment.Left, HorizontalAlignment = Control.HAlignment.Left,
Margin = new Thickness(0f, 0f, 0f, 5f), Margin = new Thickness(0f, 0f, 0f, 5f),
}); });
string LogAndReturnDefaultFactionDescription(string faction)
{
Logger.Error($"Description is null or white space for SalvageFactionPrototype: {faction}");
return Loc.GetString(_protoManager.Index<SalvageFactionPrototype>(faction).ID);
}
// Duration // Duration
offering.AddContent(new Label offering.AddContent(new Label
{ {
@@ -132,12 +141,20 @@ public sealed class SalvageExpeditionConsoleBoundUserInterface : BoundUserInterf
offering.AddContent(new Label offering.AddContent(new Label
{ {
Text = Loc.GetString(_protoManager.Index<SalvageBiomeModPrototype>(biome).ID), Text = string.IsNullOrWhiteSpace(Loc.GetString(_protoManager.Index<SalvageBiomeModPrototype>(biome).Description))
? LogAndReturnDefaultBiomDescription(biome)
: Loc.GetString(_protoManager.Index<SalvageBiomeModPrototype>(biome).Description),
FontColorOverride = StyleNano.NanoGold, FontColorOverride = StyleNano.NanoGold,
HorizontalAlignment = Control.HAlignment.Left, HorizontalAlignment = Control.HAlignment.Left,
Margin = new Thickness(0f, 0f, 0f, 5f), Margin = new Thickness(0f, 0f, 0f, 5f),
}); });
string LogAndReturnDefaultBiomDescription(string biome)
{
Logger.Error($"Description is null or white space for SalvageBiomeModPrototype: {biome}");
return Loc.GetString(_protoManager.Index<SalvageBiomeModPrototype>(biome).ID);
}
// Modifiers // Modifiers
offering.AddContent(new Label offering.AddContent(new Label
{ {

View File

@@ -5,7 +5,7 @@ public interface ISalvageMod
/// <summary> /// <summary>
/// Player-friendly version describing this modifier. /// Player-friendly version describing this modifier.
/// </summary> /// </summary>
string Description { get; } LocId Description { get; }
/// <summary> /// <summary>
/// Cost for difficulty modifiers. /// Cost for difficulty modifiers.

View File

@@ -17,7 +17,7 @@ public sealed partial class SalvageAirMod : IPrototype, IBiomeSpecificMod
/// <inheritdoc/> /// <inheritdoc/>
[DataField("desc")] [DataField("desc")]
public string Description { get; private set; } = string.Empty; public LocId Description { get; private set; } = string.Empty;
/// <inheritdoc/> /// <inheritdoc/>
[DataField("cost")] [DataField("cost")]

View File

@@ -12,7 +12,7 @@ public sealed partial class SalvageBiomeModPrototype : IPrototype, ISalvageMod
{ {
[IdDataField] public string ID { get; } = default!; [IdDataField] public string ID { get; } = default!;
[DataField("desc")] public string Description { get; private set; } = string.Empty; [DataField("desc")] public LocId Description { get; private set; } = string.Empty;
/// <summary> /// <summary>
/// Cost for difficulty modifiers. /// Cost for difficulty modifiers.

View File

@@ -10,7 +10,7 @@ public sealed partial class SalvageDungeonModPrototype : IPrototype, IBiomeSpeci
{ {
[IdDataField] public string ID { get; } = default!; [IdDataField] public string ID { get; } = default!;
[DataField("desc")] public string Description { get; private set; } = string.Empty; [DataField("desc")] public LocId Description { get; private set; } = string.Empty;
/// <inheridoc/> /// <inheridoc/>
[DataField("cost")] [DataField("cost")]

View File

@@ -8,7 +8,7 @@ public sealed partial class SalvageLightMod : IPrototype, IBiomeSpecificMod
{ {
[IdDataField] public string ID { get; } = default!; [IdDataField] public string ID { get; } = default!;
[DataField("desc")] public string Description { get; private set; } = string.Empty; [DataField("desc")] public LocId Description { get; private set; } = string.Empty;
/// <inheritdoc/> /// <inheritdoc/>
[DataField("cost")] [DataField("cost")]

View File

@@ -10,7 +10,7 @@ public sealed partial class SalvageMod : IPrototype, ISalvageMod
{ {
[IdDataField] public string ID { get; } = default!; [IdDataField] public string ID { get; } = default!;
[DataField("desc")] public string Description { get; private set; } = string.Empty; [DataField("desc")] public LocId Description { get; private set; } = string.Empty;
/// <summary> /// <summary>
/// Cost for difficulty modifiers. /// Cost for difficulty modifiers.

View File

@@ -8,7 +8,7 @@ public sealed partial class SalvageTemperatureMod : IPrototype, IBiomeSpecificMo
{ {
[IdDataField] public string ID { get; } = default!; [IdDataField] public string ID { get; } = default!;
[DataField("desc")] public string Description { get; private set; } = string.Empty; [DataField("desc")] public LocId Description { get; private set; } = string.Empty;
/// <inheritdoc/> /// <inheritdoc/>
[DataField("cost")] [DataField("cost")]

View File

@@ -10,7 +10,7 @@ public sealed partial class SalvageWeatherMod : IPrototype, IBiomeSpecificMod
{ {
[IdDataField] public string ID { get; } = default!; [IdDataField] public string ID { get; } = default!;
[DataField("desc")] public string Description { get; private set; } = string.Empty; [DataField("desc")] public LocId Description { get; private set; } = string.Empty;
/// <inheritdoc/> /// <inheritdoc/>
[DataField("cost")] [DataField("cost")]

View File

@@ -7,7 +7,7 @@ public sealed partial class SalvageFactionPrototype : IPrototype
{ {
[IdDataField] public string ID { get; } = default!; [IdDataField] public string ID { get; } = default!;
[DataField("desc")] public string Description { get; private set; } = string.Empty; [DataField("desc")] public LocId Description { get; private set; } = string.Empty;
[ViewVariables(VVAccess.ReadWrite), DataField("entries", required: true)] [ViewVariables(VVAccess.ReadWrite), DataField("entries", required: true)]
public List<SalvageMobEntry> MobGroups = new(); public List<SalvageMobEntry> MobGroups = new();

View File

@@ -55,18 +55,18 @@ public abstract partial class SharedSalvageSystem : EntitySystem
if (air.Description != string.Empty) if (air.Description != string.Empty)
{ {
mods.Add(air.Description); mods.Add(Loc.GetString(air.Description));
} }
// only show the description if there is an atmosphere since wont matter otherwise // only show the description if there is an atmosphere since wont matter otherwise
if (temp.Description != string.Empty && !air.Space) if (temp.Description != string.Empty && !air.Space)
{ {
mods.Add(temp.Description); mods.Add(Loc.GetString(temp.Description));
} }
if (light.Description != string.Empty) if (light.Description != string.Empty)
{ {
mods.Add(light.Description); mods.Add(Loc.GetString(light.Description));
} }
var duration = TimeSpan.FromSeconds(CfgManager.GetCVar(CCVars.SalvageExpeditionDuration)); var duration = TimeSpan.FromSeconds(CfgManager.GetCVar(CCVars.SalvageExpeditionDuration));

View File

@@ -32,3 +32,34 @@ salvage-expedition-announcement-countdown-seconds = {$duration} seconds remainin
salvage-expedition-announcement-dungeon = Dungeon is located {$direction}. salvage-expedition-announcement-dungeon = Dungeon is located {$direction}.
salvage-expedition-completed = Expedition is completed. salvage-expedition-completed = Expedition is completed.
salvage-expedition-reward-description = Mission completion reward salvage-expedition-reward-description = Mission completion reward
# Salvage biome mod
salvage-biome-mod-caves = Caves
salvage-biome-mod-grasslands = Grasslands
salvage-biome-mod-snow = Snow
salvage-biome-mod-lava = Lava
# Salvage mods
salvage-light-mod-daylight = Daylight
salvage-light-mod-evening = Evening
salvage-light-mod-night = Night time
salvage-temperature-mod-room-temperature = Room temperature
salvage-temperature-mod-hot = Hot
salvage-temperature-mod-high-temperature = High temperature
salvage-temperature-mod-extreme-heat = Extreme heat
salvage-temperature-mod-cold = Cold
salvage-temperature-mod-low-temperature = Low temperature
salvage-temperature-mod-extreme-cold = Extreme cold
salvage-air-mod-no-atmosphere = No atmosphere
salvage-air-mod-breathable-atmosphere = Breathable atmosphere
salvage-air-mod-dangerous-atmosphere = Dangerous atmosphere
salvage-air-mod-toxic-atmosphere = Toxic atmosphere
salvage-air-mod-volatile-atmosphere = Volatile atmosphere
salvage-dungeon-mod-lava-brig = Lava Brig
salvage-dungeon-mod-snowy-labs = Snowy labs
salvage-dungeon-mod-experiment = Experiment
salvage-dungeon-mod-haunted = Haunted
salvage-dungeon-mod-mineshaft = Mineshaft

View File

@@ -0,0 +1,2 @@
salvage-faction-xenos = Xenos
salvage-faction-carps = Carps

View File

@@ -1,5 +1,6 @@
- type: salvageFaction - type: salvageFaction
id: Xenos id: Xenos
desc: salvage-faction-xenos
entries: entries:
- proto: MobXeno - proto: MobXeno
- proto: MobXenoDrone - proto: MobXenoDrone
@@ -24,6 +25,7 @@
- type: salvageFaction - type: salvageFaction
id: Carps id: Carps
desc: salvage-faction-carps
entries: entries:
- proto: MobCarpDungeon - proto: MobCarpDungeon
# These do too much damage for salvage, need nerfs # These do too much damage for salvage, need nerfs

View File

@@ -7,19 +7,23 @@
# Biome mods -> at least 1 required # Biome mods -> at least 1 required
- type: salvageBiomeMod - type: salvageBiomeMod
id: Caves id: Caves
desc: salvage-biome-mod-caves
biome: Caves biome: Caves
- type: salvageBiomeMod - type: salvageBiomeMod
id: Grasslands id: Grasslands
desc: salvage-biome-mod-grasslands
biome: Grasslands biome: Grasslands
- type: salvageBiomeMod - type: salvageBiomeMod
id: Snow id: Snow
desc: salvage-biome-mod-snow
cost: 1 cost: 1
biome: Snow biome: Snow
- type: salvageBiomeMod - type: salvageBiomeMod
id: Lava id: Lava
desc: salvage-biome-mod-lava
cost: 2 cost: 2
biome: Lava biome: Lava
@@ -32,36 +36,38 @@
# Light mods -> required # Light mods -> required
- type: salvageLightMod - type: salvageLightMod
id: Daylight id: Daylight
desc: Daylight desc: salvage-light-mod-daylight
color: "#D8B059" color: "#D8B059"
biomes: biomes:
- Grasslands - Grasslands
- type: salvageLightMod - type: salvageLightMod
id: Lavalight id: Lavalight
desc: Daylight desc: salvage-light-mod-daylight
color: "#A34931" color: "#A34931"
biomes: biomes:
- Lava - Lava
- type: salvageLightMod - type: salvageLightMod
id: Evening id: Evening
desc: Evening desc: salvage-light-mod-evening
color: "#2b3143" color: "#2b3143"
- type: salvageLightMod - type: salvageLightMod
id: Night id: Night
desc: Night time desc: salvage-light-mod-night
cost: 1 cost: 1
color: null color: null
# Temperatures # Temperatures
- type: salvageTemperatureMod - type: salvageTemperatureMod
id: RoomTemp id: RoomTemp
desc: salvage-temperature-mod-room-temperature
cost: 0 cost: 0
- type: salvageTemperatureMod - type: salvageTemperatureMod
id: Hot id: Hot
desc: salvage-temperature-mod-hot
cost: 1 cost: 1
temperature: 323.15 # 50C temperature: 323.15 # 50C
biomes: biomes:
@@ -72,7 +78,7 @@
- type: salvageTemperatureMod - type: salvageTemperatureMod
id: Burning id: Burning
desc: High temperature desc: salvage-temperature-mod-high-temperature
cost: 2 cost: 2
temperature: 423.15 # 200C temperature: 423.15 # 200C
biomes: biomes:
@@ -82,7 +88,7 @@
- type: salvageTemperatureMod - type: salvageTemperatureMod
id: Melting id: Melting
desc: Extreme heat desc: salvage-temperature-mod-extreme-heat
cost: 4 cost: 4
temperature: 1273.15 # 1000C hot hot hot temperature: 1273.15 # 1000C hot hot hot
biomes: biomes:
@@ -90,6 +96,7 @@
- type: salvageTemperatureMod - type: salvageTemperatureMod
id: Cold id: Cold
desc: salvage-temperature-mod-cold
cost: 1 cost: 1
temperature: 275.15 # 2C temperature: 275.15 # 2C
biomes: biomes:
@@ -100,7 +107,7 @@
- type: salvageTemperatureMod - type: salvageTemperatureMod
id: Tundra id: Tundra
desc: Low temperature desc: salvage-temperature-mod-low-temperature
cost: 2 cost: 2
temperature: 263.15 # -40C temperature: 263.15 # -40C
biomes: biomes:
@@ -109,7 +116,7 @@
- type: salvageTemperatureMod - type: salvageTemperatureMod
id: Frozen id: Frozen
desc: Extreme cold desc: salvage-temperature-mod-extreme-cold
cost: 4 cost: 4
temperature: 123.15 # -150C temperature: 123.15 # -150C
biomes: biomes:
@@ -118,7 +125,7 @@
# Air mixtures # Air mixtures
- type: salvageAirMod - type: salvageAirMod
id: Space id: Space
desc: No atmosphere desc: salvage-air-mod-no-atmosphere
space: true space: true
cost: 2 cost: 2
biomes: biomes:
@@ -128,6 +135,7 @@
- type: salvageAirMod - type: salvageAirMod
id: Breathable id: Breathable
cost: 0 cost: 0
desc: salvage-air-mod-breathable-atmosphere
gases: gases:
- 21.824779 # oxygen - 21.824779 # oxygen
- 82.10312 # nitrogen - 82.10312 # nitrogen
@@ -135,7 +143,7 @@
- type: salvageAirMod - type: salvageAirMod
id: Sleepy id: Sleepy
cost: 1 cost: 1
desc: Dangerous atmosphere desc: salvage-air-mod-dangerous-atmosphere
gases: gases:
- 21.824779 # oxygen - 21.824779 # oxygen
- 72.10312 # nitrogen - 72.10312 # nitrogen
@@ -155,7 +163,7 @@
- type: salvageAirMod - type: salvageAirMod
id: Poisoned id: Poisoned
cost: 2 cost: 2
desc: Dangerous atmosphere desc: salvage-air-mod-dangerous-atmosphere
gases: gases:
- 21.824779 # oxygen - 21.824779 # oxygen
- 77.10312 # nitrogen - 77.10312 # nitrogen
@@ -170,7 +178,7 @@
- type: salvageAirMod - type: salvageAirMod
id: Poison id: Poison
cost: 3 cost: 3
desc: Toxic atmosphere desc: salvage-air-mod-toxic-atmosphere
gases: gases:
- 21.824779 # oxygen - 21.824779 # oxygen
- 0 - 0
@@ -183,7 +191,7 @@
- type: salvageAirMod - type: salvageAirMod
id: Plasma id: Plasma
cost: 4 cost: 4
desc: Toxic atmosphere desc: salvage-air-mod-toxic-atmosphere
gases: gases:
- 0 - 0
- 0 - 0
@@ -196,7 +204,7 @@
- type: salvageAirMod - type: salvageAirMod
id: Burnable id: Burnable
cost: 5 cost: 5
desc: Volatile atmosphere desc: salvage-air-mod-volatile-atmosphere
gases: gases:
- 21.824779 # oxygen - 21.824779 # oxygen
- 0 - 0
@@ -220,6 +228,7 @@
# For now just simple 1-dungeon setups # For now just simple 1-dungeon setups
- type: salvageDungeonMod - type: salvageDungeonMod
id: Experiment id: Experiment
desc: salvage-dungeon-mod-experiment
proto: Experiment proto: Experiment
biomes: biomes:
#- LowDesert #- LowDesert
@@ -227,24 +236,28 @@
- type: salvageDungeonMod - type: salvageDungeonMod
id: LavaBrig id: LavaBrig
desc: salvage-dungeon-mod-lava-brig
proto: LavaBrig proto: LavaBrig
biomes: biomes:
- Lava - Lava
- type: salvageDungeonMod - type: salvageDungeonMod
id: Mineshaft id: Mineshaft
desc: salvage-dungeon-mod-mineshaft
proto: Mineshaft proto: Mineshaft
biomes: biomes:
- Caves - Caves
- type: salvageDungeonMod - type: salvageDungeonMod
id: SnowyLabs id: SnowyLabs
desc: salvage-dungeon-mod-snowy-labs
proto: SnowyLabs proto: SnowyLabs
biomes: biomes:
- Snow - Snow
- type: salvageDungeonMod - type: salvageDungeonMod
id: Haunted id: Haunted
desc: salvage-dungeon-mod-haunted
proto: Haunted proto: Haunted
biomes: biomes:
- Caves - Caves