Fix nukies sound not played (#21268)

* Play sound and sending greeting message works for nukies now!!!!!

* oops

* silly change
This commit is contained in:
faint
2023-10-28 05:28:20 +03:00
committed by GitHub
parent 1f59770ac1
commit 59176f7613
2 changed files with 17 additions and 8 deletions

View File

@@ -46,6 +46,7 @@ using Robust.Server.Player;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -334,7 +335,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
var eligibleQuery = EntityQueryEnumerator<StationEventEligibleComponent, NpcFactionMemberComponent>(); var eligibleQuery = EntityQueryEnumerator<StationEventEligibleComponent, NpcFactionMemberComponent>();
while (eligibleQuery.MoveNext(out var eligibleUid, out var eligibleComp, out var member)) while (eligibleQuery.MoveNext(out var eligibleUid, out var eligibleComp, out var member))
{ {
if (!_npcFaction.IsFactionFriendly(component.Faction, eligibleUid, member)) if (!_npcFaction.IsFactionHostile(component.Faction, eligibleUid, member))
continue; continue;
eligible.Add((eligibleUid, eligibleComp, member)); eligible.Add((eligibleUid, eligibleComp, member));
@@ -349,8 +350,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
var query = EntityQueryEnumerator<NukeOperativeComponent, ActorComponent>(); var query = EntityQueryEnumerator<NukeOperativeComponent, ActorComponent>();
while (query.MoveNext(out _, out var nukeops, out var actor)) while (query.MoveNext(out _, out var nukeops, out var actor))
{ {
_chatManager.DispatchServerMessage(actor.PlayerSession, Loc.GetString("nukeops-welcome", ("station", component.TargetStation.Value))); NotifyNukie(actor.PlayerSession, nukeops, component);
_audio.PlayGlobal(nukeops.GreetSoundNotification, actor.PlayerSession);
filter.AddPlayer(actor.PlayerSession); filter.AddPlayer(actor.PlayerSession);
} }
} }
@@ -793,10 +793,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
if (nukeops.TargetStation != null && !string.IsNullOrEmpty(Name(nukeops.TargetStation.Value))) if (nukeops.TargetStation != null && !string.IsNullOrEmpty(Name(nukeops.TargetStation.Value)))
{ {
_chatManager.DispatchServerMessage(playerSession, Loc.GetString("nukeops-welcome", ("station", nukeops.TargetStation.Value))); NotifyNukie(playerSession, component, nukeops);
// Notificate player about new role assignment
_audio.PlayGlobal(component.GreetSoundNotification, playerSession);
} }
} }
} }
@@ -994,6 +991,18 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
SpawnOperatives(numNukies, operatives, true, component); SpawnOperatives(numNukies, operatives, true, component);
} }
/// <summary>
/// Display a greeting message and play a sound for a nukie
/// </summary>
private void NotifyNukie(ICommonSession session, NukeOperativeComponent nukeop, NukeopsRuleComponent nukeopsRule)
{
if (nukeopsRule.TargetStation is not { } station)
return;
_chatManager.DispatchServerMessage(session, Loc.GetString("nukeops-welcome", ("station", station)));
_audio.PlayGlobal(nukeop.GreetSoundNotification, session);
}
//For admins forcing someone to nukeOps. //For admins forcing someone to nukeOps.
public void MakeLoneNukie(EntityUid mindId, MindComponent mind) public void MakeLoneNukie(EntityUid mindId, MindComponent mind)
{ {

View File

@@ -1,7 +1,7 @@
verb-categories-antag = Antag ctrl verb-categories-antag = Antag ctrl
admin-verb-make-traitor = Make the target into a traitor. admin-verb-make-traitor = Make the target into a traitor.
admin-verb-make-zombie = Zombifies the target immediately. admin-verb-make-zombie = Zombifies the target immediately.
admin-verb-make-nuclear-operative = Make target a into lone Nuclear Operative. admin-verb-make-nuclear-operative = Make target into a lone Nuclear Operative.
admin-verb-make-pirate = Make the target into a pirate. Note this doesn't configure the game rule. admin-verb-make-pirate = Make the target into a pirate. Note this doesn't configure the game rule.
admin-verb-make-head-rev = Make the target into a Head Revolutionary. admin-verb-make-head-rev = Make the target into a Head Revolutionary.