Remove speech & popups from actions (#15747)

This commit is contained in:
Leon Friedrich
2023-04-26 16:04:44 +12:00
committed by GitHub
parent beacaed0bb
commit 4e7cea96de
22 changed files with 89 additions and 126 deletions

View File

@@ -161,39 +161,6 @@ namespace Content.Client.Actions
ActionRemoved?.Invoke(action);
}
/// <summary>
/// Execute convenience functionality for actions (pop-ups, sound, speech)
/// </summary>
protected override bool PerformBasicActions(EntityUid user, ActionType action, bool predicted)
{
var performedAction = action.Sound != null
|| !string.IsNullOrWhiteSpace(action.UserPopup)
|| !string.IsNullOrWhiteSpace(action.Popup);
if (!GameTiming.IsFirstTimePredicted)
return performedAction;
if (!string.IsNullOrWhiteSpace(action.UserPopup))
{
var msg = (!action.Toggled || string.IsNullOrWhiteSpace(action.PopupToggleSuffix))
? Loc.GetString(action.UserPopup)
: Loc.GetString(action.UserPopup + action.PopupToggleSuffix);
_popupSystem.PopupEntity(msg, user);
}
else if (!string.IsNullOrWhiteSpace(action.Popup))
{
var msg = (!action.Toggled || string.IsNullOrWhiteSpace(action.PopupToggleSuffix))
? Loc.GetString(action.Popup)
: Loc.GetString(action.Popup + action.PopupToggleSuffix);
_popupSystem.PopupEntity(msg, user);
}
_audio.Play(action.Sound, Filter.Local(), user, false);
return performedAction;
}
private void OnPlayerAttached(EntityUid uid, ActionsComponent component, PlayerAttachedEvent args)
{
LinkAllActions(component);

View File

@@ -16,7 +16,6 @@ namespace Content.Client.Ghost
Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/light.svg.192dpi.png")),
DisplayName = "ghost-gui-toggle-lighting-manager-name",
Description = "ghost-gui-toggle-lighting-manager-desc",
UserPopup = "ghost-gui-toggle-lighting-manager-popup",
ClientExclusive = true,
CheckCanInteract = false,
Event = new ToggleLightingActionEvent(),
@@ -27,7 +26,6 @@ namespace Content.Client.Ghost
Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/vv.svg.192dpi.png")),
DisplayName = "ghost-gui-toggle-fov-name",
Description = "ghost-gui-toggle-fov-desc",
UserPopup = "ghost-gui-toggle-fov-popup",
ClientExclusive = true,
CheckCanInteract = false,
Event = new ToggleFoVActionEvent(),
@@ -38,7 +36,6 @@ namespace Content.Client.Ghost
Icon = new SpriteSpecifier.Rsi(new ("Mobs/Ghosts/ghost_human.rsi"), "icon"),
DisplayName = "ghost-gui-toggle-ghost-visibility-name",
Description = "ghost-gui-toggle-ghost-visibility-desc",
UserPopup = "ghost-gui-toggle-ghost-visibility-popup",
ClientExclusive = true,
CheckCanInteract = false,
Event = new ToggleGhostsActionEvent(),

View File

@@ -1,6 +1,7 @@
using Content.Client.Movement.Systems;
using Content.Shared.Actions;
using Content.Shared.Ghost;
using Content.Shared.Popups;
using JetBrains.Annotations;
using Robust.Client.Console;
using Robust.Client.GameObjects;
@@ -17,6 +18,7 @@ namespace Content.Client.Ghost
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly ILightManager _lightManager = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
public int AvailableGhostRoleCount { get; private set; }
@@ -90,6 +92,7 @@ namespace Content.Client.Ghost
if (args.Handled)
return;
_popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup"), args.Performer);
_lightManager.Enabled = !_lightManager.Enabled;
args.Handled = true;
}
@@ -99,6 +102,7 @@ namespace Content.Client.Ghost
if (args.Handled)
return;
_popup.PopupEntity(Loc.GetString("ghost-gui-toggle-fov-popup"), args.Performer);
_contentEye.RequestToggleFov(uid);
args.Handled = true;
}
@@ -108,6 +112,7 @@ namespace Content.Client.Ghost
if (args.Handled)
return;
_popup.PopupEntity(Loc.GetString("ghost-gui-toggle-ghost-visibility-popup"), args.Performer);
ToggleGhostVisibility();
args.Handled = true;
}