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

fix ipc nukies not getting comms #2884

Merged
merged 4 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 5 additions & 3 deletions Content.Server/Administration/Commands/SetOutfitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using Robust.Shared.Console;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Content.Server._EE.Silicon.IPC; // Goobstation
using Content.Shared._DV.Silicon.IPC; // DeltaV
using Content.Shared.Radio.Components; // Goobstation

namespace Content.Server.Administration.Commands
Expand Down Expand Up @@ -165,12 +165,14 @@ public static bool SetOutfit(EntityUid target, string gear, IEntityManager entit
var stationSpawning = entityManager.System<SharedStationSpawningSystem>();
stationSpawning.EquipRoleLoadout(target, roleLoadout, jobProto);
}


// Begin DeltaV/Goob Additions
if (entityManager.HasComponent<EncryptionKeyHolderComponent>(target))
{
var encryption = entityManager.System<InternalEncryptionKeySpawner>();
encryption.TryInsertEncryptionKey(target, startingGear, entityManager);
encryption.TryInsertEncryptionKey(target, startingGear);
}
// End DeltaV/Goob Additions
return true;
}
}
Expand Down
3 changes: 0 additions & 3 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server._EE.Silicon.IPC; // Goobstation

namespace Content.Server.Station.Systems;

Expand All @@ -51,7 +50,6 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
[Dependency] private readonly PdaSystem _pdaSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly InternalEncryptionKeySpawner _internalEncryption = default!; // Goobstation
private bool _randomizeCharacters;

/// <inheritdoc/>
Expand Down Expand Up @@ -179,7 +177,6 @@ public EntityUid SpawnPlayerMob(
{
var startingGear = _prototypeManager.Index<StartingGearPrototype>(prototype.StartingGear);
EquipStartingGear(entity.Value, startingGear, raiseEvent: false);
_internalEncryption.TryInsertEncryptionKey(entity.Value, startingGear, EntityManager); // Goobstation
}

var gearEquippedEv = new StartingGearEquippedEvent(entity.Value);
Expand Down
30 changes: 0 additions & 30 deletions Content.Server/_EE/Silicon/IPC/InternalEncryptionKeySpawner.cs

This file was deleted.

10 changes: 9 additions & 1 deletion Content.Shared/Station/SharedStationSpawningSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Content.Shared._DV.Silicon.IPC; // DeltaV
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Inventory;
Expand All @@ -23,6 +24,7 @@ public abstract class SharedStationSpawningSystem : EntitySystem
[Dependency] private readonly MetaDataSystem _metadata = default!;
[Dependency] private readonly SharedStorageSystem _storage = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
[Dependency] private readonly InternalEncryptionKeySpawner _internalEncryption = default!; // DeltaV

private EntityQuery<HandsComponent> _handsQuery;
private EntityQuery<InventoryComponent> _inventoryQuery;
Expand Down Expand Up @@ -99,6 +101,12 @@ public void EquipStartingGear(EntityUid entity, ProtoId<StartingGearPrototype>?
/// </summary>
public void EquipStartingGear(EntityUid entity, StartingGearPrototype? startingGear, bool raiseEvent = true)
{
// Begin DeltaV Additions: Fix nukie IPCs not having comms
if (startingGear is not {} proto)
return;

_internalEncryption.TryInsertEncryptionKey(entity, proto);
// End DeltaV Additions
EquipStartingGear(entity, (IEquipmentLoadout?) startingGear, raiseEvent);
}

Expand Down Expand Up @@ -174,4 +182,4 @@ public void EquipStartingGear(EntityUid entity, IEquipmentLoadout? startingGear,
RaiseLocalEvent(entity, ref ev);
}
}
}
}
40 changes: 40 additions & 0 deletions Content.Shared/_DV/Silicon/IPC/InternalEncryptionKeySpawner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Content.Shared.Containers;
using Content.Shared.Radio.Components;
using Content.Shared.Roles;
using Robust.Shared.Containers;

namespace Content.Shared._DV.Silicon.IPC;

public sealed class InternalEncryptionKeySpawner : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _container = default!;

/// <summary>
/// Inserts an IPC's encryption key from starting gear headset.
/// </summary>
/// <remarks>
/// Doesn't support a profile's loadouts, have fun.
/// </remarks>
public void TryInsertEncryptionKey(EntityUid target, StartingGearPrototype startingGear)
{
if (!TryComp<EncryptionKeyHolderComponent>(target, out var keyHolder)
|| !startingGear.Equipment.TryGetValue("ears", out var headsetId)
|| string.IsNullOrEmpty(headsetId))
return;

var headset = Spawn(headsetId, Transform(target).Coordinates);
if (!HasComp<EncryptionKeyHolderComponent>(headset)
|| !TryComp<ContainerFillComponent>(headset, out var fillComp)
|| !fillComp.Containers.TryGetValue(EncryptionKeyHolderComponent.KeyContainerName, out var defaultKeys))
return;

_container.CleanContainer(keyHolder.KeyContainer);

foreach (var key in defaultKeys)
{
SpawnInContainerOrDrop(key, target, keyHolder.KeyContainer.ID);
}

Del(headset);
}
}
Loading