Skip to content

Commit

Permalink
Merge branch 'master' into ramen
Browse files Browse the repository at this point in the history
  • Loading branch information
dustylens authored Dec 26, 2024
2 parents 8276b29 + cb65141 commit c676bd1
Show file tree
Hide file tree
Showing 136 changed files with 11,921 additions and 1,257 deletions.
30 changes: 17 additions & 13 deletions Content.Client/IconSmoothing/IconSmoothSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,25 @@ public void SetStateBase(EntityUid uid, IconSmoothComponent component, string ne

private void SetCornerLayers(SpriteComponent sprite, IconSmoothComponent component)
{
sprite.LayerMapRemove(CornerLayers.SE);
sprite.LayerMapRemove(CornerLayers.NE);
sprite.LayerMapRemove(CornerLayers.NW);
sprite.LayerMapRemove(CornerLayers.SW);

// Frontier: Allow overlays on entities using CornerLayers smoothing - don't remove layers, adjust existing ones or create new ones.
var state0 = $"{component.StateBase}0";
sprite.LayerMapSet(CornerLayers.SE, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.SE, DirectionOffset.None);
sprite.LayerMapSet(CornerLayers.NE, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.NE, DirectionOffset.CounterClockwise);
sprite.LayerMapSet(CornerLayers.NW, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.NW, DirectionOffset.Flip);
sprite.LayerMapSet(CornerLayers.SW, sprite.AddLayerState(state0));
sprite.LayerSetDirOffset(CornerLayers.SW, DirectionOffset.Clockwise);
SetCornerLayerState(sprite, CornerLayers.SE, DirectionOffset.None, state0);
SetCornerLayerState(sprite, CornerLayers.NE, DirectionOffset.CounterClockwise, state0);
SetCornerLayerState(sprite, CornerLayers.NW, DirectionOffset.Flip, state0);
SetCornerLayerState(sprite, CornerLayers.SW, DirectionOffset.Clockwise, state0);
// End Frontier: Allow overlays on entities using CornerLayers smoothing - don't remove layers, adjust existing ones or create new ones.
}

// Frontier: set layer function to remove redundancy
private void SetCornerLayerState(SpriteComponent sprite, CornerLayers corner, DirectionOffset offset, string state)
{
if (sprite.LayerMapTryGet(corner, out var layer))
sprite.LayerSetState(layer, state);
else
sprite.LayerMapSet(corner, sprite.AddLayerState(state));
sprite.LayerSetDirOffset(corner, offset);
}
// End Frontier: set layer function to remove redundancy

private void OnShutdown(EntityUid uid, IconSmoothComponent component, ComponentShutdown args)
{
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
8 changes: 4 additions & 4 deletions Content.Server/AlertLevel/AlertLevelSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ public void SetLevel(EntityUid station, string level, bool playSound, bool annou
return;
// End Frontier

if (!Resolve(station, ref dataComponent) // Frontier: remove component
|| component.AlertLevels == null
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 @@ -196,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 Down Expand Up @@ -232,8 +231,9 @@ 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);
}
Expand Down
16 changes: 16 additions & 0 deletions Content.Server/Gatherable/GatherableSystem.Projectile.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Gatherable.Components;
using Content.Shared.Mining.Components;
using Content.Shared.Projectiles;
using Robust.Shared.Physics.Events;

Expand All @@ -21,6 +22,21 @@ private void OnProjectileCollide(Entity<GatheringProjectileComponent> gathering,
return;
}

// Frontier: gathering changes
// bad gatherer - not strong enough
if (_whitelistSystem.IsWhitelistFail(gatherable.ToolWhitelist, gathering.Owner))
{
QueueDel(gathering);
return;
}
// Too strong (e.g. overpen) - gathers ore but destroys it
if (TryComp<OreVeinComponent>(args.OtherEntity, out var oreVein)
&& _whitelistSystem.IsWhitelistPass(oreVein.GatherDestructionWhitelist, gathering.Owner))
{
oreVein.PreventSpawning = true;
}
// End Frontier: gathering changes

Gather(args.OtherEntity, gathering, gatherable);
gathering.Comp.Amount--;

Expand Down
19 changes: 19 additions & 0 deletions Content.Server/Light/EntitySystems/EmergencyLightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public override void Initialize()
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
SubscribeLocalEvent<EmergencyLightComponent, ExaminedEvent>(OnEmergencyExamine);
SubscribeLocalEvent<EmergencyLightComponent, PowerChangedEvent>(OnEmergencyPower);

SubscribeLocalEvent<EmergencyLightComponent, MapInitEvent>(OnMapInit); // Frontier
}

private void OnEmergencyPower(Entity<EmergencyLightComponent> entity, ref PowerChangedEvent args)
Expand Down Expand Up @@ -245,4 +247,21 @@ private void TurnOn(Entity<EmergencyLightComponent> entity, Color color)
_appearance.SetData(entity.Owner, EmergencyLightVisuals.On, true);
_ambient.SetAmbience(entity.Owner, true);
}

// Frontier: ensure the lights are accurate to the station
private void OnMapInit(Entity<EmergencyLightComponent> entity, ref MapInitEvent ev)
{
if (!TryComp<AlertLevelComponent>(_sectorService.GetServiceEntity(), out var alert))
return;

if (alert.AlertLevels == null || !alert.AlertLevels.Levels.TryGetValue(alert.CurrentLevel, out var details))
return;

entity.Comp.ForciblyEnabled = details.ForceEnableEmergencyLights;
if (details.ForceEnableEmergencyLights)
TurnOn(entity, details.EmergencyLightColor);
else
TurnOff(entity, details.EmergencyLightColor);
}
// End Frontier
}
5 changes: 5 additions & 0 deletions Content.Server/Mining/MiningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ private void OnDestruction(EntityUid uid, OreVeinComponent component, Destructio
if (component.CurrentOre == null)
return;

// Frontier
if (component.PreventSpawning)
return;
// End Frontier

var proto = _proto.Index<OrePrototype>(component.CurrentOre);

if (proto.OreEntity == null)
Expand Down
41 changes: 41 additions & 0 deletions Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
using Robust.Server.GameObjects; // Nuclear-14
using Robust.Shared.Prototypes;
using Content.Shared.Access.Systems; // Frontier
using Content.Shared.Verbs; //Frontier
using Robust.Shared.Utility; //Frontier

namespace Content.Server.Radio.EntitySystems;

Expand Down Expand Up @@ -51,6 +53,7 @@ public override void Initialize()
SubscribeLocalEvent<RadioMicrophoneComponent, ListenEvent>(OnListen);
SubscribeLocalEvent<RadioMicrophoneComponent, ListenAttemptEvent>(OnAttemptListen);
SubscribeLocalEvent<RadioMicrophoneComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<RadioMicrophoneComponent, GetVerbsEvent<AlternativeVerb>>(OnGetAltVerbs); // Frontier

SubscribeLocalEvent<RadioSpeakerComponent, ComponentInit>(OnSpeakerInit);
SubscribeLocalEvent<RadioSpeakerComponent, ActivateInWorldEvent>(OnActivateSpeaker);
Expand Down Expand Up @@ -366,6 +369,44 @@ private void UpdateHandheldRadioUi(Entity<RadioMicrophoneComponent> radio)
#endregion
// Nuclear-14-End

// Frontier Start
/// <summary>
/// Adds an alt verb allowing for the mic to be toggled easily.
/// </summary>
private void OnGetAltVerbs(EntityUid uid, RadioMicrophoneComponent microphone, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanInteract || !args.CanAccess)
return;

AlternativeVerb verb = new()
{
Text = Loc.GetString("handheld-radio-component-toggle"),
Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/settings.svg.192dpi.png")),
Act = () => ToggleRadioOrIntercomMic(uid, microphone, args.User)
};
args.Verbs.Add(verb);
}

/// <summary>
/// A mic toggle for both radios and intercoms.
/// </summary>
private void ToggleRadioOrIntercomMic(EntityUid uid, RadioMicrophoneComponent microphone, EntityUid user)
{
if (!_access.IsAllowed(user, uid))
return;
if (microphone.PowerRequired && !this.IsPowered(uid, EntityManager))
return;

ToggleRadioMicrophone(uid, user, false, microphone);
if (TryComp<IntercomComponent>(uid, out var intercom))
{
intercom.MicrophoneEnabled = microphone.Enabled;
Dirty<IntercomComponent>((uid, intercom));
}
}
// Frontier End


// Frontier: init intercom with map
private void OnMapInit(EntityUid uid, IntercomComponent ent, MapInitEvent args)
{
Expand Down
1 change: 0 additions & 1 deletion Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Content.Server.Radio.EntitySystems;
using Content.Server._NF.Bank;
using Content.Server.Shipyard.Components;
using Content.Shared._NF.GameRule;
using Content.Shared.Bank.Components;
using Content.Shared.Shipyard.Events;
using Content.Shared.Shipyard.BUI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using Content.Shared.Procedural;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;

namespace Content.Server._NF.GameRule.Components;

[RegisterComponent, Access(typeof(NfAdventureRuleSystem))]
public sealed partial class AdventureRuleComponent : Component
[RegisterComponent, Access(typeof(NFAdventureRuleSystem))]
public sealed partial class NFAdventureRuleComponent : Component
{
public List<EntityUid> NFPlayerMinds = new();
public List<EntityUid> CargoDepots = new();
Expand Down
Loading

0 comments on commit c676bd1

Please sign in to comment.