xenoborgsRuleComponent.MaxNumberXenoborgs = Math.Max(xenoborgsRuleComponent.MaxNumberXenoborgs, numXenoborgs);
- if ((float)numXenoborgs / (numHumans + numXenoborgs) > xenoborgsRuleComponent.XenoborgShuttleCallPercentage)
+ if (xenoborgsRuleComponent.XenoborgShuttleCalled
+ || (float)numXenoborgs / (numHumans + numXenoborgs) <= xenoborgsRuleComponent.XenoborgShuttleCallPercentage
+ || _roundEnd.IsRoundEndRequested())
+ return;
+
+ foreach (var station in _station.GetStations())
{
- foreach (var station in _station.GetStations())
- {
- _chatSystem.DispatchStationAnnouncement(station, Loc.GetString("xenoborg-shuttle-call"), colorOverride: Color.BlueViolet);
- }
- _roundEnd.RequestRoundEnd(null, false);
+ _chatSystem.DispatchStationAnnouncement(station, Loc.GetString("xenoborg-shuttle-call"), colorOverride: Color.BlueViolet);
}
+ _roundEnd.RequestRoundEnd(null, false, cantRecall: true);
+ xenoborgsRuleComponent.XenoborgShuttleCalled = true;
}
protected override void Started(EntityUid uid, XenoborgsRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
public TimeSpan? ExpectedShuttleLength => ExpectedCountdownEnd - LastCountdownStart;
public TimeSpan? ShuttleTimeLeft => ExpectedCountdownEnd - _gameTiming.CurTime;
+ /// <summary>
+ /// If the shuttle can't be recalled. if set to true, the station wont be able to recall
+ /// </summary>
+ public bool CantRecall = false;
+
public TimeSpan AutoCallStartTime;
private bool _autoCalledBefore = false;
_cooldownTokenSource = null;
}
+ CantRecall = false;
+
LastCountdownStart = null;
ExpectedCountdownEnd = null;
SetAutoCallTime();
public bool CanCallOrRecall()
{
- return _cooldownTokenSource == null;
+ return _cooldownTokenSource == null && !CantRecall;
}
public bool IsRoundEndRequested()
return _countdownTokenSource != null;
}
- public void RequestRoundEnd(EntityUid? requester = null, bool checkCooldown = true, string text = "round-end-system-shuttle-called-announcement", string name = "round-end-system-shuttle-sender-announcement")
+ /// <summary>
+ /// Starts the process of ending the round by calling evac
+ /// </summary>
+ /// <param name="requester"></param>
+ /// <param name="checkCooldown"></param>
+ /// <param name="text">text in the announcement of shuttle calling</param>
+ /// <param name="name">name in the announcement of shuttle calling</param>
+ /// <param name="cantRecall">if the station shouldn't be able to recall the shuttle</param>
+ public void RequestRoundEnd(EntityUid? requester = null, bool checkCooldown = true, string text = "round-end-system-shuttle-called-announcement", string name = "round-end-system-shuttle-sender-announcement", bool cantRecall = false)
{
var duration = DefaultCountdownDuration;
}
}
- RequestRoundEnd(duration, requester, checkCooldown, text, name);
+ RequestRoundEnd(duration, requester, checkCooldown, text, name, cantRecall);
}
- public void RequestRoundEnd(TimeSpan countdownTime, EntityUid? requester = null, bool checkCooldown = true, string text = "round-end-system-shuttle-called-announcement", string name = "round-end-system-shuttle-sender-announcement")
+ /// <summary>
+ /// Starts the process of ending the round by calling evac
+ /// </summary>
+ /// <param name="countdownTime">time for evac to arrive</param>
+ /// <param name="requester"></param>
+ /// <param name="checkCooldown"></param>
+ /// <param name="text">text in the announcement of shuttle calling</param>
+ /// <param name="name">name in the announcement of shuttle calling</param>
+ /// <param name="cantRecall">if the station shouldn't be able to recall the shuttle</param>
+ public void RequestRoundEnd(TimeSpan countdownTime, EntityUid? requester = null, bool checkCooldown = true, string text = "round-end-system-shuttle-called-announcement", string name = "round-end-system-shuttle-sender-announcement", bool cantRecall = false)
{
if (_gameTicker.RunLevel != GameRunLevel.InRound)
return;
return;
_countdownTokenSource = new();
+ CantRecall = cantRecall;
if (requester != null)
{
}
}
- public void CancelRoundEndCountdown(EntityUid? requester = null, bool checkCooldown = true)
+ public void CancelRoundEndCountdown(EntityUid? requester = null, bool forceRecall = false)
{
- if (_gameTicker.RunLevel != GameRunLevel.InRound) return;
- if (checkCooldown && _cooldownTokenSource != null) return;
+ if (_gameTicker.RunLevel != GameRunLevel.InRound)
+ return;
+
+ if (!forceRecall && (CantRecall || _cooldownTokenSource != null))
+ return;
+
+ if (_countdownTokenSource == null)
+ return;
- if (_countdownTokenSource == null) return;
_countdownTokenSource.Cancel();
_countdownTokenSource = null;