Replace string data fields with LocId where relevant (#20883)

This commit is contained in:
DrSmugleaf
2023-10-10 20:06:24 -07:00
committed by GitHub
parent ef233cf0fe
commit 9bcf67753a
69 changed files with 265 additions and 286 deletions

View File

@@ -7,24 +7,24 @@ public sealed partial class SolutionSpikerComponent : Component
/// The source solution to take the reagents from in order
/// to spike the other solution container.
/// </summary>
[DataField("sourceSolution")]
[DataField]
public string SourceSolution { get; private set; } = string.Empty;
/// <summary>
/// If spiking with this entity should ignore empty containers or not.
/// </summary>
[DataField("ignoreEmpty")]
[DataField]
public bool IgnoreEmpty { get; private set; }
/// <summary>
/// What should pop up when spiking with this entity.
/// </summary>
[DataField("popup")]
public string Popup { get; private set; } = "spike-solution-generic";
[DataField]
public LocId Popup { get; private set; } = "spike-solution-generic";
/// <summary>
/// What should pop up when spiking fails because the container was empty.
/// </summary>
[DataField("popupEmpty")]
public string PopupEmpty { get; private set; } = "spike-solution-empty-generic";
[DataField]
public LocId PopupEmpty { get; private set; } = "spike-solution-empty-generic";
}

View File

@@ -1,6 +1,5 @@
using Content.Server.UserInterface;
using Content.Shared.Communications;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
namespace Content.Server.Communications
@@ -21,41 +20,41 @@ namespace Content.Server.Communications
/// If a Fluent ID isn't found, just uses the raw string
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("title", required: true)]
public string AnnouncementDisplayName = "comms-console-announcement-title-station";
[DataField(required: true)]
public LocId Title = "comms-console-announcement-title-station";
/// <summary>
/// Announcement color
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("color")]
public Color AnnouncementColor = Color.Gold;
[DataField]
public Color Color = Color.Gold;
/// <summary>
/// Time in seconds between announcement delays on a per-console basis
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("delay")]
public int DelayBetweenAnnouncements = 90;
[DataField]
public int Delay = 90;
/// <summary>
/// Can call or recall the shuttle
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("canShuttle")]
public bool CanCallShuttle = true;
[DataField]
public bool CanShuttle = true;
/// <summary>
/// Announce on all grids (for nukies)
/// </summary>
[DataField("global")]
public bool AnnounceGlobal = false;
[DataField]
public bool Global = false;
/// <summary>
/// Announce sound file path
/// </summary>
[DataField("sound")]
public SoundSpecifier AnnouncementSound = new SoundPathSpecifier("/Audio/Announcements/announce.ogg");
[DataField]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Announcements/announce.ogg");
public PlayerBoundUserInterface? UserInterface => Owner.GetUIOrNull(CommunicationsConsoleUiKey.Key);
}

View File

@@ -188,7 +188,7 @@ namespace Content.Server.Communications
// Calling shuttle checks
if (_roundEndSystem.ExpectedCountdownEnd is null)
return comp.CanCallShuttle;
return comp.CanShuttle;
// Recalling shuttle checks
var recallThreshold = _cfg.GetCVar(CCVars.EmergencyRecallTurningPoint);
@@ -256,27 +256,27 @@ namespace Content.Server.Communications
}
}
comp.AnnouncementCooldownRemaining = comp.DelayBetweenAnnouncements;
comp.AnnouncementCooldownRemaining = comp.Delay;
UpdateCommsConsoleInterface(uid, comp);
var ev = new CommunicationConsoleAnnouncementEvent(uid, comp, msg, message.Session.AttachedEntity);
RaiseLocalEvent(ref ev);
// allow admemes with vv
Loc.TryGetString(comp.AnnouncementDisplayName, out var title);
title ??= comp.AnnouncementDisplayName;
Loc.TryGetString(comp.Title, out var title);
title ??= comp.Title;
msg += "\n" + Loc.GetString("comms-console-announcement-sent-by") + " " + author;
if (comp.AnnounceGlobal)
if (comp.Global)
{
_chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.AnnouncementSound, colorOverride: comp.AnnouncementColor);
_chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.Sound, colorOverride: comp.Color);
if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following global announcement: {msg}");
return;
}
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.Color);
if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following station announcement: {msg}");

View File

@@ -7,10 +7,10 @@ namespace Content.Server.Forensics
[RegisterComponent]
public sealed partial class FiberComponent : Component
{
[DataField("fiberMaterial")]
public string FiberMaterial = "fibers-synthetic";
[DataField]
public LocId FiberMaterial = "fibers-synthetic";
[DataField("fiberColor")]
[DataField]
public string? FiberColor;
}
}

View File

@@ -9,6 +9,6 @@ namespace Content.Server.Nuke;
[RegisterComponent]
public sealed partial class NukeLabelComponent : Component
{
[DataField("prefix")] public string NukeLabel = "nuke-label-nanotrasen";
[DataField("serialLength")] public int SerialLength = 6;
[DataField] public LocId Prefix = "nuke-label-nanotrasen";
[DataField] public int SerialLength = 6;
}

View File

@@ -16,7 +16,7 @@ public sealed class NukeLabelSystem : EntitySystem
private void OnMapInit(EntityUid uid, NukeLabelComponent nuke, MapInitEvent args)
{
var label = Loc.GetString(nuke.NukeLabel, ("serial", _nuke.GenerateRandomNumberString(nuke.SerialLength)));
var label = Loc.GetString(nuke.Prefix, ("serial", _nuke.GenerateRandomNumberString(nuke.SerialLength)));
var meta = MetaData(uid);
_metaData.SetEntityName(uid, $"{meta.EntityName} ({label})", meta);
}

View File

@@ -12,37 +12,37 @@ public sealed partial class WarDeclaratorComponent : Component
/// Custom war declaration message. If empty, use default.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("message")]
[DataField]
public string Message;
/// <summary>
/// Permission to customize message text
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("allowEditingMessage")]
[DataField]
public bool AllowEditingMessage = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxMessageLength")]
[DataField]
public int MaxMessageLength = 512;
/// <summary>
/// War declarement text color
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("color")]
public Color DeclarementColor = Color.Red;
[DataField]
public Color Color = Color.Red;
/// <summary>
/// War declarement sound file path
/// </summary>
[DataField("sound")]
public SoundSpecifier DeclarementSound = new SoundPathSpecifier("/Audio/Announcements/war.ogg");
[DataField]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Announcements/war.ogg");
/// <summary>
/// Fluent ID for the declarement title
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("title")]
public string DeclarementTitle = "comms-console-announcement-title-nukie";
[DataField]
public LocId Title = "comms-console-announcement-title-nukie";
}

View File

@@ -76,9 +76,9 @@ public sealed class WarDeclaratorSystem : EntitySystem
{
message = Loc.GetString("war-declarator-default-message");
}
var title = Loc.GetString(component.DeclarementTitle);
var title = Loc.GetString(component.Title);
_nukeopsRuleSystem.DeclareWar(args.Session.AttachedEntity.Value, message, title, component.DeclarementSound, component.DeclarementColor);
_nukeopsRuleSystem.DeclareWar(args.Session.AttachedEntity.Value, message, title, component.Sound, component.Color);
if (args.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(args.Session.AttachedEntity.Value):player} has declared war with this text: {message}");

View File

@@ -1,10 +1,8 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Nutrition.Components;
@@ -17,8 +15,8 @@ public sealed partial class FoodComponent : Component
[DataField]
public SoundSpecifier UseSound = new SoundPathSpecifier("/Audio/Items/eatfood.ogg");
[DataField("trash")]
public EntProtoId? TrashPrototype;
[DataField]
public EntProtoId? Trash;
[DataField]
public FixedPoint2? TransferAmount = FixedPoint2.New(5);
@@ -55,7 +53,7 @@ public sealed partial class FoodComponent : Component
/// The localization identifier for the eat message. Needs a "food" entity argument passed to it.
/// </summary>
[DataField]
public string EatMessage = "food-nom";
public LocId EatMessage = "food-nom";
/// <summary>
/// How long it takes to eat the food personally.

View File

@@ -28,7 +28,7 @@ public sealed partial class OpenableComponent : Component
/// Text shown when examining and its open.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public string ExamineText = "drink-component-on-examine-is-opened";
public LocId ExamineText = "drink-component-on-examine-is-opened";
/// <summary>
/// The locale id for the popup shown when IsClosed is called and closed. Needs a "owner" entity argument passed to it.
@@ -36,7 +36,7 @@ public sealed partial class OpenableComponent : Component
/// It's still generic enough that you should change it if you make openable non-drinks, i.e. unwrap it first, peel it first.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public string ClosedPopup = "drink-component-try-use-drink-not-open";
public LocId ClosedPopup = "drink-component-try-use-drink-not-open";
/// <summary>
/// Sound played when opening.

View File

@@ -45,9 +45,9 @@ namespace Content.Server.Nutrition.EntitySystems
{
_puddle.TrySpillAt(uid, solution, out _, false);
}
if (!string.IsNullOrEmpty(foodComp.TrashPrototype))
if (!string.IsNullOrEmpty(foodComp.Trash))
{
EntityManager.SpawnEntity(foodComp.TrashPrototype, Transform(uid).Coordinates);
EntityManager.SpawnEntity(foodComp.Trash, Transform(uid).Coordinates);
}
}
ActivatePayload(uid);

View File

@@ -1,4 +1,3 @@
using System.Linq;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems;
@@ -22,13 +21,12 @@ using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Mobs.Systems;
using Content.Shared.Nutrition;
using Content.Shared.Verbs;
using Content.Shared.Stacks;
using Content.Shared.Storage;
using Content.Shared.Verbs;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using Content.Shared.Tag;
using Content.Shared.Storage;
namespace Content.Server.Nutrition.EntitySystems;
@@ -309,7 +307,7 @@ public sealed class FoodSystem : EntitySystem
if (ev.Cancelled)
return;
if (string.IsNullOrEmpty(component.TrashPrototype))
if (string.IsNullOrEmpty(component.Trash))
QueueDel(uid);
else
DeleteAndSpawnTrash(component, uid, args.User);
@@ -319,7 +317,7 @@ public sealed class FoodSystem : EntitySystem
{
//We're empty. Become trash.
var position = Transform(food).MapPosition;
var finisher = Spawn(component.TrashPrototype, position);
var finisher = Spawn(component.Trash, position);
// If the user is holding the item
if (user != null && _hands.IsHolding(user.Value, food, out var hand))

View File

@@ -1,8 +1,6 @@
using Content.Server.StationEvents.Events;
using Content.Shared.Cargo.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Server.StationEvents.Components;
@@ -15,43 +13,43 @@ public sealed partial class CargoGiftsRuleComponent : Component
/// <summary>
/// The base announcement string (which then incorporates the strings below)
/// </summary>
[DataField("announce"), ViewVariables(VVAccess.ReadWrite)]
public string Announce = "cargo-gifts-event-announcement";
[DataField, ViewVariables(VVAccess.ReadWrite)]
public LocId Announce = "cargo-gifts-event-announcement";
/// <summary>
/// What is being sent
/// </summary>
[DataField("description"), ViewVariables(VVAccess.ReadWrite)]
public string Description = "cargo-gift-default-description";
[DataField, ViewVariables(VVAccess.ReadWrite)]
public LocId Description = "cargo-gift-default-description";
/// <summary>
/// Sender of the gifts
/// </summary>
[DataField("sender"), ViewVariables(VVAccess.ReadWrite)]
public string Sender = "cargo-gift-default-sender";
[DataField, ViewVariables(VVAccess.ReadWrite)]
public LocId Sender = "cargo-gift-default-sender";
/// <summary>
/// Destination of the gifts (who they get sent to on the station)
/// </summary>
[DataField("dest"), ViewVariables(VVAccess.ReadWrite)]
public string Dest = "cargo-gift-default-dest";
[DataField, ViewVariables(VVAccess.ReadWrite)]
public LocId Dest = "cargo-gift-default-dest";
/// <summary>
/// Cargo that you would like gifted to the station, with the quantity for each
/// Use Ids from cargoProduct Prototypes
/// </summary>
[DataField("gifts", required: true, customTypeSerializer:typeof(PrototypeIdDictionarySerializer<int, CargoProductPrototype>)), ViewVariables(VVAccess.ReadWrite)]
public Dictionary<string, int> Gifts = new();
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
public Dictionary<ProtoId<CargoProductPrototype>, int> Gifts = new();
/// <summary>
/// How much space (minimum) you want to leave in the order database for supply to actually do their work
/// </summary>
[DataField("orderSpaceToLeave"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public int OrderSpaceToLeave = 5;
/// <summary>
/// Time until we consider next lot of gifts (if supply is overflowing with orders)
/// </summary>
[DataField("timeUntilNextGifts"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float TimeUntilNextGifts = 10.0f;
}

View File

@@ -4,7 +4,6 @@ using Content.Server.Cargo.Systems;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
using Content.Shared.Cargo.Prototypes;
using Robust.Shared.Prototypes;
namespace Content.Server.StationEvents.Events;
@@ -56,7 +55,7 @@ public sealed class CargoGiftsRule : StationEventSystem<CargoGiftsRuleComponent>
var (productId, qty) = component.Gifts.First();
component.Gifts.Remove(productId);
var product = _prototypeManager.Index<CargoProductPrototype>(productId);
var product = _prototypeManager.Index(productId);
if (!_cargoSystem.AddAndApproveOrder(
station!.Value,

View File

@@ -14,18 +14,18 @@ public sealed partial class PickRandomComponent : Component
/// <summary>
/// Whitelist for potential picked items.
/// </summary>
[DataField("whitelist"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public EntityWhitelist? Whitelist;
/// <summary>
/// Locale id for the pick verb text.
/// </summary>
[DataField("verbText"), ViewVariables(VVAccess.ReadWrite)]
public string VerbText = "comp-pick-random-verb-text";
[DataField, ViewVariables(VVAccess.ReadWrite)]
public LocId VerbText = "comp-pick-random-verb-text";
/// <summary>
/// Locale id for the empty storage message.
/// </summary>
[DataField("emptyText"), ViewVariables(VVAccess.ReadWrite)]
public string EmptyText = "comp-pick-random-empty";
[DataField, ViewVariables(VVAccess.ReadWrite)]
public LocId EmptyText = "comp-pick-random-empty";
}

View File

@@ -1,5 +1,4 @@
using System.Numerics;
using Vector2 = System.Numerics.Vector2;
namespace Content.Server.Tabletop.Components
{
@@ -12,25 +11,25 @@ namespace Content.Server.Tabletop.Components
/// <summary>
/// The localized name of the board. Shown in the UI.
/// </summary>
[DataField("boardName")]
public string BoardName { get; private set; } = "tabletop-default-board-name";
[DataField]
public LocId BoardName { get; private set; } = "tabletop-default-board-name";
/// <summary>
/// The type of method used to set up a tabletop.
/// </summary>
[DataField("setup", required: true)]
[DataField(required: true)]
public TabletopSetup Setup { get; private set; } = new TabletopChessSetup();
/// <summary>
/// The size of the viewport being opened. Must match the board dimensions otherwise you'll get the space parallax (unless that's what you want).
/// </summary>
[DataField("size")]
[DataField]
public Vector2i Size { get; private set; } = (300, 300);
/// <summary>
/// The zoom of the viewport camera.
/// </summary>
[DataField("cameraZoom")]
[DataField]
public Vector2 CameraZoom { get; private set; } = Vector2.One;
/// <summary>

View File

@@ -1,4 +1,3 @@
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Reflection;
using Robust.Shared.Serialization;
@@ -15,21 +14,21 @@ namespace Content.Server.UserInterface
[ViewVariables] public PlayerBoundUserInterface? UserInterface => (Key != null) ? Owner.GetUIOrNull(Key) : null;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("inHandsOnly")]
[DataField]
public bool InHandsOnly { get; set; } = false;
[DataField("singleUser")]
[DataField]
public bool SingleUser { get; set; } = false;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("adminOnly")]
[DataField]
public bool AdminOnly { get; set; } = false;
[DataField("key", required: true)]
private string _keyRaw = default!;
[DataField("verbText")]
public string VerbText = "ui-verb-toggle-open";
[DataField]
public LocId VerbText = "ui-verb-toggle-open";
/// <summary>
/// Whether you need a hand to operate this UI. The hand does not need to be free, you just need to have one.
@@ -39,28 +38,28 @@ namespace Content.Server.UserInterface
/// more generic interaction / configuration that might not require hands.
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("requireHands")]
[DataField]
public bool RequireHands = true;
/// <summary>
/// Whether you can activate this ui with activateinhand or not
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("rightClickOnly")]
[DataField]
public bool rightClickOnly = false;
/// <summary>
/// Whether spectators (non-admin ghosts) should be allowed to view this UI.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("allowSpectator")]
[DataField]
public bool AllowSpectator = true;
/// <summary>
/// Whether the UI should close when the item is deselected due to a hand swap or drop
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("closeOnHandDeselect")]
[DataField]
public bool CloseOnHandDeselect = true;
/// <summary>

View File

@@ -8,13 +8,13 @@ public sealed partial class WiresComponent : Component
/// <summary>
/// The name of this entity's internal board.
/// </summary>
[DataField("BoardName")]
public string BoardName { get; set; } = "wires-board-name-default";
[DataField]
public LocId BoardName { get; set; } = "wires-board-name-default";
/// <summary>
/// The layout ID of this entity's wires.
/// </summary>
[DataField("LayoutId", required: true)]
[DataField(required: true)]
public string LayoutId { get; set; } = default!;
/// <summary>
@@ -47,7 +47,7 @@ public sealed partial class WiresComponent : Component
/// If this should follow the layout saved the first time the layout dictated by the
/// layout ID is generated, or if a new wire order should be generated every time.
/// </summary>
[DataField("alwaysRandomize")]
[DataField]
public bool AlwaysRandomize { get; private set; }
/// <summary>
@@ -64,6 +64,6 @@ public sealed partial class WiresComponent : Component
[ViewVariables]
public Dictionary<object, object> StateData { get; } = new();
[DataField("pulseSound")]
[DataField]
public SoundSpecifier PulseSound = new SoundPathSpecifier("/Audio/Effects/multitool_pulse.ogg");
}