Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize planet dataset names #33398

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ 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<DatasetPrototype>]
private const string PlanetNames = "names_borer";
[ValidatePrototypeId<LocalizedDatasetPrototype>]
private const string PlanetNames = "NamesBorer";

// TODO:
// Fix shader some more
Expand Down Expand Up @@ -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<DatasetPrototype>(PlanetNames), seed);
var gatewayName = _salvage.GetFTLName(_protoManager.Index<LocalizedDatasetPrototype>(PlanetNames), seed);
_metadata.SetEntityName(mapUid, gatewayName);

var origin = new Vector2i(random.Next(-MaxOffset, MaxOffset), random.Next(-MaxOffset, MaxOffset));
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void OnSalvageClaimMessage(EntityUid uid, SalvageExpeditionConsoleCompon
var mission = GetMission(_prototypeManager.Index<SalvageDifficultyPrototype>(missionparams.Difficulty), missionparams.Seed);
data.NextOffer = _timing.CurTime + mission.Duration + TimeSpan.FromSeconds(1);

_labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index<DatasetPrototype>("names_borer"), missionparams.Seed));
_labelSystem.Label(cdUid, GetFTLName(_prototypeManager.Index<LocalizedDatasetPrototype>("NamesBorer"), missionparams.Seed));
_audio.PlayPvs(component.PrintSound, uid);

UpdateConsoles((station.Value, data));
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/Salvage/SpawnSalvageMissionJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ protected override async Task<bool> Process()
destComp.BeaconsOnly = true;
destComp.RequireCoordinateDisk = true;
destComp.Enabled = true;
_metaData.SetEntityName(mapUid, SharedSalvageSystem.GetFTLName(_prototypeManager.Index<DatasetPrototype>("names_borer"), _missionParams.Seed));
_metaData.SetEntityName(
mapUid,
_entManager.System<SharedSalvageSystem>().GetFTLName(_prototypeManager.Index<LocalizedDatasetPrototype>("NamesBorer"), _missionParams.Seed));
_entManager.AddComponent<FTLBeaconComponent>(mapUid);

// Saving the mission mapUid to a CD is made optional, in case one is somehow made in a process without a CD entity
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Shuttles/Components/GridSpawnComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface IGridSpawnGroup
public float MaximumDistance { get; }

/// <inheritdoc />
public ProtoId<DatasetPrototype>? NameDataset { get; }
public ProtoId<LocalizedDatasetPrototype>? NameDataset { get; }

/// <inheritdoc />
int MinCount { get; set; }
Expand Down Expand Up @@ -75,7 +75,7 @@ public sealed class DungeonSpawnGroup : IGridSpawnGroup
public float MaximumDistance { get; }

/// <inheritdoc />
public ProtoId<DatasetPrototype>? NameDataset { get; }
public ProtoId<LocalizedDatasetPrototype>? NameDataset { get; }

/// <inheritdoc />
public int MinCount { get; set; } = 1;
Expand Down Expand Up @@ -106,7 +106,7 @@ public sealed class GridSpawnGroup : IGridSpawnGroup

/// <inheritdoc />
public float MaximumDistance { get; }
public ProtoId<DatasetPrototype>? NameDataset { get; }
public ProtoId<LocalizedDatasetPrototype>? NameDataset { get; }
public int MinCount { get; set; } = 1;
public int MaxCount { get; set; } = 1;
public ComponentRegistry AddComponents { get; set; } = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Shuttles/Systems/ShuttleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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!;
Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/Salvage/SharedSalvageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public abstract partial class SharedSalvageSystem : EntitySystem
[ValidatePrototypeId<SalvageLootPrototype>]
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)
Expand Down
69 changes: 69 additions & 0 deletions Resources/Locale/en-US/datasets/names/borer.ftl
Original file line number Diff line number Diff line change
@@ -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
75 changes: 4 additions & 71 deletions Resources/Prototypes/Datasets/Names/borer.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,5 @@
- type: dataset
id: names_borer
- type: localizedDataset
id: NamesBorer
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
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Stations/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
vgroid: !type:DungeonSpawnGroup
minimumDistance: 300
maximumDistance: 350
nameDataset: names_borer
nameDataset: NamesBorer
stationGrid: false
addComponents:
- type: Gravity
Expand Down
Loading