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

@@ -284,8 +284,8 @@ public abstract class SharedActionsSystem : EntitySystem
handled = actionEvent.Handled;
}
// Execute convenience functionality (pop-ups, sound, speech)
handled |= PerformBasicActions(performer, action, predicted);
_audio.PlayPredicted(action.Sound, performer,predicted ? performer : null);
handled |= action.Sound != null;
if (!handled)
return; // no interaction occurred.
@@ -312,30 +312,6 @@ public abstract class SharedActionsSystem : EntitySystem
if (dirty && component != null)
Dirty(component);
}
/// <summary>
/// Execute convenience functionality for actions (pop-ups, sound, speech)
/// </summary>
protected virtual bool PerformBasicActions(EntityUid performer, ActionType action, bool predicted)
{
if (action.Sound == null && string.IsNullOrWhiteSpace(action.Popup))
return false;
var filter = predicted ? Filter.PvsExcept(performer) : Filter.Pvs(performer);
_audio.Play(action.Sound, filter, performer, true);
if (string.IsNullOrWhiteSpace(action.Popup))
return true;
var msg = (!action.Toggled || string.IsNullOrWhiteSpace(action.PopupToggleSuffix))
? Loc.GetString(action.Popup)
: Loc.GetString(action.Popup + action.PopupToggleSuffix);
_popupSystem.PopupEntity(msg, performer, filter, true);
return true;
}
#endregion
#region AddRemoveActions