Remove speech & popups from actions (#15747)
This commit is contained in:
@@ -157,39 +157,12 @@ public abstract class ActionType : IEquatable<ActionType>, IComparable, ICloneab
|
||||
[DataField("itemIconStyle")]
|
||||
public ItemActionIconStyle ItemIconStyle;
|
||||
|
||||
/// <summary>
|
||||
/// If not null, the user will speak these words when performing the action. Convenient feature to have for some
|
||||
/// actions. Gets passed through localization.
|
||||
/// </summary>
|
||||
[DataField("speech")]
|
||||
public string? Speech;
|
||||
|
||||
/// <summary>
|
||||
/// If not null, this sound will be played when performing this action.
|
||||
/// </summary>
|
||||
[DataField("sound")]
|
||||
public SoundSpecifier? Sound;
|
||||
|
||||
/// <summary>
|
||||
/// A pop-up to show the user when performing this action. Gets passed through localization.
|
||||
/// </summary>
|
||||
[DataField("userPopup")]
|
||||
public string? UserPopup;
|
||||
|
||||
/// <summary>
|
||||
/// A pop-up to show to all players when performing this action. Gets passed through localization.
|
||||
/// </summary>
|
||||
[DataField("popup")]
|
||||
public string? Popup;
|
||||
|
||||
/// <summary>
|
||||
/// If not null, this string will be appended to the pop-up localization strings when the action was toggled on
|
||||
/// after execution. Exists to make it easy to have a different pop-up for turning the action on or off (e.g.,
|
||||
/// combat mode toggle).
|
||||
/// </summary>
|
||||
[DataField("popupToggleSuffix")]
|
||||
public string? PopupToggleSuffix = null;
|
||||
|
||||
/// <summary>
|
||||
/// Compares two actions based on their properties. This is used to determine equality when the client requests the
|
||||
/// server to perform some action. Also determines the order in which actions are automatically added to the action bar.
|
||||
@@ -256,12 +229,8 @@ public abstract class ActionType : IEquatable<ActionType>, IComparable, ICloneab
|
||||
AutoRemove = toClone.AutoRemove;
|
||||
ItemIconStyle = toClone.ItemIconStyle;
|
||||
CheckCanInteract = toClone.CheckCanInteract;
|
||||
Speech = toClone.Speech;
|
||||
UseDelay = toClone.UseDelay;
|
||||
Sound = toClone.Sound;
|
||||
UserPopup = toClone.UserPopup;
|
||||
Popup = toClone.Popup;
|
||||
PopupToggleSuffix = toClone.PopupToggleSuffix;
|
||||
ItemIconStyle = toClone.ItemIconStyle;
|
||||
_entityIcon = toClone._entityIcon;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user