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

@@ -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))