Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nukeops Gamma #2486

Merged
merged 8 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Content.Server/Fax/FaxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -419,8 +420,17 @@ public void Send(EntityUid uid, FaxMachineComponent? component, FaxSendMessage a
if (dataToCopy.Count == 0)
return;

TryComp<NameModifierComponent>(sendEntity, out var nameMod);
//ss220 autogamma update
var faxEvent = new FaxSendAttemptEvent(uid, component.DestinationFaxAddress, component.FaxName);
RaiseLocalEvent(ref faxEvent);
if (faxEvent.Cancelled)
{
_popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-copy-error"), uid, PopupType.SmallCaution);
return;
}
//ss220 autogamma update

TryComp<NameModifierComponent>(sendEntity, out var nameMod);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут пометку забыл

TryComp<LabelComponent>(sendEntity, out var labelComponent);

var payload = new NetworkPayload()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// <summary>
/// Minimal operatives count for war declaration
/// </summary>
Expand Down
42 changes: 42 additions & 0 deletions Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
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;

namespace Content.Server.GameTicking.Rules;

Expand All @@ -41,6 +44,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
[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<CurrencyPrototype>]
private const string TelecrystalCurrencyPrototype = "Telecrystal";
Expand Down Expand Up @@ -68,6 +74,7 @@ public override void Initialize()
SubscribeLocalEvent<ConsoleFTLAttemptEvent>(OnShuttleFTLAttempt);
SubscribeLocalEvent<WarDeclaredEvent>(OnWarDeclared);
SubscribeLocalEvent<CommunicationConsoleCallShuttleAttemptEvent>(OnShuttleCallAttempt);
SubscribeLocalEvent<FaxSendAttemptEvent>(OnFaxSendAttemptEvent); //ss220 autogamma update

SubscribeLocalEvent<NukeopsRuleComponent, AfterAntagEntitySelectedEvent>(OnAfterAntagEntSelected);
SubscribeLocalEvent<NukeopsRuleComponent, RuleLoadedGridsEvent>(OnRuleLoadedGrids);
Expand Down Expand Up @@ -284,6 +291,28 @@ private void OnRuleLoadedGrids(Entity<NukeopsRuleComponent> ent, ref RuleLoadedG
}
}

//ss220 autogamma update
private void OnFaxSendAttemptEvent(ref FaxSendAttemptEvent ev)
{
var query = EntityQueryEnumerator<GameRuleComponent, NukeopsRuleComponent>();
while (query.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<NukeOpsShuttleComponent>(nukeShuttle)) // spam to captain from nukeops shuttle muhaha
ev.Cancelled = true;

return;
}
}
}
}
//ss220 autogamma update

private void OnShuttleFTLAttempt(ref ConsoleFTLAttemptEvent ev)
{
var query = QueryActiveRules();
Expand Down Expand Up @@ -350,6 +379,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<GameRuleComponent, BasicStationEventSchedulerComponent>();
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
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions Content.Shared/Fax/Components/FaxMachineComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,14 @@ public FaxPrintout(Dictionary<Type, IPhotocopiedComponentData>? dataToCopy, Phot
MetaData = metaData;
}
}

//ss220 autogamma update
[ByRefEvent]
public record struct FaxSendAttemptEvent(EntityUid FaxEnt, string DestinationFaxAddress, string SenderFaxAddress)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Унаследуй от CancellableEntityEventArgs

{
public bool Cancelled = false;
public EntityUid FaxEnt = FaxEnt;
public string DestinationFaxAddress = DestinationFaxAddress;
public string SenderFaxAddress = SenderFaxAddress;
}
//ss220 autogamma update
Loading