Skip to content

Commit

Permalink
map fax communcation
Browse files Browse the repository at this point in the history
  • Loading branch information
canvaswalker committed Feb 28, 2025
1 parent d0388ab commit 02568c6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Content.Server/Fax/FaxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@ public void Send(EntityUid uid, FaxMachineComponent? component, FaxSendMessage a

//ss220 autogamma update
var faxEvent = new FaxSendAttemptEvent(uid, component.DestinationFaxAddress, component.FaxName);
RaiseLocalEvent(ref faxEvent);
RaiseLocalEvent(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);
TryComp<NameModifierComponent>(sendEntity, out var nameMod); //ss220 autogamma update
TryComp<LabelComponent>(sendEntity, out var labelComponent);

var payload = new NetworkPayload()
Expand Down
19 changes: 15 additions & 4 deletions Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Content.Server.Maps;
using Content.Server.Station.Systems;
using Content.Shared.Fax.Components;
using Content.Server.DeviceNetwork.Components;

namespace Content.Server.GameTicking.Rules;

Expand Down Expand Up @@ -292,19 +293,29 @@ private void OnRuleLoadedGrids(Entity<NukeopsRuleComponent> ent, ref RuleLoadedG
}

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

return;
}
Expand Down
17 changes: 11 additions & 6 deletions Content.Shared/Fax/Components/FaxMachineComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,17 @@ public FaxPrintout(Dictionary<Type, IPhotocopiedComponentData>? dataToCopy, Phot
}

//ss220 autogamma update
[ByRefEvent]
public record struct FaxSendAttemptEvent(EntityUid FaxEnt, string DestinationFaxAddress, string SenderFaxAddress)
public sealed class FaxSendAttemptEvent : CancellableEntityEventArgs
{
public bool Cancelled = false;
public EntityUid FaxEnt = FaxEnt;
public string DestinationFaxAddress = DestinationFaxAddress;
public string SenderFaxAddress = SenderFaxAddress;
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

0 comments on commit 02568c6

Please sign in to comment.