@@ -51,10 +51,10 @@ namespace Content.Server.Interaction.Components;
|
||||
public float SuccessChance = 1.0f; // Always succeed, unless specified otherwise on the yaml prototype.
|
||||
|
||||
/// <summary>
|
||||
/// Will the popup message be perceived by entities not involved in the interaction?
|
||||
/// If set, shows a message to all surrounding players but NOT the current player.
|
||||
/// </summary>
|
||||
[DataField("popupPerceivedByOthers")]
|
||||
public bool PopupPerceivedByOthers = false;
|
||||
[DataField("messagePerceivedByOthers")]
|
||||
public string? MessagePerceivedByOthers;
|
||||
|
||||
/// <summary>
|
||||
/// Will the sound effect be perceived by entities not involved in the interaction?
|
||||
|
||||
@@ -56,8 +56,12 @@ public sealed class InteractionPopupSystem : EntitySystem
|
||||
sfx = component.InteractFailureSound.GetSound();
|
||||
}
|
||||
|
||||
if (component.PopupPerceivedByOthers)
|
||||
_popupSystem.PopupEntity(msg, uid, Filter.Pvs(uid)); //play for everyone in range
|
||||
if (component.MessagePerceivedByOthers != null)
|
||||
{
|
||||
string msgOthers = Loc.GetString(component.MessagePerceivedByOthers,("user", args.User), ("target", uid));
|
||||
_popupSystem.PopupEntity(msg, uid, Filter.Entities(args.User));
|
||||
_popupSystem.PopupEntity(msgOthers, uid, Filter.Pvs(uid, 2F, EntityManager).RemoveWhereAttachedEntity(puid => puid == args.User));
|
||||
}
|
||||
else
|
||||
_popupSystem.PopupEntity(msg, uid, Filter.Entities(args.User)); //play only for the initiating entity.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user