mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* Fixed nukie behavior check firing early * Fixed ZombieOutbreak adding ramping schedulers * RampingSchedulers now look at when they were added for keypoint times * Xenoborgs no longer has a RampingScheduler roundstart. * Added number of cuffed hands check * Use GameRule activation time. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * silly compiler flag * Apply suggestions from code review Co-authored-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Signed-off-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> * Fix other locale usages * silly me * PR feedback --------- Signed-off-by: Vanessa <908648+ShepardToTheStars@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
57 lines
2.1 KiB
C#
57 lines
2.1 KiB
C#
using System.Linq;
|
|
using Content.Server.Administration;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.GameTicking.Components;
|
|
using Content.Shared.Prototypes;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Localization;
|
|
using Content.Shared.Fax;
|
|
using Content.Server.StationEvents.Components;
|
|
|
|
namespace Content.Server.GameTicking;
|
|
|
|
/// <summary>
|
|
/// Extends upstream's <see cref="GameTicker" />.
|
|
/// </summary>
|
|
public sealed partial class GameTicker
|
|
{
|
|
private static readonly EntProtoId RampingSchedulerProto = "RampingStationEventScheduler";
|
|
|
|
private static readonly TimeSpan GracePeriod = TimeSpan.FromMinutes(10);
|
|
|
|
/// <summary>
|
|
/// DeltaV - Removes the basic scheduler and adds a ramping scheduler to the round. Does nothing
|
|
/// if there is already a ramping scheduler.
|
|
/// </summary>
|
|
/// <returns>True if the game rules either contain or added a RampingStationEventScheduler.</returns>
|
|
[PublicAPI]
|
|
public bool ConvertRoundToSurvival()
|
|
{
|
|
// Ramping scheduler is already added. Do nothing.
|
|
if (IsGameRuleAdded(RampingSchedulerProto))
|
|
{
|
|
_chatManager.SendAdminAlert("RampingStationEventScheduler detected. No rules added.");
|
|
return true;
|
|
}
|
|
|
|
// Add a ramping scheduler with a delay.
|
|
var rampingScheduler = AddGameRule(RampingSchedulerProto);
|
|
var rampingSchedulerStart = _gameTiming.CurTime.Add(GracePeriod);
|
|
EnsureComp<DelayedStartRuleComponent>(rampingScheduler).RuleStartTime = rampingSchedulerStart;
|
|
|
|
_chatManager.SendAdminAlert($"Major antag defeated. Converting to survival at {(RoundDuration() + GracePeriod).ToString(@"hh\:mm\:ss")}.");
|
|
|
|
// End Basic Rules
|
|
var basicRules = EntityQueryEnumerator<BasicStationEventSchedulerComponent>();
|
|
while (basicRules.MoveNext(out var uid, out var rule))
|
|
EndGameRule(uid);
|
|
|
|
return IsGameRuleActive(RampingSchedulerProto);
|
|
}
|
|
}
|