Operations (#21154)

* Creates an operation name when Nukies spawn.

* Fixed each nukie getting a different name

* Fixed it again for real this time

* commit name

* Revert "fix (#20719)"

This reverts commit bfa301b53e.

* Fixed it (for real this time it works now I swear)

* Update Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs

Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com>

* shortened variable names

* moved a method

* typo fix

* rewrote the lists in alphabetical order

---------

Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com>
This commit is contained in:
2013HORSEMEATSCANDAL
2023-11-16 16:04:50 -05:00
committed by GitHub
parent c177b4eb41
commit 23b54dae79
5 changed files with 237 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ using Content.Server.Administration.Commands;
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Server.Communications;
using Content.Server.RandomMetadata;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Ghost.Roles.Events;
@@ -67,6 +68,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
[Dependency] private readonly IServerPreferencesManager _prefs = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly RandomMetadataSystem _randomMetadata = default!;
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
@@ -79,6 +81,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly WarDeclaratorSystem _warDeclarator = default!;
[ValidatePrototypeId<CurrencyPrototype>]
private const string TelecrystalCurrencyPrototype = "Telecrystal";
@@ -88,6 +91,12 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
[ValidatePrototypeId<AntagPrototype>]
public const string NukeopsId = "Nukeops";
[ValidatePrototypeId<DatasetPrototype>]
private const string OperationPrefixDataset = "operationPrefix";
[ValidatePrototypeId<DatasetPrototype>]
private const string OperationSuffixDataset = "operationSuffix";
public override void Initialize()
{
base.Initialize();
@@ -344,6 +353,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
return;
component.TargetStation = _random.Pick(eligible);
component.OperationName = _randomMetadata.GetRandomFromSegments(new List<string> {OperationPrefixDataset, OperationSuffixDataset}, " ");
var filter = Filter.Empty();
var query = EntityQueryEnumerator<NukeOperativeComponent, ActorComponent>();
@@ -969,6 +979,19 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
}
}
/// <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), ("name", nukeopsRule.OperationName)));
_audio.PlayGlobal(nukeop.GreetSoundNotification, session);
}
private void SpawnOperativesForGhostRoles(EntityUid uid, NukeopsRuleComponent? component = null)
{
if (!Resolve(uid, ref component))
@@ -990,18 +1013,6 @@ 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)
{