Small UI refactor pieces (#11026)

* ActionType rename Name to DisplayName

* Gameplay State rename+move
This commit is contained in:
wrexbe
2022-09-04 17:21:14 -07:00
committed by GitHub
parent 2c0dd52776
commit c55a015b77
27 changed files with 61 additions and 56 deletions

View File

@@ -306,7 +306,7 @@ namespace Content.Client.Actions.UI
return true; return true;
} }
if (Standardize(action.Name.ToString()).Contains(standardizedSearch)) if (Standardize(action.DisplayName.ToString()).Contains(standardizedSearch))
{ {
return true; return true;
} }

View File

@@ -193,7 +193,7 @@ namespace Content.Client.Actions.UI
private Control SupplyTooltip(Control? sender) private Control SupplyTooltip(Control? sender)
{ {
var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Name)); var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.DisplayName));
var decr = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Description)); var decr = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Description));
var tooltip = new ActionAlertTooltip(name, decr); var tooltip = new ActionAlertTooltip(name, decr);

View File

@@ -164,7 +164,7 @@ namespace Content.Client.Actions.UI
extra = Loc.GetString("ui-actionslot-charges", ("charges", Action.Charges)); extra = Loc.GetString("ui-actionslot-charges", ("charges", Action.Charges));
} }
var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Name)); var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.DisplayName));
var decr = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Description)); var decr = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Description));
var tooltip = new ActionAlertTooltip(name, decr, extra); var tooltip = new ActionAlertTooltip(name, decr, extra);

View File

@@ -14,6 +14,7 @@ using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using System.Threading; using System.Threading;
using Content.Client.Gameplay;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement; using Robust.Client.ResourceManagement;
using Timer = Robust.Shared.Timing.Timer; using Timer = Robust.Shared.Timing.Timer;
@@ -165,7 +166,7 @@ namespace Content.Client.Audio
StartLobbyMusic(); StartLobbyMusic();
return; return;
} }
else if (args.NewState is GameScreen) else if (args.NewState is GameplayState)
{ {
StartAmbience(); StartAmbience();
} }
@@ -195,7 +196,7 @@ namespace Content.Client.Audio
private void AmbienceCVarChanged(float volume) private void AmbienceCVarChanged(float volume)
{ {
if (_stateManager.CurrentState is GameScreen) if (_stateManager.CurrentState is GameplayState)
{ {
StartAmbience(); StartAmbience();
} }
@@ -237,7 +238,7 @@ namespace Content.Client.Audio
if (_currentCollection == null) if (_currentCollection == null)
return; return;
if (enabled && _stateManager.CurrentState is GameScreen && _currentCollection.ID == _stationAmbience.ID) if (enabled && _stateManager.CurrentState is GameplayState && _currentCollection.ID == _stationAmbience.ID)
{ {
StartAmbience(); StartAmbience();
} }
@@ -252,7 +253,7 @@ namespace Content.Client.Audio
if (_currentCollection == null) if (_currentCollection == null)
return; return;
if (enabled && _stateManager.CurrentState is GameScreen && _currentCollection.ID == _spaceAmbience.ID) if (enabled && _stateManager.CurrentState is GameplayState && _currentCollection.ID == _spaceAmbience.ID)
{ {
StartAmbience(); StartAmbience();
} }

View File

@@ -1,4 +1,5 @@
using Content.Client.Chat.UI; using Content.Client.Chat.UI;
using Content.Client.Gameplay;
using Content.Client.Viewport; using Content.Client.Viewport;
using Content.Shared.Chat; using Content.Shared.Chat;
using Content.Shared.Input; using Content.Shared.Input;
@@ -12,28 +13,28 @@ namespace Content.Client.Chat
public static void SetupChatInputHandlers(IInputManager inputManager, ChatBox chatBox) public static void SetupChatInputHandlers(IInputManager inputManager, ChatBox chatBox)
{ {
inputManager.SetInputCommand(ContentKeyFunctions.FocusChat, inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChat(chatBox))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChat(chatBox)));
inputManager.SetInputCommand(ContentKeyFunctions.FocusLocalChat, inputManager.SetInputCommand(ContentKeyFunctions.FocusLocalChat,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Local))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Local)));
inputManager.SetInputCommand(ContentKeyFunctions.FocusWhisperChat, inputManager.SetInputCommand(ContentKeyFunctions.FocusWhisperChat,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Whisper))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Whisper)));
inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC, inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.OOC))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.OOC)));
inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat, inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Admin))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Admin)));
inputManager.SetInputCommand(ContentKeyFunctions.FocusRadio, inputManager.SetInputCommand(ContentKeyFunctions.FocusRadio,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Radio))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Radio)));
inputManager.SetInputCommand(ContentKeyFunctions.FocusDeadChat, inputManager.SetInputCommand(ContentKeyFunctions.FocusDeadChat,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Dead))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Dead)));
inputManager.SetInputCommand(ContentKeyFunctions.FocusConsoleChat, inputManager.SetInputCommand(ContentKeyFunctions.FocusConsoleChat,
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Console))); InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Console)));
inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelForward, inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelForward,
InputCmdHandler.FromDelegate(_ => chatBox.CycleChatChannel(true))); InputCmdHandler.FromDelegate(_ => chatBox.CycleChatChannel(true)));

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Client.Administration.Managers; using Content.Client.Administration.Managers;
using Content.Client.Chat.UI; using Content.Client.Chat.UI;
using Content.Client.Gameplay;
using Content.Client.Ghost; using Content.Client.Ghost;
using Content.Client.Viewport; using Content.Client.Viewport;
using Content.Shared.Administration; using Content.Shared.Administration;
@@ -200,7 +201,7 @@ namespace Content.Client.Chat.Managers
// can always hear server (nobody can actually send server messages). // can always hear server (nobody can actually send server messages).
FilterableChannels |= ChatChannel.Server; FilterableChannels |= ChatChannel.Server;
if (_stateManager.CurrentState is GameScreenBase) if (_stateManager.CurrentState is GameplayStateBase)
{ {
// can always hear local / radio / emote when in the game // can always hear local / radio / emote when in the game
FilterableChannels |= ChatChannel.Local; FilterableChannels |= ChatChannel.Local;

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Client.Examine; using Content.Client.Examine;
using Content.Client.Gameplay;
using Content.Client.Verbs; using Content.Client.Verbs;
using Content.Client.Viewport; using Content.Client.Viewport;
using Content.Shared.CCVar; using Content.Shared.CCVar;
@@ -156,7 +157,7 @@ namespace Content.Client.ContextMenu.UI
if (args.State != BoundKeyState.Down) if (args.State != BoundKeyState.Down)
return false; return false;
if (_stateManager.CurrentState is not GameScreenBase) if (_stateManager.CurrentState is not GameplayStateBase)
return false; return false;
var coords = args.Coordinates.ToMap(_entityManager); var coords = args.Coordinates.ToMap(_entityManager);

View File

@@ -145,7 +145,7 @@ public sealed class DecalPlacementSystem : EntitySystem
ev.Action = new WorldTargetAction() ev.Action = new WorldTargetAction()
{ {
Name = $"{_decalId} ({_decalColor.ToHex()}, {(int) _decalAngle.Degrees})", // non-unique actions may be considered duplicates when saving/loading. DisplayName = $"{_decalId} ({_decalColor.ToHex()}, {(int) _decalAngle.Degrees})", // non-unique actions may be considered duplicates when saving/loading.
Icon = decalProto.Sprite, Icon = decalProto.Sprite,
Repeat = true, Repeat = true,
CheckCanAccess = false, CheckCanAccess = false,

View File

@@ -1,4 +1,5 @@
using Content.Client.CombatMode; using Content.Client.CombatMode;
using Content.Client.Gameplay;
using Content.Client.Outline; using Content.Client.Outline;
using Content.Client.Viewport; using Content.Client.Viewport;
using Content.Shared.ActionBlocker; using Content.Shared.ActionBlocker;
@@ -303,7 +304,7 @@ namespace Content.Client.DragDrop
IList<EntityUid> entities; IList<EntityUid> entities;
if (_stateManager.CurrentState is GameScreen screen) if (_stateManager.CurrentState is GameplayState screen)
{ {
entities = screen.GetEntitiesUnderPosition(args.Coordinates); entities = screen.GetEntitiesUnderPosition(args.Coordinates);
} }

View File

@@ -1,3 +1,4 @@
using Content.Client.Gameplay;
using Content.Client.HUD; using Content.Client.HUD;
using Content.Client.Viewport; using Content.Client.Viewport;
using Robust.Client.Console; using Robust.Client.Console;
@@ -27,7 +28,7 @@ namespace Content.Client.EscapeMenu
private void StateManagerOnOnStateChanged(StateChangedEventArgs obj) private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
{ {
if (obj.NewState is GameScreenBase) if (obj.NewState is GameplayStateBase)
{ {
// Switched TO GameScreen. // Switched TO GameScreen.
_escapeMenu = new UI.EscapeMenu(_consoleHost); _escapeMenu = new UI.EscapeMenu(_consoleHost);
@@ -37,7 +38,7 @@ namespace Content.Client.EscapeMenu
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu,
InputCmdHandler.FromDelegate(_ => Enabled())); InputCmdHandler.FromDelegate(_ => Enabled()));
} }
else if (obj.OldState is GameScreenBase) else if (obj.OldState is GameplayStateBase)
{ {
// Switched FROM GameScreen. // Switched FROM GameScreen.
_escapeMenu?.Dispose(); _escapeMenu?.Dispose();

View File

@@ -1,4 +1,5 @@
using Content.Client.Audio; using Content.Client.Audio;
using Content.Client.Gameplay;
using Content.Client.Lobby; using Content.Client.Lobby;
using Content.Client.RoundEnd; using Content.Client.RoundEnd;
using Content.Client.Viewport; using Content.Client.Viewport;
@@ -109,7 +110,7 @@ namespace Content.Client.GameTicking.Managers
private void JoinGame(TickerJoinGameEvent message) private void JoinGame(TickerJoinGameEvent message)
{ {
_stateManager.RequestStateChange<GameScreen>(); _stateManager.RequestStateChange<GameplayState>();
} }
private void LobbyCountdown(TickerLobbyCountdownEvent message) private void LobbyCountdown(TickerLobbyCountdownEvent message)

View File

@@ -6,6 +6,7 @@ using Content.Client.Construction.UI;
using Content.Client.Hands; using Content.Client.Hands;
using Content.Client.HUD; using Content.Client.HUD;
using Content.Client.HUD.UI; using Content.Client.HUD.UI;
using Content.Client.Viewport;
using Content.Client.Voting; using Content.Client.Voting;
using Content.Shared.Chat; using Content.Shared.Chat;
using Content.Shared.CCVar; using Content.Shared.CCVar;
@@ -15,14 +16,11 @@ using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Configuration; using Robust.Shared.Configuration;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
namespace Content.Client.Viewport namespace Content.Client.Gameplay
{ {
public sealed class GameScreen : GameScreenBase, IMainViewportState public sealed class GameplayState : GameplayStateBase, IMainViewportState
{ {
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15); public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);

View File

@@ -9,20 +9,17 @@ using Robust.Client.State;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Input; using Robust.Shared.Input;
using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Timing; using Robust.Shared.Timing;
namespace Content.Client.Viewport namespace Content.Client.Gameplay
{ {
// OH GOD. // OH GOD.
// Ok actually it's fine. // Ok actually it's fine.
// Instantiated dynamically through the StateManager, Dependencies will be resolved. // Instantiated dynamically through the StateManager, Dependencies will be resolved.
[Virtual] [Virtual]
public class GameScreenBase : State, IEntityEventSubscriber public class GameplayStateBase : State, IEntityEventSubscriber
{ {
[Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;

View File

@@ -1,3 +1,4 @@
using Content.Client.Gameplay;
using Content.Client.Lobby; using Content.Client.Lobby;
using Content.Client.Viewport; using Content.Client.Viewport;
using Content.Shared.CCVar; using Content.Shared.CCVar;
@@ -42,7 +43,7 @@ public sealed class RulesManager : SharedRulesManager
private void OnStateChanged(StateChangedEventArgs args) private void OnStateChanged(StateChangedEventArgs args)
{ {
if (args.NewState is not (GameScreen or LobbyState)) if (args.NewState is not (GameplayState or LobbyState))
return; return;
if (!_shouldShowRules) if (!_shouldShowRules)

View File

@@ -86,7 +86,7 @@ public sealed partial class MappingSystem : EntitySystem
{ {
CheckCanInteract = false, CheckCanInteract = false,
Event = actionEvent, Event = actionEvent,
Name = tileDef.Name, DisplayName = tileDef.Name,
Icon = tileIcon Icon = tileIcon
}; };
@@ -99,7 +99,7 @@ public sealed partial class MappingSystem : EntitySystem
{ {
CheckCanInteract = false, CheckCanInteract = false,
Event = actionEvent, Event = actionEvent,
Name = "action-name-mapping-erase", DisplayName = "action-name-mapping-erase",
Icon = _deleteIcon, Icon = _deleteIcon,
}; };
@@ -113,7 +113,7 @@ public sealed partial class MappingSystem : EntitySystem
{ {
CheckCanInteract = false, CheckCanInteract = false,
Event = actionEvent, Event = actionEvent,
Name = actionEvent.EntityType, DisplayName = actionEvent.EntityType,
Icon = new SpriteSpecifier.EntityPrototype(actionEvent.EntityType), Icon = new SpriteSpecifier.EntityPrototype(actionEvent.EntityType),
}; };
} }

View File

@@ -1,4 +1,5 @@
using Content.Client.ContextMenu.UI; using Content.Client.ContextMenu.UI;
using Content.Client.Gameplay;
using Content.Client.Interactable.Components; using Content.Client.Interactable.Components;
using Content.Client.Viewport; using Content.Client.Viewport;
using Content.Shared.CCVar; using Content.Shared.CCVar;
@@ -109,7 +110,7 @@ public sealed class InteractionOutlineSystem : EntitySystem
// Potentially change someday? who knows. // Potentially change someday? who knows.
var currentState = _stateManager.CurrentState; var currentState = _stateManager.CurrentState;
if (currentState is not GameScreen screen) return; if (currentState is not GameplayState screen) return;
EntityUid? entityToClick = null; EntityUid? entityToClick = null;
var renderScale = 1; var renderScale = 1;

View File

@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
using Content.Client.ContextMenu.UI; using Content.Client.ContextMenu.UI;
using Content.Client.Examine; using Content.Client.Examine;
using Content.Client.Gameplay;
using Content.Client.Popups; using Content.Client.Popups;
using Content.Client.Verbs.UI; using Content.Client.Verbs.UI;
using Content.Client.Viewport; using Content.Client.Viewport;
@@ -92,7 +93,7 @@ namespace Content.Client.Verbs
{ {
result = null; result = null;
if (_stateManager.CurrentState is not GameScreenBase gameScreenBase) if (_stateManager.CurrentState is not GameplayStateBase gameScreenBase)
return false; return false;
var player = _playerManager.LocalPlayer?.ControlledEntity; var player = _playerManager.LocalPlayer?.ControlledEntity;

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Abilities.Mime
{ {
UseDelay = TimeSpan.FromSeconds(30), UseDelay = TimeSpan.FromSeconds(30),
Icon = new SpriteSpecifier.Texture(new ResourcePath("Structures/Walls/solid.rsi/full.png")), Icon = new SpriteSpecifier.Texture(new ResourcePath("Structures/Walls/solid.rsi/full.png")),
Name = "mime-invisible-wall", DisplayName = "mime-invisible-wall",
Description = "mime-invisible-wall-desc", Description = "mime-invisible-wall-desc",
Priority = -1, Priority = -1,
Event = new InvisibleWallActionEvent(), Event = new InvisibleWallActionEvent(),

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Bible.Components
public InstantAction SummonAction = new() public InstantAction SummonAction = new()
{ {
Icon = new SpriteSpecifier.Texture(new ResourcePath("Clothing/Head/Hats/witch.rsi/icon.png")), Icon = new SpriteSpecifier.Texture(new ResourcePath("Clothing/Head/Hats/witch.rsi/icon.png")),
Name = "bible-summon-verb", DisplayName = "bible-summon-verb",
Description = "bible-summon-verb-desc", Description = "bible-summon-verb-desc",
Event = new SummonActionEvent(), Event = new SummonActionEvent(),
}; };

View File

@@ -22,7 +22,7 @@ namespace Content.Server.Ghost.Components
{ {
UseDelay = TimeSpan.FromSeconds(120), UseDelay = TimeSpan.FromSeconds(120),
Icon = new SpriteSpecifier.Texture(new ResourcePath("Interface/Actions/scream.png")), Icon = new SpriteSpecifier.Texture(new ResourcePath("Interface/Actions/scream.png")),
Name = "action-name-boo", DisplayName = "action-name-boo",
Description = "action-description-boo", Description = "action-description-boo",
CheckCanInteract = false, CheckCanInteract = false,
Event = new BooActionEvent(), Event = new BooActionEvent(),

View File

@@ -27,7 +27,7 @@ namespace Content.Server.Guardian
[DataField("action")] [DataField("action")]
public InstantAction Action = new() public InstantAction Action = new()
{ {
Name = "action-name-guardian", DisplayName = "action-name-guardian",
Description = "action-description-guardian", Description = "action-description-guardian",
Icon = new SpriteSpecifier.Texture(new ResourcePath("Interface/Actions/manifest.png")), Icon = new SpriteSpecifier.Texture(new ResourcePath("Interface/Actions/manifest.png")),
UseDelay = TimeSpan.FromSeconds(2), UseDelay = TimeSpan.FromSeconds(2),

View File

@@ -20,7 +20,7 @@ namespace Content.Server.Medical.Components
public EntityTargetAction Action = new() public EntityTargetAction Action = new()
{ {
Icon = new SpriteSpecifier.Texture(new ResourcePath("Clothing/Neck/Misc/stethoscope.rsi/icon.png")), Icon = new SpriteSpecifier.Texture(new ResourcePath("Clothing/Neck/Misc/stethoscope.rsi/icon.png")),
Name = "stethoscope-verb", DisplayName = "stethoscope-verb",
Priority = -1, Priority = -1,
Event = new StethoscopeActionEvent(), Event = new StethoscopeActionEvent(),
}; };

View File

@@ -188,7 +188,7 @@ namespace Content.Server.Polymorph.Systems
{ {
Prototype = polyproto, Prototype = polyproto,
}, },
Name = Loc.GetString("polymorph-self-action-name", ("target", entproto.Name)), DisplayName = Loc.GetString("polymorph-self-action-name", ("target", entproto.Name)),
Description = Loc.GetString("polymorph-self-action-description", ("target", entproto.Name)), Description = Loc.GetString("polymorph-self-action-description", ("target", entproto.Name)),
Icon = new SpriteSpecifier.EntityPrototype(polyproto.Entity), Icon = new SpriteSpecifier.EntityPrototype(polyproto.Entity),
ItemIconStyle = ItemActionIconStyle.NoItem, ItemIconStyle = ItemActionIconStyle.NoItem,

View File

@@ -114,7 +114,7 @@ namespace Content.Server.Polymorph.Systems
{ {
Event = new RevertPolymorphActionEvent(), Event = new RevertPolymorphActionEvent(),
EntityIcon = component.Parent, EntityIcon = component.Parent,
Name = Loc.GetString("polymorph-revert-action-name"), DisplayName = Loc.GetString("polymorph-revert-action-name"),
Description = Loc.GetString("polymorph-revert-action-description"), Description = Loc.GetString("polymorph-revert-action-description"),
UseDelay = TimeSpan.FromSeconds(component.Prototype.Delay), UseDelay = TimeSpan.FromSeconds(component.Prototype.Delay),
}; };

View File

@@ -35,7 +35,7 @@ public abstract class ActionType : IEquatable<ActionType>, IComparable, ICloneab
/// Name to show in UI. /// Name to show in UI.
/// </summary> /// </summary>
[DataField("name", required: true)] [DataField("name", required: true)]
public string Name = string.Empty; public string DisplayName = string.Empty;
/// <summary> /// <summary>
/// Description to show in UI. Accepts formatting. /// Description to show in UI. Accepts formatting.
@@ -207,8 +207,8 @@ public abstract class ActionType : IEquatable<ActionType>, IComparable, ICloneab
if (Priority != otherAction.Priority) if (Priority != otherAction.Priority)
return otherAction.Priority - Priority; return otherAction.Priority - Priority;
var name = FormattedMessage.RemoveMarkup(Loc.GetString(Name)); var name = FormattedMessage.RemoveMarkup(Loc.GetString(DisplayName));
var otherName = FormattedMessage.RemoveMarkup(Loc.GetString(otherAction.Name)); var otherName = FormattedMessage.RemoveMarkup(Loc.GetString(otherAction.DisplayName));
if (name != otherName) if (name != otherName)
return string.Compare(name, otherName, StringComparison.CurrentCulture); return string.Compare(name, otherName, StringComparison.CurrentCulture);
@@ -244,7 +244,7 @@ public abstract class ActionType : IEquatable<ActionType>, IComparable, ICloneab
Priority = toClone.Priority; Priority = toClone.Priority;
Icon = toClone.Icon; Icon = toClone.Icon;
IconOn = toClone.IconOn; IconOn = toClone.IconOn;
Name = toClone.Name; DisplayName = toClone.DisplayName;
Description = toClone.Description; Description = toClone.Description;
Provider = toClone.Provider; Provider = toClone.Provider;
AttachedEntity = toClone.AttachedEntity; AttachedEntity = toClone.AttachedEntity;
@@ -278,7 +278,7 @@ public abstract class ActionType : IEquatable<ActionType>, IComparable, ICloneab
unchecked unchecked
{ {
var hashCode = Priority.GetHashCode(); var hashCode = Priority.GetHashCode();
hashCode = (hashCode * 397) ^ Name.GetHashCode(); hashCode = (hashCode * 397) ^ DisplayName.GetHashCode();
hashCode = (hashCode * 397) ^ Provider.GetHashCode(); hashCode = (hashCode * 397) ^ Provider.GetHashCode();
return hashCode; return hashCode;
} }

View File

@@ -114,7 +114,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (!component.Actions.TryGetValue(ev.Action, out var act)) if (!component.Actions.TryGetValue(ev.Action, out var act))
{ {
_adminLogger.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} attempted to perform an action that they do not have: {ev.Action.Name}."); $"{ToPrettyString(user):user} attempted to perform an action that they do not have: {ev.Action.DisplayName}.");
return; return;
} }
@@ -128,7 +128,7 @@ public abstract class SharedActionsSystem : EntitySystem
BaseActionEvent? performEvent = null; BaseActionEvent? performEvent = null;
// Validate request by checking action blockers and the like: // Validate request by checking action blockers and the like:
var name = Loc.GetString(act.Name); var name = Loc.GetString(act.DisplayName);
switch (act) switch (act)
{ {
@@ -136,7 +136,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (ev.EntityTarget is not EntityUid { Valid: true } entityTarget) if (ev.EntityTarget is not EntityUid { Valid: true } entityTarget)
{ {
Logger.Error($"Attempted to perform an entity-targeted action without a target! Action: {entityAction.Name}"); Logger.Error($"Attempted to perform an entity-targeted action without a target! Action: {entityAction.DisplayName}");
return; return;
} }
@@ -164,7 +164,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (ev.MapTarget is not MapCoordinates mapTarget) if (ev.MapTarget is not MapCoordinates mapTarget)
{ {
Logger.Error($"Attempted to perform a map-targeted action without a target! Action: {worldAction.Name}"); Logger.Error($"Attempted to perform a map-targeted action without a target! Action: {worldAction.DisplayName}");
return; return;
} }

View File

@@ -50,7 +50,7 @@ namespace Content.Shared.Vehicle.Components
{ {
UseDelay = TimeSpan.FromSeconds(3.4), UseDelay = TimeSpan.FromSeconds(3.4),
Icon = new SpriteSpecifier.Texture(new ResourcePath("Objects/Fun/bikehorn.rsi/icon.png")), Icon = new SpriteSpecifier.Texture(new ResourcePath("Objects/Fun/bikehorn.rsi/icon.png")),
Name = "action-name-honk", DisplayName = "action-name-honk",
Description = "action-desc-honk", Description = "action-desc-honk",
Event = new HonkActionEvent(), Event = new HonkActionEvent(),
}; };