Adds PopupMessage to being hugged [Fix #7644] (#7698)

This commit is contained in:
Júlio César Ueti
2022-04-23 20:43:11 -03:00
committed by GitHub
parent 94bd2b7c94
commit f5eead4ba9
9 changed files with 20 additions and 9 deletions

View File

@@ -51,10 +51,10 @@ namespace Content.Server.Interaction.Components;
public float SuccessChance = 1.0f; // Always succeed, unless specified otherwise on the yaml prototype. public float SuccessChance = 1.0f; // Always succeed, unless specified otherwise on the yaml prototype.
/// <summary> /// <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> /// </summary>
[DataField("popupPerceivedByOthers")] [DataField("messagePerceivedByOthers")]
public bool PopupPerceivedByOthers = false; public string? MessagePerceivedByOthers;
/// <summary> /// <summary>
/// Will the sound effect be perceived by entities not involved in the interaction? /// Will the sound effect be perceived by entities not involved in the interaction?

View File

@@ -56,8 +56,12 @@ public sealed class InteractionPopupSystem : EntitySystem
sfx = component.InteractFailureSound.GetSound(); sfx = component.InteractFailureSound.GetSound();
} }
if (component.PopupPerceivedByOthers) if (component.MessagePerceivedByOthers != null)
_popupSystem.PopupEntity(msg, uid, Filter.Pvs(uid)); //play for everyone in range {
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 else
_popupSystem.PopupEntity(msg, uid, Filter.Entities(args.User)); //play only for the initiating entity. _popupSystem.PopupEntity(msg, uid, Filter.Entities(args.User)); //play only for the initiating entity.

View File

@@ -39,3 +39,5 @@ comp-window-knock = *knock knock*
## Hugging players ## Hugging players
hugging-success-generic = You hug {THE($target)}. hugging-success-generic = You hug {THE($target)}.
hugging-success-generic-others = { CAPITALIZE(THE($user)) } hugs {THE($target)}.
hugging-success-generic-target = { CAPITALIZE(THE($user)) } hugs you.

View File

@@ -9,6 +9,7 @@
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/hug.ogg interactSuccessSound: /Audio/Effects/hug.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: Mind - type: Mind
showExamineInfo: true showExamineInfo: true
- type: Input - type: Input

View File

@@ -9,6 +9,7 @@
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/hug.ogg interactSuccessSound: /Audio/Effects/hug.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: Mind - type: Mind
showExamineInfo: true showExamineInfo: true
- type: Input - type: Input

View File

@@ -9,6 +9,7 @@
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/hug.ogg interactSuccessSound: /Audio/Effects/hug.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: Mind - type: Mind
showExamineInfo: true showExamineInfo: true
- type: Input - type: Input

View File

@@ -7,6 +7,7 @@
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/hug.ogg interactSuccessSound: /Audio/Effects/hug.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: Mind - type: Mind
showExamineInfo: true showExamineInfo: true
- type: Input - type: Input

View File

@@ -8,6 +8,7 @@
successChance: 1 successChance: 1
interactSuccessString: hugging-success-generic interactSuccessString: hugging-success-generic
interactSuccessSound: /Audio/Effects/hug.ogg interactSuccessSound: /Audio/Effects/hug.ogg
messagePerceivedByOthers: hugging-success-generic-others
- type: Mind - type: Mind
showExamineInfo: true showExamineInfo: true
- type: Input - type: Input

View File

@@ -69,7 +69,7 @@
base: window base: window
- type: InteractionPopup - type: InteractionPopup
interactSuccessString: comp-window-knock interactSuccessString: comp-window-knock
popupPerceivedByOthers: true messagePerceivedByOthers: comp-window-knock
interactSuccessSound: interactSuccessSound:
path: /Audio/Effects/glass_knock.ogg path: /Audio/Effects/glass_knock.ogg
- type: Construction - type: Construction
@@ -110,7 +110,7 @@
state: window state: window
- type: InteractionPopup - type: InteractionPopup
interactSuccessString: comp-window-knock interactSuccessString: comp-window-knock
popupPerceivedByOthers: true messagePerceivedByOthers: comp-window-knock
interactSuccessSound: interactSuccessSound:
path: /Audio/Effects/glass_knock.ogg path: /Audio/Effects/glass_knock.ogg
- type: Physics - type: Physics