Use TheName macro and GrammarComponent (#1396)

This commit is contained in:
Hugal31
2020-07-17 10:44:32 +02:00
committed by GitHub
parent f313a9267a
commit a5051c549b
8 changed files with 32 additions and 15 deletions

View File

@@ -120,7 +120,7 @@ namespace Content.Server.GameObjects.Components.Gravity
var notifyManager = IoCManager.Resolve<IServerNotifyManager>();
notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("You repair the gravity generator with the welder"));
notifyManager.PopupMessage(Owner, eventArgs.User, Loc.GetString("You repair {0:theName} with {1:theName}", Owner, eventArgs.Using));
return true;
}

View File

@@ -101,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
if (UsesRemaining <= 0)
{
user.PopupMessage(user, Loc.GetString($"The {Owner.Name} is empty!"));
user.PopupMessage(user, Loc.GetString("{0:TheName} is empty!", Owner));
return false;
}

View File

@@ -46,7 +46,7 @@ namespace Content.Server.GameObjects.Components
if (size > MaxItemSize)
{
Owner.PopupMessage(eventArgs.User,
Loc.GetString("{0:TheName} is too big to fit in the plant!", eventArgs.Using.Name));
Loc.GetString("{0:TheName} is too big to fit in the plant!", eventArgs.Using));
return false;
}
@@ -57,7 +57,7 @@ namespace Content.Server.GameObjects.Components
return false;
}
Owner.PopupMessage(eventArgs.User, Loc.GetString("You hide {0:theName} in the plant.", eventArgs.Using.Name));
Owner.PopupMessage(eventArgs.User, Loc.GetString("You hide {0:theName} in the plant.", eventArgs.Using));
Rustle();
return true;
}

View File

@@ -106,7 +106,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
{
sprite.LayerSetState(0, "burnt");
_notifyManager.PopupMessage(Owner, user, "The flash burns out!");
_notifyManager.PopupMessage(Owner, user, Loc.GetString("The flash burns out!"));
}
else if (!_flashing)
{
@@ -151,7 +151,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (entity != user)
{
_notifyManager.PopupMessage(user, entity, $"{user.Name} blinds you with the {Owner.Name}");
_notifyManager.PopupMessage(user, entity, Loc.GetString("{0:TheName} blinds you with {1:theName}", user, Owner));
}
}
@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (inDetailsRange)
{
message.AddMarkup(_localizationManager.GetString(
$"The flash has [color=green]{Uses}[/color] uses remaining."));
"The flash has [color=green]{0}[/color] uses remaining.", Uses));
}
}
}

View File

@@ -109,7 +109,7 @@ namespace Content.Server.BodySystem
}
else //If surgery cannot be performed, show message saying so.
{
_sharedNotifyManager.PopupMessage(eventArgs.Target, eventArgs.User, Loc.GetString("You see no way to install the {0}.", Owner.Name));
_sharedNotifyManager.PopupMessage(eventArgs.Target, eventArgs.User, Loc.GetString("You see no way to install {0:theName}.", Owner));
}
}
@@ -122,7 +122,7 @@ namespace Content.Server.BodySystem
//TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc
if (!_optionsCache.TryGetValue(key, out object targetObject))
{
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, Loc.GetString("You see no useful way to attach the {0} anymore.", Owner.Name));
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, Loc.GetString("You see no useful way to attach {0:theName} anymore.", Owner));
}
string target = targetObject as string;
if (!_bodyManagerComponentCache.InstallDroppedBodyPart(this, target))
@@ -131,7 +131,7 @@ namespace Content.Server.BodySystem
}
else
{
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, Loc.GetString("You attach the {0}.", ContainedBodyPart.Name));
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, Loc.GetString("You attach {0:theName}.", ContainedBodyPart));
}
}

View File

@@ -12,6 +12,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Serialization;
@@ -81,7 +82,7 @@ namespace Content.Server.BodySystem
}
else //If surgery cannot be performed, show message saying so.
{
_sharedNotifyManager.PopupMessage(eventArgs.Target, eventArgs.User, "You see no useful way to use the " + Owner.Name + ".");
SendNoUsefulWayToUsePopup();
}
}
else if (eventArgs.Target.TryGetComponent<DroppedBodyPartComponent>(out DroppedBodyPartComponent droppedBodyPart)) //Attempt surgery on a DroppedBodyPart - there's only one possible target so no need for selection UI
@@ -102,7 +103,7 @@ namespace Content.Server.BodySystem
}
else //If surgery cannot be performed, show message saying so.
{
_sharedNotifyManager.PopupMessage(eventArgs.Target, eventArgs.User,"You see no useful way to use the " + Owner.Name + ".");
SendNoUsefulWayToUsePopup();
}
}
}
@@ -180,12 +181,12 @@ namespace Content.Server.BodySystem
//TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc
if (!_optionsCache.TryGetValue(key, out object targetObject))
{
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, "You see no useful way to use the " + Owner.Name + " anymore.");
SendNoUsefulWayToUseAnymorePopup();
}
BodyPart target = targetObject as BodyPart;
if (!target.AttemptSurgery(_surgeryType, _bodyManagerComponentCache, this, _performerCache))
{
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, "You see no useful way to use the " + Owner.Name + " anymore.");
SendNoUsefulWayToUseAnymorePopup();
}
}
@@ -197,14 +198,22 @@ namespace Content.Server.BodySystem
//TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc
if (!_optionsCache.TryGetValue(key, out object targetObject))
{
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, "You see no useful way to use the " + Owner.Name + " anymore.");
SendNoUsefulWayToUseAnymorePopup();
}
Mechanism target = targetObject as Mechanism;
CloseSurgeryUI(_performerCache.GetComponent<BasicActorComponent>().playerSession);
_callbackCache(target, _bodyManagerComponentCache, this, _performerCache);
}
private void SendNoUsefulWayToUsePopup()
{
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, Loc.GetString("You see no useful way to use {0:theName}.", Owner));
}
private void SendNoUsefulWayToUseAnymorePopup()
{
_sharedNotifyManager.PopupMessage(_bodyManagerComponentCache.Owner, _performerCache, Loc.GetString("You see no useful way to use {0:theName} anymore.", Owner));
}
public override void ExposeData(ObjectSerializer serializer)
{

View File

@@ -139,6 +139,8 @@
range: 0.8
arcwidth: 30
arc: fist
- type: Grammar
proper: true
- type: entity
save: false
@@ -254,3 +256,6 @@
- type: SpeciesVisualizer2D
- type: HumanoidAppearance
- type: Grammar
proper: true

View File

@@ -28,3 +28,6 @@
baseWalkSpeed: 7
- type: MovementIgnoreGravity
- type: Grammar
proper: true