From cb3cfe9d5d1aa431a8266635cf7086634830f93c Mon Sep 17 00:00:00 2001 From: MilenVolf Date: Mon, 18 Nov 2024 18:33:26 +0300 Subject: [PATCH 1/3] Localize planet names (borer) --- .../Locale/en-US/datasets/names/borer.ftl | 69 ++++++++++++++++++ Resources/Prototypes/Datasets/Names/borer.yml | 73 +------------------ 2 files changed, 72 insertions(+), 70 deletions(-) create mode 100644 Resources/Locale/en-US/datasets/names/borer.ftl diff --git a/Resources/Locale/en-US/datasets/names/borer.ftl b/Resources/Locale/en-US/datasets/names/borer.ftl new file mode 100644 index 00000000000000..17cae851b9e0ee --- /dev/null +++ b/Resources/Locale/en-US/datasets/names/borer.ftl @@ -0,0 +1,69 @@ +names-borer-dataset-1 = Alcyonium +names-borer-dataset-2 = Anomia +names-borer-dataset-3 = Aphrodita +names-borer-dataset-4 = Arca +names-borer-dataset-5 = Argonauta +names-borer-dataset-6 = Ascaris +names-borer-dataset-7 = Asterias +names-borer-dataset-8 = Buccinum +names-borer-dataset-9 = Bulla +names-borer-dataset-10 = Cardium +names-borer-dataset-11 = Chama +names-borer-dataset-12 = Chiton +names-borer-dataset-13 = Conus +names-borer-dataset-14 = Corallina +names-borer-dataset-15 = Cypraea +names-borer-dataset-16 = Dentalium +names-borer-dataset-17 = Donax +names-borer-dataset-18 = Doris +names-borer-dataset-19 = Echinus +names-borer-dataset-20 = Eschara +names-borer-dataset-21 = Fasciola +names-borer-dataset-22 = Furia +names-borer-dataset-23 = Gordius +names-borer-dataset-24 = Gorgonia +names-borer-dataset-25 = Haliotis +names-borer-dataset-26 = Helix +names-borer-dataset-27 = Hirudo +names-borer-dataset-28 = Holothuria +names-borer-dataset-29 = Hydra +names-borer-dataset-30 = Isis +names-borer-dataset-31 = Lepas +names-borer-dataset-32 = Lernaea +names-borer-dataset-33 = Limax +names-borer-dataset-34 = Lumbricus +names-borer-dataset-35 = Madrepora +names-borer-dataset-36 = Medusa +names-borer-dataset-37 = Millepora +names-borer-dataset-38 = Murex +names-borer-dataset-39 = Myes +names-borer-dataset-40 = Mytilus +names-borer-dataset-41 = Myxine +names-borer-dataset-42 = Nautilus +names-borer-dataset-43 = Nereis +names-borer-dataset-44 = Neritha +names-borer-dataset-45 = Ostrea +names-borer-dataset-46 = Patella +names-borer-dataset-47 = Pennatula +names-borer-dataset-48 = Pholas +names-borer-dataset-49 = Pinna +names-borer-dataset-50 = Priapus +names-borer-dataset-51 = Scyllaea +names-borer-dataset-52 = Sepia +names-borer-dataset-53 = Serpula +names-borer-dataset-54 = Sertularia +names-borer-dataset-55 = Solen +names-borer-dataset-56 = Spondylus +names-borer-dataset-57 = Strombus +names-borer-dataset-58 = Taenia +names-borer-dataset-59 = Tellina +names-borer-dataset-60 = Teredo +names-borer-dataset-61 = Tethys +names-borer-dataset-62 = Triton +names-borer-dataset-63 = Trochus +names-borer-dataset-64 = Tubipora +names-borer-dataset-65 = Tubularia +names-borer-dataset-66 = Turbo +names-borer-dataset-67 = Venus +names-borer-dataset-68 = Voluta +names-borer-dataset-69 = Volvox diff --git a/Resources/Prototypes/Datasets/Names/borer.yml b/Resources/Prototypes/Datasets/Names/borer.yml index 03667f67a7a5e5..bf734ede91628e 100644 --- a/Resources/Prototypes/Datasets/Names/borer.yml +++ b/Resources/Prototypes/Datasets/Names/borer.yml @@ -1,72 +1,5 @@ -- type: dataset +- type: localizedDataset id: names_borer values: - - Alcyonium - - Anomia - - Aphrodita - - Arca - - Argonauta - - Ascaris - - Asterias - - Buccinum - - Bulla - - Cardium - - Chama - - Chiton - - Conus - - Corallina - - Cypraea - - Dentalium - - Donax - - Doris - - Echinus - - Eschara - - Fasciola - - Furia - - Gordius - - Gorgonia - - Haliotis - - Helix - - Hirudo - - Holothuria - - Hydra - - Isis - - Lepas - - Lernaea - - Limax - - Lumbricus - - Madrepora - - Medusa - - Millepora - - Murex - - Myes - - Mytilus - - Myxine - - Nautilus - - Nereis - - Neritha - - Ostrea - - Patella - - Pennatula - - Pholas - - Pinna - - Priapus - - Scyllaea - - Sepia - - Serpula - - Sertularia - - Solen - - Spondylus - - Strombus - - Taenia - - Tellina - - Teredo - - Tethys - - Triton - - Trochus - - Tubipora - - Tubularia - - Turbo - - Venus - - Voluta - - Volvox + prefix: names-borer-dataset- + count: 69 From 8bdeb30e99d9b68c468b09db522221884d2489e7 Mon Sep 17 00:00:00 2001 From: MilenVolf Date: Mon, 18 Nov 2024 18:34:02 +0300 Subject: [PATCH 2/3] DatasetPrototype -> LocalizedDatasetPrototype --- Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs | 5 +++-- Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs | 2 +- Content.Server/Salvage/SpawnSalvageMissionJob.cs | 4 +++- Content.Server/Shuttles/Components/GridSpawnComponent.cs | 6 +++--- Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs | 2 +- Content.Server/Shuttles/Systems/ShuttleSystem.cs | 2 ++ Content.Shared/Salvage/SharedSalvageSystem.cs | 4 ++-- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs index 7dcd42e06fa0f6..6b72142fd993ef 100644 --- a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs +++ b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs @@ -34,9 +34,10 @@ public sealed class GatewayGeneratorSystem : EntitySystem [Dependency] private readonly GatewaySystem _gateway = default!; [Dependency] private readonly MetaDataSystem _metadata = default!; [Dependency] private readonly SharedMapSystem _maps = default!; + [Dependency] private readonly SharedSalvageSystem _salvage = default!; [Dependency] private readonly TileSystem _tile = default!; - [ValidatePrototypeId] + [ValidatePrototypeId] private const string PlanetNames = "names_borer"; // TODO: @@ -102,7 +103,7 @@ private void GenerateDestination(EntityUid uid, GatewayGeneratorComponent? gener var mapId = _mapManager.CreateMap(); var mapUid = _mapManager.GetMapEntityId(mapId); - var gatewayName = SharedSalvageSystem.GetFTLName(_protoManager.Index(PlanetNames), seed); + var gatewayName = _salvage.GetFTLName(_protoManager.Index(PlanetNames), seed); _metadata.SetEntityName(mapUid, gatewayName); var origin = new Vector2i(random.Next(-MaxOffset, MaxOffset), random.Next(-MaxOffset, MaxOffset)); diff --git a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs index d031418476702b..2a6a14cc4f6718 100644 --- a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs +++ b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs @@ -28,7 +28,7 @@ private void OnSalvageClaimMessage(EntityUid uid, SalvageExpeditionConsoleCompon var mission = GetMission(_prototypeManager.Index(missionparams.Difficulty), missionparams.Seed); data.NextOffer = _timing.CurTime + mission.Duration + TimeSpan.FromSeconds(1); - _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index("names_borer"), missionparams.Seed)); + _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index("names_borer"), missionparams.Seed)); _audio.PlayPvs(component.PrintSound, uid); UpdateConsoles((station.Value, data)); diff --git a/Content.Server/Salvage/SpawnSalvageMissionJob.cs b/Content.Server/Salvage/SpawnSalvageMissionJob.cs index 525fe01a1f8285..6b2eff6c9e01dc 100644 --- a/Content.Server/Salvage/SpawnSalvageMissionJob.cs +++ b/Content.Server/Salvage/SpawnSalvageMissionJob.cs @@ -104,7 +104,9 @@ protected override async Task Process() destComp.BeaconsOnly = true; destComp.RequireCoordinateDisk = true; destComp.Enabled = true; - _metaData.SetEntityName(mapUid, SharedSalvageSystem.GetFTLName(_prototypeManager.Index("names_borer"), _missionParams.Seed)); + _metaData.SetEntityName( + mapUid, + _entManager.System().GetFTLName(_prototypeManager.Index("names_borer"), _missionParams.Seed)); _entManager.AddComponent(mapUid); // Saving the mission mapUid to a CD is made optional, in case one is somehow made in a process without a CD entity diff --git a/Content.Server/Shuttles/Components/GridSpawnComponent.cs b/Content.Server/Shuttles/Components/GridSpawnComponent.cs index 430c9c8df285c6..18959dd7f376d1 100644 --- a/Content.Server/Shuttles/Components/GridSpawnComponent.cs +++ b/Content.Server/Shuttles/Components/GridSpawnComponent.cs @@ -32,7 +32,7 @@ public interface IGridSpawnGroup public float MaximumDistance { get; } /// - public ProtoId? NameDataset { get; } + public ProtoId? NameDataset { get; } /// int MinCount { get; set; } @@ -75,7 +75,7 @@ public sealed class DungeonSpawnGroup : IGridSpawnGroup public float MaximumDistance { get; } /// - public ProtoId? NameDataset { get; } + public ProtoId? NameDataset { get; } /// public int MinCount { get; set; } = 1; @@ -106,7 +106,7 @@ public sealed class GridSpawnGroup : IGridSpawnGroup /// public float MaximumDistance { get; } - public ProtoId? NameDataset { get; } + public ProtoId? NameDataset { get; } public int MinCount { get; set; } = 1; public int MaxCount { get; set; } = 1; public ComponentRegistry AddComponents { get; set; } = new(); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs index 5ad94699bed166..de0593b26f0fd8 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs @@ -208,7 +208,7 @@ private void GridSpawns(EntityUid uid, GridSpawnComponent component) if (_protoManager.TryIndex(group.NameDataset, out var dataset)) { - _metadata.SetEntityName(spawned, SharedSalvageSystem.GetFTLName(dataset, _random.Next())); + _metadata.SetEntityName(spawned, _salvage.GetFTLName(dataset, _random.Next())); } if (group.Hide) diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index 054c42f934a856..6e8c1a9e204f2d 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -8,6 +8,7 @@ using Content.Server.Stunnable; using Content.Shared.GameTicking; using Content.Shared.Mobs.Systems; +using Content.Shared.Salvage; using Content.Shared.Shuttles.Systems; using Content.Shared.Throwing; using JetBrains.Annotations; @@ -51,6 +52,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; + [Dependency] private readonly SharedSalvageSystem _salvage = default!; [Dependency] private readonly ShuttleConsoleSystem _console = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StunSystem _stuns = default!; diff --git a/Content.Shared/Salvage/SharedSalvageSystem.cs b/Content.Shared/Salvage/SharedSalvageSystem.cs index 0c56f4f556e8e0..12d0a26449c35a 100644 --- a/Content.Shared/Salvage/SharedSalvageSystem.cs +++ b/Content.Shared/Salvage/SharedSalvageSystem.cs @@ -26,10 +26,10 @@ public abstract partial class SharedSalvageSystem : EntitySystem [ValidatePrototypeId] public const string ExpeditionsLootProto = "SalvageLoot"; - public static string GetFTLName(DatasetPrototype dataset, int seed) + public string GetFTLName(LocalizedDatasetPrototype dataset, int seed) { var random = new System.Random(seed); - return $"{dataset.Values[random.Next(dataset.Values.Count)]}-{random.Next(10, 100)}-{(char) (65 + random.Next(26))}"; + return $"{Loc.GetString(dataset.Values[random.Next(dataset.Values.Count)])}-{random.Next(10, 100)}-{(char) (65 + random.Next(26))}"; } public SalvageMission GetMission(SalvageDifficultyPrototype difficulty, int seed) From 23025fe40e72070b45f8fcdb349360a5a14f4179 Mon Sep 17 00:00:00 2001 From: MilenVolf Date: Tue, 19 Nov 2024 18:46:24 +0300 Subject: [PATCH 3/3] Apply requested changes --- Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs | 2 +- Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs | 2 +- Content.Server/Salvage/SpawnSalvageMissionJob.cs | 2 +- Resources/Prototypes/Datasets/Names/borer.yml | 2 +- Resources/Prototypes/Entities/Stations/base.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs index 6b72142fd993ef..666d1045174c5f 100644 --- a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs +++ b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs @@ -38,7 +38,7 @@ public sealed class GatewayGeneratorSystem : EntitySystem [Dependency] private readonly TileSystem _tile = default!; [ValidatePrototypeId] - private const string PlanetNames = "names_borer"; + private const string PlanetNames = "NamesBorer"; // TODO: // Fix shader some more diff --git a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs index 2a6a14cc4f6718..a9d8314f57cc4f 100644 --- a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs +++ b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs @@ -28,7 +28,7 @@ private void OnSalvageClaimMessage(EntityUid uid, SalvageExpeditionConsoleCompon var mission = GetMission(_prototypeManager.Index(missionparams.Difficulty), missionparams.Seed); data.NextOffer = _timing.CurTime + mission.Duration + TimeSpan.FromSeconds(1); - _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index("names_borer"), missionparams.Seed)); + _labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index("NamesBorer"), missionparams.Seed)); _audio.PlayPvs(component.PrintSound, uid); UpdateConsoles((station.Value, data)); diff --git a/Content.Server/Salvage/SpawnSalvageMissionJob.cs b/Content.Server/Salvage/SpawnSalvageMissionJob.cs index 6b2eff6c9e01dc..31c6b73253dcdb 100644 --- a/Content.Server/Salvage/SpawnSalvageMissionJob.cs +++ b/Content.Server/Salvage/SpawnSalvageMissionJob.cs @@ -106,7 +106,7 @@ protected override async Task Process() destComp.Enabled = true; _metaData.SetEntityName( mapUid, - _entManager.System().GetFTLName(_prototypeManager.Index("names_borer"), _missionParams.Seed)); + _entManager.System().GetFTLName(_prototypeManager.Index("NamesBorer"), _missionParams.Seed)); _entManager.AddComponent(mapUid); // Saving the mission mapUid to a CD is made optional, in case one is somehow made in a process without a CD entity diff --git a/Resources/Prototypes/Datasets/Names/borer.yml b/Resources/Prototypes/Datasets/Names/borer.yml index bf734ede91628e..e8d741e6a9646f 100644 --- a/Resources/Prototypes/Datasets/Names/borer.yml +++ b/Resources/Prototypes/Datasets/Names/borer.yml @@ -1,5 +1,5 @@ - type: localizedDataset - id: names_borer + id: NamesBorer values: prefix: names-borer-dataset- count: 69 diff --git a/Resources/Prototypes/Entities/Stations/base.yml b/Resources/Prototypes/Entities/Stations/base.yml index effb391404da7f..5d95e7cbe0628c 100644 --- a/Resources/Prototypes/Entities/Stations/base.yml +++ b/Resources/Prototypes/Entities/Stations/base.yml @@ -73,7 +73,7 @@ vgroid: !type:DungeonSpawnGroup minimumDistance: 300 maximumDistance: 350 - nameDataset: names_borer + nameDataset: NamesBorer stationGrid: false addComponents: - type: Gravity