diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 15c0b26fdff2..3d5e54d1ee6e 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -31,6 +31,7 @@ using Robust.Shared.Player; using Robust.Shared.Prototypes; using Content.Shared.NameModifier.Components; +using Content.Shared.Popups; using Content.Shared.Power; namespace Content.Server.Fax; @@ -419,8 +420,17 @@ public void Send(EntityUid uid, FaxMachineComponent? component, FaxSendMessage a if (dataToCopy.Count == 0) return; - TryComp(sendEntity, out var nameMod); + //ss220 autogamma update + var faxEvent = new FaxSendAttemptEvent(uid, component.DestinationFaxAddress, component.FaxName); + RaiseLocalEvent(faxEvent); + if (faxEvent.Cancelled) + { + _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-copy-error"), uid, PopupType.SmallCaution); + return; + } + //ss220 autogamma update + TryComp(sendEntity, out var nameMod); //ss220 autogamma update TryComp(sendEntity, out var labelComponent); var payload = new NetworkPayload() diff --git a/Content.Server/GameTicking/Rules/Components/NukeopsRuleComponent.cs b/Content.Server/GameTicking/Rules/Components/NukeopsRuleComponent.cs index c3e421612587..35a281ecb330 100644 --- a/Content.Server/GameTicking/Rules/Components/NukeopsRuleComponent.cs +++ b/Content.Server/GameTicking/Rules/Components/NukeopsRuleComponent.cs @@ -77,6 +77,9 @@ public sealed partial class NukeopsRuleComponent : Component [DataField] public TimeSpan WarEvacShuttleDisabled = TimeSpan.FromMinutes(25); + [DataField] + public TimeSpan WarFaxDisabled = TimeSpan.FromMinutes(25); //ss220 autogamma update + /// /// Minimal operatives count for war declaration /// diff --git a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs index f3911c5f9dd5..b45faa4bda6f 100644 --- a/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs @@ -25,9 +25,13 @@ using Robust.Shared.Utility; using Content.Server.StationEvents.Components; using System.Linq; +using Content.Server.AlertLevel; using Content.Shared.Store.Components; using Robust.Shared.Prototypes; using Content.Server.Maps; +using Content.Server.Station.Systems; +using Content.Shared.Fax.Components; +using Content.Server.DeviceNetwork.Components; namespace Content.Server.GameTicking.Rules; @@ -41,6 +45,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem [Dependency] private readonly StoreSystem _store = default!; [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly IPrototypeManager _prototype = default!; + [Dependency] private readonly AlertLevelSystem _alertLevel = default!; //ss220 nukeops autogamma + [Dependency] private readonly StationSystem _station = default!; //ss220 nukeops autogamma + [Dependency] private readonly GameTicker _gameTicker = default!; //ss220 nukeops autogamma [ValidatePrototypeId] private const string TelecrystalCurrencyPrototype = "Telecrystal"; @@ -68,6 +75,7 @@ public override void Initialize() SubscribeLocalEvent(OnShuttleFTLAttempt); SubscribeLocalEvent(OnWarDeclared); SubscribeLocalEvent(OnShuttleCallAttempt); + SubscribeLocalEvent(OnFaxSendAttemptEvent); //ss220 autogamma update SubscribeLocalEvent(OnAfterAntagEntSelected); SubscribeLocalEvent(OnRuleLoadedGrids); @@ -284,6 +292,38 @@ private void OnRuleLoadedGrids(Entity ent, ref RuleLoadedG } } + //ss220 autogamma update + private void OnFaxSendAttemptEvent(FaxSendAttemptEvent ev) + { + var faxQuery = EntityQueryEnumerator(); + while (faxQuery.MoveNext(out var uid, out _, out var deviceNetwork)) + { + //we still want to to communicate by fax within the map + if (ev.DestinationFaxAddress == deviceNetwork.Address && + Transform(uid).MapUid == Transform(ev.FaxEnt).MapUid) + return; + } + + var nukeQuery = EntityQueryEnumerator(); + while (nukeQuery.MoveNext(out _, out _, out var nukeops)) + { + if (nukeops is { WarDeclaredTime: not null }) + { + var warTime = Timing.CurTime.Subtract(nukeops.WarDeclaredTime.Value); + if (warTime < nukeops.WarFaxDisabled) + { + + var nukeShuttle = Transform(ev.FaxEnt).GridUid; + if (!HasComp(nukeShuttle)) // spam to captain from nukeops shuttle muhaha + ev.Cancel(); + + return; + } + } + } + } + //ss220 autogamma update + private void OnShuttleFTLAttempt(ref ConsoleFTLAttemptEvent ev) { var query = QueryActiveRules(); @@ -350,6 +390,19 @@ private void OnWarDeclared(ref WarDeclaredEvent ev) ev.DeclaratorEntity.Comp.ShuttleDisabledTime = timeRemain; DistributeExtraTc((uid, nukeops)); + + //ss220 nukeops autogamma + foreach (var station in _station.GetStations()) + { + _alertLevel.SetLevel(station, "gamma", true, true, true); + } + var shedulerQuery = EntityQueryEnumerator(); + while (shedulerQuery.MoveNext(out var ent, out var gameRuleComp, out _)) + { + _gameTicker.EndGameRule(ent, gameRuleComp); // shutdown all inappropriate events during the war + //I don't know how to do it any other way, maybe I'm just dumb ^_^ + } + //ss220 nukeops autogamma } } } diff --git a/Content.Shared/Fax/Components/FaxMachineComponent.cs b/Content.Shared/Fax/Components/FaxMachineComponent.cs index bff07e763221..2b01caac0d75 100644 --- a/Content.Shared/Fax/Components/FaxMachineComponent.cs +++ b/Content.Shared/Fax/Components/FaxMachineComponent.cs @@ -166,3 +166,19 @@ public FaxPrintout(Dictionary? dataToCopy, Phot MetaData = metaData; } } + +//ss220 autogamma update +public sealed class FaxSendAttemptEvent : CancellableEntityEventArgs +{ + public EntityUid FaxEnt; + public string DestinationFaxAddress; + public string SenderFaxAddress; + + public FaxSendAttemptEvent(EntityUid faxEnt, string destinationFaxAddress, string senderFaxAddress) + { + FaxEnt = faxEnt; + DestinationFaxAddress = destinationFaxAddress; + SenderFaxAddress = senderFaxAddress; + } +} +//ss220 autogamma update