Skip to content

Commit 4974d97

Browse files
authored
Merge branch 'new-frontiers-14:master' into Remove-NFSD-science
2 parents f696cc1 + acc57f1 commit 4974d97

File tree

189 files changed

+14698
-11129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+14698
-11129
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@
5555
#/.github/workflows/frontier-mapchecker.yml @whatston3
5656

5757
# All Frontier Maps
58-
/Resources/Maps/_NF/ @arimah @dustylens @MagnusCrowe
58+
/Resources/Maps/_NF/ @arimah @dustylens @MagnusCrowe @the-hivequeen

Content.Client/_NF/CryoSleep/CryoSleepEui.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Content.Shared._NF.Shipyard.Components;
1111
using Content.Shared.Access.Components;
1212
using Content.Shared.Eui;
13+
using Content.Shared.FixedPoint;
1314
using Content.Shared.IdentityManagement;
1415
using Content.Shared.Inventory;
1516
using Content.Shared.PDA;
@@ -84,7 +85,7 @@ public override void HandleMessage(EuiMessageBase msg)
8485
slotsComp);
8586
//Uplink
8687
string? uplinkWarningLoc = warningMsg.FoundUplink.HasValue
87-
? GetUplinkWarningLocMessage(warningMsg.FoundUplink.Value, slotsComp)
88+
? GetUplinkWarningLocMessage(warningMsg.FoundUplink.Value, slotsComp, warningMsg.UplinkBalance)
8889
: null;
8990
//Items
9091
string? itemWarningLoc = GetImportantItemWarningLocMessage(warningMsg.ImportantItems, slotsComp);
@@ -108,17 +109,23 @@ public override void HandleMessage(EuiMessageBase msg)
108109

109110
private string GetStorageName(CryoSleepWarningMessage.NetworkedWarningItem item, InventorySlotsComponent inventoryComp)
110111
{
111-
if (item.SlotId == null)
112+
if (item.Container is not null)
112113
{
113114
return Identity.Name(_entityManager.GetEntity(item.Container!.Value), _entityManager);
114115
}
115-
else
116+
else if (item.SlotId is not null)
116117
{
117118
//Lowercase this just to make the name not look weird in the popup
118119
var returnVal = inventoryComp.SlotData[item.SlotId].SlotDisplayName;
119120
//I can't execute without assigning it first
120121
return returnVal.ToLower();
121122
}
123+
else if (item.HandId is not null)
124+
//Hand IDs are not human readable, with no reliable way to get a human readable name. This is a bit hardcodey, but it should work in 95% of situations
125+
//If someone has a way to convert to a human name, go for it
126+
return Loc.GetString("accept-cryo-window-prompt-hand-slot-name");
127+
128+
return "ERROR";
122129
}
123130

124131
//All of these message get methods were moved to be separate to make the code less rigid, and easier to read.
@@ -211,20 +218,20 @@ private string GetStorageName(CryoSleepWarningMessage.NetworkedWarningItem item,
211218
//Grab any needed uplink warnings.
212219
//Returns null if no warning is needed
213220
private string? GetUplinkWarningLocMessage(CryoSleepWarningMessage.NetworkedWarningItem foundUplink,
214-
InventorySlotsComponent slotsComp)
221+
InventorySlotsComponent slotsComp,
222+
FixedPoint2 balance)
215223
{
216224
var localUplink = _entityManager.GetEntity(foundUplink.Item);
217225
if (!_entityManager.TryGetComponent<StoreComponent>(localUplink, out var store))
218226
return null;
219227
var currencyProtoId = store.Balance.Keys.First();
220-
var amount = store.Balance[currencyProtoId];
221-
if (amount == 0
228+
if (balance.Equals(0)
222229
|| !_prototypeManager.TryIndex(currencyProtoId, out var currencyProto))
223230
return null;
224231
return Loc.GetString("accept-cryo-window-prompt-uplink-warning",
225232
("uplink", Identity.Name(_entityManager.GetEntity(foundUplink.Item), _entityManager)),
226233
("storage", GetStorageName(foundUplink, slotsComp)),
227-
("amount", amount),
234+
("amount", balance),
228235
("currency", Loc.GetString(currencyProto.DisplayName)));
229236
}
230237

Content.Server/Botany/Systems/PlantHolderSystem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ private void OnInteractUsing(Entity<PlantHolderComponent> entity, ref InteractUs
322322
{
323323
healthOverride = component.Health;
324324
}
325+
component.Seed.Unique = false;
325326
var packetSeed = component.Seed;
326327
var seed = _botany.SpawnSeedPacket(packetSeed, Transform(args.User).Coordinates, args.User, healthOverride);
327328
_randomHelper.RandomOffset(seed, 0.25f);

Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Content.Shared.Database;
77
using Content.Shared.DeviceNetwork;
88
using Content.Shared.DeviceNetwork.Events;
9+
using Content.Shared.Item.ItemToggle.Components;
910
using Content.Shared.Power;
1011
using Content.Shared.SurveillanceCamera;
1112
using Content.Shared.Verbs;
@@ -64,6 +65,8 @@ public override void Initialize()
6465
SubscribeLocalEvent<SurveillanceCameraComponent, SurveillanceCameraSetupSetName>(OnSetName);
6566
SubscribeLocalEvent<SurveillanceCameraComponent, SurveillanceCameraSetupSetNetwork>(OnSetNetwork);
6667
SubscribeLocalEvent<SurveillanceCameraComponent, GetVerbsEvent<AlternativeVerb>>(AddVerbs);
68+
SubscribeLocalEvent<SurveillanceCameraComponent, MapInitEvent>(OnMapInit); // Frontier - togglable body cameras
69+
SubscribeLocalEvent<SurveillanceCameraComponent, ItemToggledEvent>(OnToggled); // Frontier - togglable body cameras
6770

6871
//SubscribeLocalEvent<SurveillanceCameraComponent, EmpPulseEvent>(OnEmpPulse); // Frontier: Upstream - #28984
6972
//SubscribeLocalEvent<SurveillanceCameraComponent, EmpDisabledRemoved>(OnEmpDisabledRemoved); // Frontier: Upstream - #28984
@@ -162,6 +165,21 @@ private void OnShutdown(EntityUid camera, SurveillanceCameraComponent component,
162165
Deactivate(camera, component);
163166
}
164167

168+
// Frontier - Toggleable body cameras
169+
private void OnMapInit(Entity<SurveillanceCameraComponent> ent, ref MapInitEvent args)
170+
{
171+
if (!TryComp<ItemToggleComponent>(ent, out var toggle))
172+
return;
173+
174+
SetActive(ent, toggle.Activated, ent.Comp);
175+
}
176+
177+
private void OnToggled(Entity<SurveillanceCameraComponent> ent, ref ItemToggledEvent args)
178+
{
179+
SetActive(ent, args.Activated, ent.Comp);
180+
}
181+
// End Frontier
182+
165183
private void OnSetName(EntityUid uid, SurveillanceCameraComponent component, SurveillanceCameraSetupSetName args)
166184
{
167185
if (args.UiKey is not SurveillanceCameraSetupUiKey key

Content.Server/_NF/CryoSleep/CryoSleepSystem.cs

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Diagnostics.CodeAnalysis;
2+
using System.Linq;
23
using System.Numerics;
34
using Content.Server._NF.Shipyard.Systems;
45
using Content.Server.DoAfter;
56
using Content.Server.EUI;
67
using Content.Server.Ghost;
8+
using Content.Server.Hands.Systems;
79
using Content.Server.Interaction;
810
using Content.Server.Mind;
911
using Content.Server.Popups;
@@ -17,6 +19,7 @@
1719
using Content.Shared.DoAfter;
1820
using Content.Shared.DragDrop;
1921
using Content.Shared.Examine;
22+
using Content.Shared.FixedPoint;
2023
using Content.Shared.GameTicking;
2124
using Content.Shared.Hands.Components;
2225
using Content.Shared.Interaction.Events;
@@ -61,6 +64,7 @@ public sealed partial class CryoSleepSystem : EntitySystem
6164
[Dependency] private readonly IGameTiming _timing = default!;
6265
[Dependency] private readonly IPlayerManager _player = default!;
6366
[Dependency] private readonly InventorySystem _inventory = default!; //For cryosleep warnings
67+
[Dependency] private readonly HandsSystem _hands = default!;
6468

6569
private readonly Dictionary<NetUserId, StoredBody?> _storedBodies = new();
6670
private EntityUid? _storageMap;
@@ -292,39 +296,54 @@ public bool IsBodyInCryoPod(EntityUid body, Entity<CryoSleepComponent?> cryopod)
292296
}
293297

294298
/// <summary>
295-
/// Scans the inventory of an entity about to cryo in order to contrusct a warning message of all appropriate items.
299+
/// Scans the inventory of an entity about to cryo in order to construct a warning message of all appropriate items.
296300
/// </summary>
297301
/// <returns>A warning message to be used with CryoSleepEui</returns>
298302
private CryoSleepWarningMessage? GetWarningMessages(EntityUid entity)
299303
{
300304
if (!TryComp<InventoryComponent>(entity, out var inventoryComp))
301305
return null;
302306
//Items check
303-
SlotDefinition[] slotsToCheck = inventoryComp.Slots;
307+
var slotsToCheck = inventoryComp.Slots;
304308
List<WarningItem> warningItemsList = [];
305309
//Doing the conversion to WarningItem all at once makes more sense to me
306-
List<StorageHelper.FoundItem> unconvertedFoundItem = [];
310+
List<StorageHelper.FoundItem> unconvertedFoundItems = [];
307311
foreach (var slotDefinition in slotsToCheck)
308312
{
309313
//The ID is manually checked for a shuttle deed later, and since your PDA *technically* has an uplink in it, this has to be skipped manually.
310314
if (slotDefinition.Name == "id")
311315
continue;
312-
//TODO: Check hand slots for important items
313316
if (_inventory.TryGetSlotEntity(entity, slotDefinition.Name, out var slotItem))
314317
{
315318
if (ShouldItemWarnOnCryo(slotItem.Value))
316-
warningItemsList.Add(new WarningItem(slotDefinition.Name, null, slotItem.Value));
319+
warningItemsList.Add(new WarningItem(slotDefinition.Name, null, null, slotItem.Value));
317320
else if (_entityManager.HasComponent<StorageComponent>(slotItem.Value))
318-
StorageHelper.ScanStorageForCondition(slotItem.Value, ShouldItemWarnOnCryo, ref unconvertedFoundItem);
321+
StorageHelper.ScanStorageForCondition(slotItem.Value, ShouldItemWarnOnCryo, ref unconvertedFoundItems);
319322
}
320323
}
324+
//Check hands (Thank you Alkheemist for the original form of this code)
325+
if (TryComp<HandsComponent>(entity, out var handsComp))
326+
{
327+
foreach (var hand in handsComp.Hands)
328+
{
329+
if (!_hands.TryGetHeldItem(entity, hand.Key, out var heldEntity))
330+
continue;
331+
332+
if (ShouldItemWarnOnCryo(heldEntity.Value))
333+
warningItemsList.Add(new WarningItem(null, null, hand.Key, heldEntity.Value));
334+
else if (_entityManager.HasComponent<StorageComponent>(heldEntity))
335+
StorageHelper.ScanStorageForCondition(heldEntity.Value, ShouldItemWarnOnCryo, ref unconvertedFoundItems);
336+
}
337+
}
338+
321339
//Convert all FoundItem to a WarningItem
322-
foreach (var found in unconvertedFoundItem)
340+
foreach (var found in unconvertedFoundItems)
323341
{
324-
warningItemsList.Add(new WarningItem(null, found.Container, found.Item));
342+
warningItemsList.Add(new WarningItem(null, found.Container, null, found.Item));
325343
}
326344
//Now, we extract the uplinks and shuttle deeds.
327345
WarningItem? uplink = null;
346+
FixedPoint2 currencyAmount = 0;
328347
WarningItem? backpackShuttleDeed = null;
329348
//Listing every point where a shuttle deed was found runs you out of space very fast.
330349
var foundMoreShuttles = false;
@@ -344,10 +363,13 @@ public bool IsBodyInCryoPod(EntityUid body, Entity<CryoSleepComponent?> cryopod)
344363

345364
warningItemsList.RemoveAt(i);
346365
}
347-
else if (HasComp<StoreComponent>(itemStruct.Item) && !uplink.HasValue)
366+
else if (TryComp<StoreComponent>(itemStruct.Item, out var uplinkComp) && !uplink.HasValue)
348367
{
349368
uplink = itemStruct;
350369
warningItemsList.RemoveAt(i);
370+
var currencyProtoId = uplinkComp.Balance.Keys.First();
371+
currencyAmount = uplinkComp.Balance[currencyProtoId];
372+
351373
}
352374
}
353375

@@ -361,6 +383,7 @@ public bool IsBodyInCryoPod(EntityUid body, Entity<CryoSleepComponent?> cryopod)
361383
nwBackpackShuttleDeed,
362384
foundMoreShuttles,
363385
nwUplink,
386+
currencyAmount,
364387
networkedWarningItems);
365388
}
366389

@@ -387,18 +410,20 @@ private bool TryGetIdCard(EntityUid ent, [NotNullWhen(true)] out EntityUid? idCa
387410
return false;
388411
}
389412

390-
private readonly struct WarningItem(string? slotId, EntityUid? container, EntityUid item)
413+
private readonly struct WarningItem(string? slotId, EntityUid? container, string? handId, EntityUid item)
391414
{
392-
//Exactly one of these two values should be null
415+
//Exactly one of these three values should not be null
393416
public readonly string? SlotId = slotId;
394417
public readonly EntityUid? Container = container;
418+
public readonly string? HandId = handId;
395419

396420
public readonly EntityUid Item = item;
397421

398422
public CryoSleepWarningMessage.NetworkedWarningItem ToNetworked(IEntityManager manager)
399423
{
400424
return new CryoSleepWarningMessage.NetworkedWarningItem(SlotId,
401425
manager.GetNetEntity(Container),
426+
HandId,
402427
manager.GetNetEntity(Item));
403428
}
404429
}

Content.Shared/Atmos/Rotting/SharedRottingSystem.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public override void Initialize()
2525
SubscribeLocalEvent<PerishableComponent, MobStateChangedEvent>(OnMobStateChanged);
2626
SubscribeLocalEvent<PerishableComponent, ExaminedEvent>(OnPerishableExamined);
2727

28-
SubscribeLocalEvent<RottingComponent, ComponentShutdown>(OnShutdown);
2928
SubscribeLocalEvent<RottingComponent, MobStateChangedEvent>(OnRottingMobStateChanged);
3029
SubscribeLocalEvent<RottingComponent, RejuvenateEvent>(OnRejuvenate);
3130
SubscribeLocalEvent<RottingComponent, ExaminedEvent>(OnExamined);
@@ -62,14 +61,6 @@ private void OnPerishableExamined(Entity<PerishableComponent> perishable, ref Ex
6261
args.PushMarkup(Loc.GetString(description, ("target", Identity.Entity(perishable, EntityManager))));
6362
}
6463

65-
private void OnShutdown(EntityUid uid, RottingComponent component, ComponentShutdown args)
66-
{
67-
if (TryComp<PerishableComponent>(uid, out var perishable))
68-
{
69-
perishable.RotNextUpdate = TimeSpan.Zero;
70-
}
71-
}
72-
7364
private void OnRottingMobStateChanged(EntityUid uid, RottingComponent component, MobStateChangedEvent args)
7465
{
7566
if (args.NewMobState == MobState.Dead)
@@ -123,11 +114,16 @@ public bool IsRotProgressing(EntityUid uid, PerishableComponent? perishable)
123114
if (TryComp<MobStateComponent>(uid, out var mobState) && !_mobState.IsDead(uid, mobState))
124115
return false;
125116

126-
if (_container.TryGetOuterContainer(uid, Transform(uid), out var container) &&
127-
HasComp<AntiRottingContainerComponent>(container.Owner))
117+
// Frontier: prevent rot if *any* container has AntiRottingContainer
118+
//if (_container.TryGetOuterContainer(uid, Transform(uid), out var container) &&
119+
// HasComp<AntiRottingContainerComponent>(container.Owner))
120+
// return false;
121+
foreach (var container in _container.GetContainingContainers(uid))
128122
{
129-
return false;
123+
if (HasComp<AntiRottingContainerComponent>(container.Owner))
124+
return false;
130125
}
126+
// End Frontier
131127

132128
var ev = new IsRottingEvent();
133129
RaiseLocalEvent(uid, ref ev);

Content.Shared/Execution/SharedExecutionSystem.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ private void OnGetInteractionsVerbs(EntityUid uid, ExecutionComponent comp, GetV
5353
var weapon = args.Using.Value;
5454
var victim = args.Target;
5555

56+
// Frontier: remove self execute
57+
if (attacker == victim)
58+
{
59+
return;
60+
}
61+
// End Frontier
62+
5663
if (!CanBeExecuted(victim, attacker))
5764
return;
5865

Content.Shared/_NF/CryoSleep/CryoSleepWarningMessage.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
11
using Content.Shared.Eui;
2+
using Content.Shared.FixedPoint;
23
using Robust.Shared.Serialization;
34

45
namespace Content.Shared._NF.CryoSleep;
56

67
/// <summary>
78
/// A message for CryoSleepEui containing all the items the server found, along with some other data to build the clientside warning messages.
89
/// </summary>
9-
[Serializable] [NetSerializable]
10+
[Serializable, NetSerializable]
1011
public sealed class CryoSleepWarningMessage(
1112
bool shuttleOnPda,
1213
CryoSleepWarningMessage.NetworkedWarningItem? inventoryShuttleDeed,
1314
bool foundMoreShuttles,
1415
CryoSleepWarningMessage.NetworkedWarningItem? foundUplink,
16+
FixedPoint2 uplinkBalance,
1517
List<CryoSleepWarningMessage.NetworkedWarningItem> importantItems)
1618
: EuiMessageBase
1719
{
1820
public readonly bool ShuttleOnPDA = shuttleOnPda;
1921
public readonly NetworkedWarningItem? InventoryShuttleDeed = inventoryShuttleDeed;
2022
public readonly bool FoundMoreShuttles = foundMoreShuttles;
2123
public readonly NetworkedWarningItem? FoundUplink = foundUplink;
24+
public readonly FixedPoint2 UplinkBalance = uplinkBalance;
2225
public readonly List<NetworkedWarningItem> ImportantItems = importantItems;
2326

24-
[Serializable] [NetSerializable]
27+
28+
[Serializable, NetSerializable]
2529
public struct NetworkedWarningItem
2630
{
27-
public NetworkedWarningItem(string? slotId, NetEntity? container, NetEntity item)
31+
public NetworkedWarningItem(string? slotId, NetEntity? container, string? handId, NetEntity item)
2832
{
29-
if (slotId == null && !container.HasValue)
33+
if (slotId is null && !container.HasValue && handId is null)
3034
{
3135
throw new ArgumentException(
32-
"CryoSleepWarningMessage.NetworkedWarningItem was attempted to be created with both slotId and container as null values");
36+
"CryoSleepWarningMessage.NetworkedWarningItem was attempted to be created with all values as null values");
3337
}
3438

3539
SlotId = slotId;
40+
HandId = handId;
3641
Container = container;
3742
Item = item;
38-
}
39-
//Exactly one of these two values should be null
43+
}
44+
//Exactly one of these values should not be null
4045
public readonly string? SlotId;
4146
public readonly NetEntity? Container;
47+
public readonly string? HandId;
4248

4349
public readonly NetEntity Item;
4450
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Content.Shared._NF.Whitelist.Components;
2+
3+
/// <summary>
4+
/// Whitelist component for plushies to avoid tag redefinition and collisions
5+
/// </summary>
6+
[RegisterComponent]
7+
public sealed partial class NFPlushieComponent : Component;
26.2 MB
Binary file not shown.

0 commit comments

Comments
 (0)