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:
Vyacheslav Titov
2023-06-07 10:15:22 +03:00
committed by GitHub
parent f5d2b0e284
commit 2e241691aa
25 changed files with 187 additions and 87 deletions

View File

@@ -10,6 +10,7 @@ using Content.Server.NPC.Components;
using Content.Server.NPC.Systems;
using Content.Server.Nuke;
using Content.Server.Preferences.Managers;
using Content.Server.Roles;
using Content.Server.RoundEnd;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
@@ -194,8 +195,6 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
_chatManager.DispatchServerMessage(actor.PlayerSession, Loc.GetString("nukeops-welcome", ("station", component.TargetStation.Value)));
filter.AddPlayer(actor.PlayerSession);
}
_audioSystem.PlayGlobal(component.GreetSound, filter, recordReplay: false);
}
private void OnRoundEnd(EntityUid uid, NukeopsRuleComponent? component = null)
@@ -583,7 +582,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
{
role ??= nukeops.OperativeRoleProto;
mind.AddRole(new TraitorRole(mind, _prototypeManager.Index<AntagPrototype>(role)));
mind.AddRole(new NukeopsRole(mind, _prototypeManager.Index<AntagPrototype>(role)));
nukeops.OperativeMindPendingData.Remove(uid);
}
@@ -599,10 +598,13 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
if (GameTicker.RunLevel != GameRunLevel.InRound)
return;
_audioSystem.PlayGlobal(nukeops.GreetSound, playerSession);
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
_audioSystem.PlayGlobal(component.GreetSoundNotification, playerSession);
}
}
}
@@ -760,7 +762,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
CharacterName = spawnDetails.Name
};
newMind.ChangeOwningPlayer(session.UserId);
newMind.AddRole(new TraitorRole(newMind, nukeOpsAntag));
newMind.AddRole(new NukeopsRole(newMind, nukeOpsAntag));
newMind.TransferTo(mob);
}
@@ -808,7 +810,7 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
return;
//ok hardcoded value bad but so is everything else here
mind.AddRole(new TraitorRole(mind, _prototypeManager.Index<AntagPrototype>("Nukeops")));
mind.AddRole(new NukeopsRole(mind, _prototypeManager.Index<AntagPrototype>("Nukeops")));
SetOutfitCommand.SetOutfit(mind.OwnedEntity.Value, "SyndicateOperativeGearFull", EntityManager);
}