Skip to content

Commit

Permalink
Beacon localization (space-wizards#24138)
Browse files Browse the repository at this point in the history
* localize beacons

* No not like that

* Tesla beacons were already depreciated, time to give the reaper their due

* Entity name fallback

* The real treasure was the far easier solution we missed along the way

* weh

* Shared mapinit

* fix RT version

* a single line break
  • Loading branch information
Errant-4 authored Jan 20, 2024
1 parent 18a111b commit efdc6f8
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Content.Server/Pinpointer/NavMapSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private void OnGetState(EntityUid uid, NavMapComponent component, ref ComponentG
// TODO: Make warp points use metadata name instead.
string? name = beacon.Text;

if (name == null)
if (string.IsNullOrEmpty(name))
{
if (TryComp<WarpPointComponent>(beaconUid, out var warpPoint) && warpPoint.Location != null)
{
Expand Down
14 changes: 14 additions & 0 deletions Content.Shared/Pinpointer/SharedNavMapSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ public abstract class SharedNavMapSystem : EntitySystem
{
public const byte ChunkSize = 4;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<NavMapBeaconComponent, MapInitEvent>(OnNavMapBeaconMapInit);
}

/// <summary>
/// Converts the chunk's tile into a bitflag for the slot.
/// </summary>
Expand All @@ -31,6 +38,13 @@ public static Vector2i GetTile(int flag)
return new Vector2i(x, y);
}

private void OnNavMapBeaconMapInit(EntityUid uid, NavMapBeaconComponent component, MapInitEvent args)
{
component.Text ??= string.Empty;
component.Text = Loc.GetString(component.Text);
Dirty(uid, component);
}

[Serializable, NetSerializable]
protected sealed class NavMapComponentState : ComponentState
{
Expand Down
72 changes: 72 additions & 0 deletions Resources/Locale/en-US/navmap-beacons/station-beacons.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
station-beacon-general = General
station-beacon-command = Command
station-beacon-bridge = Bridge
station-beacon-vault = Vault
station-beacon-captain = Captain
station-beacon-hop = HOP
station-beacon-security = Security
station-beacon-brig = Brig
station-beacon-warden = Warden
station-beacon-hos = HOS
station-beacon-armory = Armory
station-beacon-perma-brig = Perma
station-beacon-detective = Detective
station-beacon-courtroom = Courtroom
station-beacon-law = Law Office
station-beacon-security-checkpoint = Checkpoint
station-beacon-medical = Medical
station-beacon-medbay = Medbay
station-beacon-chemistry = Chem
station-beacon-cryonics = Cryo
station-beacon-cmo = CMO
station-beacon-morgue = Morgue
station-beacon-surgery = Surgery
station-beacon-science = Science
station-beacon-research-and-development = Research
station-beacon-research-server = Server
station-beacon-research-director = RD
station-beacon-robotics = Robotics
station-beacon-artifact-lab = Artifact
station-beacon-anomaly-gen = Anomaly
station-beacon-supply = Supply
station-beacon-cargo = Cargo
station-beacon-cargo-bay = Cargo Bay
station-beacon-qm = QM
station-beacon-salvage = Salvage
station-beacon-engineering = Engineering
station-beacon-ce = CE
station-beacon-ame = AME
station-beacon-solars = Solars
station-beacon-gravgen = Grav
station-beacon-pa = PA Control
station-beacon-smes = SMES
station-beacon-telecoms = Telecoms
station-beacon-atmos = Atmos
station-beacon-teg = TEG
station-beacon-tech-vault = Tech Vault
station-beacon-service = Service
station-beacon-kitchen = Kitchen
station-beacon-bar = Bar
station-beacon-botany = Botany
station-beacon-janitor = Janitor
station-beacon-ai = AI
station-beacon-ai-sat = AI Sat
station-beacon-ai-core = AI Core
station-beacon-arrivals = Arrivals
station-beacon-evac = Evac
station-beacon-eva-storage = EVA Storage
station-beacon-chapel = Chapel
station-beacon-library = Library
station-beacon-dorms = Dorms
station-beacon-theater = Theater
station-beacon-tools = Tools
station-beacon-disposals = Disposals
Loading

0 comments on commit efdc6f8

Please sign in to comment.