]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix nukies sound not played (#21268)
authorfaint <46868845+ficcialfaint@users.noreply.github.com>
Sat, 28 Oct 2023 02:28:20 +0000 (05:28 +0300)
committerGitHub <noreply@github.com>
Sat, 28 Oct 2023 02:28:20 +0000 (22:28 -0400)
* Play sound and sending greeting message works for nukies now!!!!!

* oops

* silly change

Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Resources/Locale/en-US/administration/antag.ftl

index 4d3eee81e2af90d4556d64fdb9f7a12e770aecfc..5be6820b974f7cd014a466ae07211e8b965e6044 100644 (file)
@@ -46,6 +46,7 @@ using Robust.Server.Player;
 using Robust.Shared.Audio;
 using Robust.Shared.Map;
 using Robust.Shared.Player;
+using Robust.Shared.Players;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
@@ -334,7 +335,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
         var eligibleQuery = EntityQueryEnumerator<StationEventEligibleComponent, NpcFactionMemberComponent>();
         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;
 
             eligible.Add((eligibleUid, eligibleComp, member));
@@ -349,8 +350,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
         var query = EntityQueryEnumerator<NukeOperativeComponent, ActorComponent>();
         while (query.MoveNext(out _, out var nukeops, out var actor))
         {
-            _chatManager.DispatchServerMessage(actor.PlayerSession, Loc.GetString("nukeops-welcome", ("station", component.TargetStation.Value)));
-            _audio.PlayGlobal(nukeops.GreetSoundNotification, actor.PlayerSession);
+            NotifyNukie(actor.PlayerSession, nukeops, component);
             filter.AddPlayer(actor.PlayerSession);
         }
     }
@@ -793,10 +793,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
 
             if (nukeops.TargetStation != null && !string.IsNullOrEmpty(Name(nukeops.TargetStation.Value)))
             {
-                _chatManager.DispatchServerMessage(playerSession, Loc.GetString("nukeops-welcome", ("station", nukeops.TargetStation.Value)));
-
-                 // Notificate player about new role assignment
-                 _audio.PlayGlobal(component.GreetSoundNotification, playerSession);
+                NotifyNukie(playerSession, component, nukeops);
             }
         }
     }
@@ -994,6 +991,18 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
         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.
     public void MakeLoneNukie(EntityUid mindId, MindComponent mind)
     {
index 3d098c1c549d4f24897cec1579ab40f4dd45bb73..f3b3d91945ba67cd097c2edf6c51722714cb1bf8 100644 (file)
@@ -1,7 +1,7 @@
 verb-categories-antag = Antag ctrl
 admin-verb-make-traitor = Make the target into a traitor.
 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-head-rev = Make the target into a Head Revolutionary.