This commit is contained in:
ShadowCommander
2023-03-26 11:31:13 -07:00
committed by GitHub
parent 0e5dc41fe8
commit bfc4da9377
85 changed files with 1150 additions and 684 deletions

View File

@@ -2,6 +2,7 @@ using System.Linq;
using System.Threading;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking.Rules.Configurations;
using Content.Server.Mind;
using Content.Server.Players;
using Content.Server.Roles;
using Content.Server.Station.Components;
@@ -50,6 +51,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
[Dependency] private readonly UplinkSystem _uplink = default!;
[Dependency] private readonly MindSystem _mindSystem = default!;
public override string Prototype => "Suspicion";
@@ -171,11 +173,11 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
DebugTools.AssertNotNull(mind?.OwnedEntity);
var traitorRole = new SuspicionTraitorRole(mind!, antagPrototype);
mind!.AddRole(traitorRole);
_mindSystem.AddRole(mind!, traitorRole);
traitors.Add(traitorRole);
// try to place uplink
_uplink.AddUplink(mind.OwnedEntity!.Value, traitorStartingBalance);
_uplink.AddUplink(mind!.OwnedEntity!.Value, traitorStartingBalance);
}
foreach (var player in list)
@@ -185,7 +187,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
DebugTools.AssertNotNull(mind);
mind!.AddRole(new SuspicionInnocentRole(mind, antagPrototype));
_mindSystem.AddRole(mind!, new SuspicionInnocentRole(mind!, antagPrototype));
}
foreach (var traitor in traitors)
@@ -204,8 +206,11 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
_chatManager.DispatchServerAnnouncement(Loc.GetString("rule-suspicion-added-announcement"));
var filter = Filter.Empty()
.AddWhere(session => ((IPlayerSession) session).ContentData()?.Mind?.HasRole<SuspicionTraitorRole>() ?? false);
var filter = Filter.Empty().AddWhere(session =>
{
var mind = ((IPlayerSession) session).ContentData()?.Mind;
return mind != null && _mindSystem.HasRole<SuspicionTraitorRole>(mind);
});
SoundSystem.Play(_addedSound.GetSound(), filter, AudioParams.Default);
@@ -301,7 +306,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
var mind = playerSession.ContentData()?.Mind;
if (mind != null && mind.HasRole<SuspicionTraitorRole>())
if (mind != null && _mindSystem.HasRole<SuspicionTraitorRole>(mind))
traitorsAlive++;
else
innocentsAlive++;