This reverts commit 8128759ea8.
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking.Presets;
|
||||
using Content.Server.GameTicking.Rules.Configurations;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Shared.Random;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Configuration;
|
||||
using Content.Shared.CCVar;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules;
|
||||
|
||||
public sealed class AllCaptainsRuleSystem : GameRuleSystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
public override string Prototype => "AllCaptains";
|
||||
|
||||
private EntityUid holdJobs; // dunno if there should only be one reference like this because I'm a ss14 noob but hey it's only gotta work one day :P
|
||||
|
||||
public override void Added()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Started()
|
||||
{
|
||||
// temporarily disable role timers -- super hacky way workaround for client to be aware that role timers aren't required
|
||||
// without having to set up some kind of replication
|
||||
_cfg.SetCVar(CCVars.GameRoleTimers, false);
|
||||
}
|
||||
|
||||
public override void Ended()
|
||||
{
|
||||
_cfg.SetCVar(CCVars.GameRoleTimers, true);
|
||||
}
|
||||
|
||||
public StationJobsComponent GetJobs(EntityUid station)
|
||||
{
|
||||
if (!holdJobs.IsValid() || !HasComp<StationJobsComponent>(holdJobs)) // this doesn't check station parameter since all captains mode is the same for all stations.
|
||||
{
|
||||
holdJobs = Spawn(null, new EntityCoordinates(station, Vector2.Zero));
|
||||
var stationJobs = AddComp<StationJobsComponent>(holdJobs);
|
||||
|
||||
// Create captains-only specific job list
|
||||
var mapJobList = new Dictionary<string, List<int?>> {{"Captain", new List<int?>{int.MaxValue, int.MaxValue}}};
|
||||
|
||||
stationJobs.RoundStartTotalJobs = mapJobList.Values.Where(x => x[0] is not null && x[0] > 0).Sum(x => x[0]!.Value);
|
||||
stationJobs.MidRoundTotalJobs = mapJobList.Values.Where(x => x[1] is not null && x[1] > 0).Sum(x => x[1]!.Value);
|
||||
stationJobs.TotalJobs = stationJobs.MidRoundTotalJobs;
|
||||
stationJobs.JobList = mapJobList.ToDictionary(x => x.Key, x =>
|
||||
{
|
||||
if (x.Value[1] <= -1)
|
||||
return null;
|
||||
return (uint?) x.Value[1];
|
||||
});
|
||||
stationJobs.RoundStartJobList = mapJobList.ToDictionary(x => x.Key, x =>
|
||||
{
|
||||
if (x.Value[0] <= -1)
|
||||
return null;
|
||||
return (uint?) x.Value[0];
|
||||
});
|
||||
stationJobs.OverflowJobs = new HashSet<string>{"Captain"}; //stationData.StationConfig.OverflowJobs.ToHashSet();
|
||||
}
|
||||
|
||||
return Comp<StationJobsComponent>(holdJobs);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,6 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly UplinkSystem _uplink = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly AllCaptainsRuleSystem _allCaptainsRule = default!;
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
@@ -179,8 +178,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
||||
foreach (var player in candidates.Keys)
|
||||
{
|
||||
// Role prevents antag.
|
||||
if (!(_allCaptainsRule != null && _allCaptainsRule.RuleStarted) && // all captains mode lets some of the captains be traitors :3
|
||||
!(player.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job { CanBeAntag: false }) ?? false))
|
||||
if (!(player.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job { CanBeAntag: false }) ?? false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -298,8 +296,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
||||
if (ev.JobId == null || !_prototypeManager.TryIndex<JobPrototype>(ev.JobId, out var job))
|
||||
return;
|
||||
|
||||
if (!job.CanBeAntag &&
|
||||
!(_allCaptainsRule != null && _allCaptainsRule.RuleStarted)) // all captains mode lets some of the captains be traitors :3
|
||||
if (!job.CanBeAntag)
|
||||
return;
|
||||
|
||||
// Before the announcement is made, late-joiners are considered the same as players who readied.
|
||||
|
||||
Reference in New Issue
Block a user