Refactoring of roles and notifications about antagonist assignment (#16864)
* Refactoring of antagonist roles and notifications about antagonist role assignment. Refactoring of traitor assignment methods and bug fixing. * Announcement files moved, code is adjusted to new revision * Play to entity changed to play to global cause of mono audio restrictions. * Path to audio files changed to sound specifiers, unique alerts for each role. * Uncommited changes * New alert sounds for each antag role. * PR review fixes * Antagonist role assignment sound notifications moved to Systems, sounds moved to Components. * License update * Fixed naming and redundant parameters --------- Co-authored-by: Титов Вячеслав Витальевич <rincew1nd@yandex.ru>
This commit is contained in:
@@ -14,12 +14,14 @@ using Content.Shared.Roles;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules;
|
||||
|
||||
@@ -35,10 +37,10 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IServerPreferencesManager _prefs = default!;
|
||||
[Dependency] private readonly StationSpawningSystem _stationSpawningSystem = default!;
|
||||
[Dependency] private readonly StationSystem _stationSystem = default!;
|
||||
[Dependency] private readonly PricingSystem _pricingSystem = default!;
|
||||
[Dependency] private readonly MapLoaderSystem _map = default!;
|
||||
[Dependency] private readonly NamingSystem _namingSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -218,6 +220,9 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
||||
|
||||
pirates.Pirates.Add(newMind);
|
||||
|
||||
// Notificate every player about a pirate antagonist role with sound
|
||||
_audioSystem.PlayGlobal(pirates.PirateAlertSound, session);
|
||||
|
||||
GameTicker.PlayerJoinGame(session);
|
||||
}
|
||||
|
||||
@@ -235,6 +240,20 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
||||
if (!mind.OwnedEntity.HasValue)
|
||||
return;
|
||||
SetOutfitCommand.SetOutfit(mind.OwnedEntity.Value, "PirateGear", EntityManager);
|
||||
|
||||
var pirateRule = EntityQuery<PiratesRuleComponent>().FirstOrDefault();
|
||||
if (pirateRule == null)
|
||||
{
|
||||
//todo fuck me this shit is awful
|
||||
GameTicker.StartGameRule("Pirates", out var ruleEntity);
|
||||
pirateRule = Comp<PiratesRuleComponent>(ruleEntity);
|
||||
}
|
||||
|
||||
// Notificate every player about a pirate antagonist role with sound
|
||||
if (mind.Session != null)
|
||||
{
|
||||
_audioSystem.PlayGlobal(pirateRule.PirateAlertSound, mind.Session);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
||||
|
||||
Reference in New Issue
Block a user