Skip to content

Commit

Permalink
Merge branch 'master' into Blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
blackknight954 authored Dec 24, 2024
2 parents 4af0b99 + 67e2b52 commit aec6a3e
Show file tree
Hide file tree
Showing 423 changed files with 17,324 additions and 8,520 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ concurrency:
on:
workflow_dispatch:
# Frontier: re-enabled autopublish
schedule:
schedule:
- cron: '0 10 * * *'

jobs:
Expand Down
4 changes: 2 additions & 2 deletions Content.IntegrationTests/PoolSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable

using Robust.Shared.Random;

Expand Down Expand Up @@ -93,7 +93,7 @@ public sealed class PoolSettings
/// <summary>
/// Frontier: the preset to run the game in.
/// Set to secret for upstream tests to mimic upstream behaviour.
/// If you need to check adventure game rule things, set this to Adventure.
/// If you need to check adventure game rule things, set this to nfadventure or nfpirate.
/// </summary>
public string GameLobbyDefaultPreset { get; set; } = "secret";

Expand Down
3 changes: 2 additions & 1 deletion Content.IntegrationTests/Tests/EntityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ public async Task AllComponentsOneToOneDeleteTest()
"DebrisFeaturePlacerController", // Above.
"LoadedChunk", // Worldgen chunk loading malding.
"BiomeSelection", // Whaddya know, requires config.
"ActivatableUI", // Requires enum key
"ActivatableUI", // Frontier: Requires enum key
"AlertLevel", // Frontier: requires alert set
};

// TODO TESTS
Expand Down
7 changes: 5 additions & 2 deletions Content.Server/AlertLevel/AlertLevelDisplaySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
using Content.Server.Station.Systems;
using Content.Shared.AlertLevel;
using Content.Shared.Power;
using Content.Server._NF.SectorServices; // Frontier

namespace Content.Server.AlertLevel;

public sealed class AlertLevelDisplaySystem : EntitySystem
{
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SectorServiceSystem _sectorService = default!; // Frontier

public override void Initialize()
{
Expand All @@ -30,8 +32,9 @@ private void OnDisplayInit(EntityUid uid, AlertLevelDisplayComponent alertLevelD
{
if (TryComp(uid, out AppearanceComponent? appearance))
{
var stationUid = _stationSystem.GetOwningStation(uid);
if (stationUid != null && TryComp(stationUid, out AlertLevelComponent? alert))
//var stationUid = _stationSystem.GetOwningStation(uid); // Frontier: sector-wide alerts
var stationUid = _sectorService.GetServiceEntity(); // Frontier: sector-wide alerts
if (stationUid.Valid && TryComp(stationUid, out AlertLevelComponent? alert)) // Frontier: uid != null < uid.Valid
{
_appearance.SetData(uid, AlertLevelDisplay.CurrentLevel, alert.CurrentLevel, appearance);
}
Expand Down
72 changes: 59 additions & 13 deletions Content.Server/AlertLevel/AlertLevelSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Content.Server.GameTicking; // Frontier
using Robust.Shared.Player; // Frontier
using Content.Server._NF.SectorServices; // Frontier

namespace Content.Server.AlertLevel;

Expand All @@ -16,13 +19,16 @@ public sealed class AlertLevelSystem : EntitySystem
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly GameTicker _ticker = default!; // Frontier
[Dependency] private readonly SectorServiceSystem _sectorService = default!;

// Until stations are a prototype, this is how it's going to have to be.
public const string DefaultAlertLevelSet = "stationAlerts";

public override void Initialize()
{
SubscribeLocalEvent<StationInitializedEvent>(OnStationInitialize);
//SubscribeLocalEvent<StationInitializedEvent>(OnStationInitialize); // Frontier: sector-wide services
SubscribeLocalEvent<AlertLevelComponent, ComponentInit>(OnInit); // Frontier: sector-wide services
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypeReload);
}

Expand All @@ -46,6 +52,8 @@ public override void Update(float time)
}
}

// Frontier: sector-wide services
/*
private void OnStationInitialize(StationInitializedEvent args)
{
if (!TryComp<AlertLevelComponent>(args.Station, out var alertLevelComponent))
Expand All @@ -66,6 +74,26 @@ private void OnStationInitialize(StationInitializedEvent args)
SetLevel(args.Station, defaultLevel, false, false, true);
}
*/

private void OnInit(EntityUid uid, AlertLevelComponent comp, ComponentInit args)
{
if (!_prototypeManager.TryIndex(comp.AlertLevelPrototype, out AlertLevelPrototype? alerts))
{
return;
}

comp.AlertLevels = alerts;

var defaultLevel = comp.AlertLevels.DefaultLevel;
if (string.IsNullOrEmpty(defaultLevel))
{
defaultLevel = comp.AlertLevels.Levels.Keys.First();
}

SetLevel(uid, defaultLevel, false, false, true);
}
// End Frontier

private void OnPrototypeReload(PrototypesReloadedEventArgs args)
{
Expand Down Expand Up @@ -98,20 +126,30 @@ private void OnPrototypeReload(PrototypesReloadedEventArgs args)

public string GetLevel(EntityUid station, AlertLevelComponent? alert = null)
{
if (!Resolve(station, ref alert))
{
// Frontier: sector-wide alarms
if (!TryComp(_sectorService.GetServiceEntity(), out alert))
return string.Empty;
}

// if (!Resolve(station, ref alert))
// {
// return string.Empty;
// }
// End Frontier

return alert.CurrentLevel;
}

public float GetAlertLevelDelay(EntityUid station, AlertLevelComponent? alert = null)
{
if (!Resolve(station, ref alert))
{
// Frontier: sector-wide alarms
if (!TryComp(_sectorService.GetServiceEntity(), out alert))
return float.NaN;
}

// if (!Resolve(station, ref alert))
// {
// return float.NaN;
// }
// End Frontier

return alert.CurrentDelay;
}
Expand All @@ -128,8 +166,13 @@ public float GetAlertLevelDelay(EntityUid station, AlertLevelComponent? alert =
public void SetLevel(EntityUid station, string level, bool playSound, bool announce, bool force = false,
bool locked = false, MetaDataComponent? dataComponent = null, AlertLevelComponent? component = null)
{
if (!Resolve(station, ref component, ref dataComponent)
|| component.AlertLevels == null
// Frontier: sector-wide alerts
EntityUid sectorEnt = _sectorService.GetServiceEntity();
if (!TryComp<AlertLevelComponent>(sectorEnt, out component))
return;
// End Frontier

if (component.AlertLevels == null // Frontier: remove component, resolve station to data component later
|| !component.AlertLevels.Levels.TryGetValue(level, out var detail)
|| component.CurrentLevel == level)
{
Expand All @@ -152,7 +195,7 @@ public void SetLevel(EntityUid station, string level, bool playSound, bool annou
component.CurrentLevel = level;
component.IsLevelLocked = locked;

var stationName = dataComponent.EntityName;
//var stationName = dataComponent.EntityName; // Frontier: remove station name

var name = level.ToLower();

Expand All @@ -177,7 +220,9 @@ public void SetLevel(EntityUid station, string level, bool playSound, bool annou
{
if (detail.Sound != null)
{
var filter = _stationSystem.GetInOwningStation(station);
//var filter = _stationSystem.GetInOwningStation(station); // Frontier: global alerts
var filter = Filter.Empty(); // Frontier
filter.AddInMap(_ticker.DefaultMap, EntityManager); // Frontier
_audio.PlayGlobal(detail.Sound, filter, true, detail.Sound.Params);
}
else
Expand All @@ -186,13 +231,14 @@ public void SetLevel(EntityUid station, string level, bool playSound, bool annou
}
}

if (announce)
if (announce && Resolve(station, ref dataComponent)) // Frontier: add Resolve for dataComponent
{
var stationName = dataComponent.EntityName; // Frontier: moved down
_chatSystem.DispatchStationAnnouncement(station, announcementFull, playDefaultSound: playDefault,
colorOverride: detail.Color, sender: stationName);
}

RaiseLocalEvent(new AlertLevelChangedEvent(station, level));
RaiseLocalEvent(new AlertLevelChangedEvent(EntityUid.Invalid, level)); // Frontier: pass invalid, we have no station
}
}

Expand Down
23 changes: 15 additions & 8 deletions Content.Server/AlertLevel/Commands/SetAlertLevelCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Content.Server._NF.SectorServices;
using Content.Server.Administration;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
Expand All @@ -21,11 +22,14 @@ public override CompletionResult GetCompletion(IConsoleShell shell, string[] arg
var player = shell.Player;
if (player?.AttachedEntity != null)
{
var stationUid = _entitySystems.GetEntitySystem<StationSystem>().GetOwningStation(player.AttachedEntity.Value);
if (stationUid != null)
{
levelNames = GetStationLevelNames(stationUid.Value);
}
// Frontier: sector-wide alerts
levelNames = GetSectorLevelNames();
// var stationUid = _entitySystems.GetEntitySystem<StationSystem>().GetOwningStation(player.AttachedEntity.Value);
// if (stationUid != null)
// {
// levelNames = GetStationLevelNames(stationUid.Value);
// }
// End Frontier
}

return args.Length switch
Expand Down Expand Up @@ -68,7 +72,7 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args)
}

var level = args[0];
var levelNames = GetStationLevelNames(stationUid.Value);
var levelNames = GetSectorLevelNames();
if (!levelNames.Contains(level))
{
shell.WriteLine(LocalizationManager.GetString("cmd-setalertlevel-invalid-level"));
Expand All @@ -78,16 +82,19 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args)
_entitySystems.GetEntitySystem<AlertLevelSystem>().SetLevel(stationUid.Value, level, true, true, true, locked);
}

private string[] GetStationLevelNames(EntityUid station)
// Frontier: sector-wide alert level names
private string[] GetSectorLevelNames()
{
var sectorServiceUid = _entitySystems.GetEntitySystem<SectorServiceSystem>().GetServiceEntity();
var entityManager = IoCManager.Resolve<IEntityManager>();
if (!entityManager.TryGetComponent<AlertLevelComponent>(station, out var alertLevelComp))
if (!entityManager.TryGetComponent<AlertLevelComponent>(sectorServiceUid, out var alertLevelComp))
return new string[]{};

if (alertLevelComp.AlertLevels == null)
return new string[]{};

return alertLevelComp.AlertLevels.Levels.Keys.ToArray();
}
// End Frontier
}
}
4 changes: 4 additions & 0 deletions Content.Server/Botany/Systems/BotanySystem.Seed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Robust.Shared.Random;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server._NF.Contraband.Systems; // Frontier

namespace Content.Server.Botany.Systems;

Expand All @@ -30,6 +31,7 @@ public sealed partial class BotanySystem : EntitySystem
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Dependency] private readonly RandomHelperSystem _randomHelper = default!;
[Dependency] private readonly ContrabandTurnInSystem _contraband = default!; // Frontier

public override void Initialize()
{
Expand Down Expand Up @@ -101,6 +103,7 @@ private void OnExamined(EntityUid uid, SeedComponent component, ExaminedEvent ar
public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user, float? healthOverride = null)
{
var seed = SpawnAtPosition(proto.PacketPrototype, coords); // Frontier: Spawn<SpawnAtPosition
_contraband.ClearContrabandValue(seed); // Frontier
var seedComp = EnsureComp<SeedComponent>(seed);
seedComp.Seed = proto;
seedComp.HealthOverride = healthOverride;
Expand Down Expand Up @@ -160,6 +163,7 @@ public IEnumerable<EntityUid> GenerateProduct(SeedData proto, EntityCoordinates
var product = _robustRandom.Pick(proto.ProductPrototypes);

var entity = SpawnAtPosition(product, position); // Frontier: Spawn<SpawnAtPosition
_contraband.ClearContrabandValue(entity); // Frontier
_randomHelper.RandomOffset(entity, 0.25f);
products.Add(entity);

Expand Down
28 changes: 28 additions & 0 deletions Content.Server/Chemistry/Components/ReagentDispenserComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Content.Shared.Chemistry.Dispenser;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Prototypes; // Frontier
using Content.Shared.Construction.Prototypes; // Frontier

namespace Content.Server.Chemistry.Components
{
Expand Down Expand Up @@ -61,5 +63,31 @@ public sealed partial class ReagentDispenserComponent : Component

[ViewVariables(VVAccess.ReadWrite)]
public ReagentDispenserDispenseAmount DispenseAmount = ReagentDispenserDispenseAmount.U10;

// Frontier: whether or not this entity can auto-label items
[DataField]
public bool CanAutoLabel;

// Frontier: whether or not this entity is currently auto-labeling items
[ViewVariables]
public bool AutoLabel;

/// <summary>
/// Frontier: the number of storage slots a machine with base parts should have.
/// </summary>
[DataField]
public int BaseNumStorageSlots = 25;

/// <summary>
/// Frontier: the number of extra slots a machine gets per tier of upgrades.
/// </summary>
[DataField]
public int ExtraSlotsPerTier = 5;

/// <summary>
/// Frontier: the machine part type that upgrades the number of slots in the machine.
/// </summary>
[DataField]
public ProtoId<MachinePartPrototype> SlotUpgradeMachinePart = "MatterBin";
}
}
Loading

0 comments on commit aec6a3e

Please sign in to comment.