Skip to content

Commit

Permalink
Merge branch '2024-04-03-Punk-Stuff' of https://github.com/ErhardStei…
Browse files Browse the repository at this point in the history
…nhauer/frontier-station-14 into 2024-04-03-Punk-Stuff
  • Loading branch information
ErhardSteinhauer committed May 21, 2024
2 parents 2d98e4e + b98d6bd commit cb61efa
Show file tree
Hide file tree
Showing 107 changed files with 2,697 additions and 996 deletions.
2 changes: 0 additions & 2 deletions Content.Client/Administration/AdminNameOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,12 @@ protected override void Draw(in OverlayDrawArgs args)
var screenCoordinates = _eyeManager.WorldToScreen(aabb.Center +
new Angle(-_eyeManager.CurrentEye.Rotation).RotateVec(
aabb.TopRight - aabb.Center)) + new Vector2(1f, 7f);
var balance_str = playerInfo.Balance == int.MinValue ? "NO BALANCE" : playerInfo.Balance.ToString(); // Frontier
if (playerInfo.Antag)
{
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", Color.OrangeRed);
}
args.ScreenHandle.DrawString(_font, screenCoordinates+lineoffset, playerInfo.Username, playerInfo.Connected ? Color.Yellow : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, playerInfo.Connected ? Color.Aquamarine : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates + 3 * lineoffset, $"balance: {balance_str}", playerInfo.Connected ? Color.Aquamarine : Color.White);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
player.Antag ? "YES" : "NO",
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
player.Connected,
player.PlaytimeString, // Frontier
player.Balance == int.MinValue ? "NO BALANCE" : player.Balance.ToString()); // Frontier
player.PlaytimeString);
entry.PlayerEntity = player.NetEntity;
entry.OnKeyBindDown += args => OnEntryKeyBindDown?.Invoke(entry, args);
entry.ToolTip = Loc.GetString("player-tab-entry-tooltip");
Expand Down Expand Up @@ -152,9 +151,8 @@ private int Compare(PlayerInfo x, PlayerInfo y)
Header.Job => Compare(x.StartingJob, y.StartingJob),
Header.Antagonist => x.Antag.CompareTo(y.Antag),
Header.Playtime => TimeSpan.Compare(x.OverallPlaytime ?? default, y.OverallPlaytime ?? default),
Header.Balance => x.Balance.CompareTo(y.Balance), // Frontier
_ => 1
}; ;
};
}

private int Compare(string x, string y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,5 @@
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<Label Name="BalanceLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
</BoxContainer>
</ContainerButton>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Client.AutoGenerated;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
Expand All @@ -10,7 +10,7 @@ public sealed partial class PlayerTabEntry : ContainerButton
{
public NetEntity? PlayerEntity;

public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected, string overallPlaytime, string balance) // Frontier - Add int balance
public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected, string overallPlaytime)
{
RobustXamlLoader.Load(this);

Expand All @@ -24,6 +24,5 @@ public PlayerTabEntry(string username, string character, string identity, string
AntagonistLabel.Text = antagonist;
BackgroundColorPanel.PanelOverride = styleBox;
OverallPlaytimeLabel.Text = overallPlaytime;
BalanceLabel.Text = balance.ToString(); // Frontier
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Control xmlns="https://spacestation14.io"
<Control xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls">
<PanelContainer Name="BackgroundColorPanel" Access="Public"/>
<BoxContainer Orientation="Horizontal"
Expand Down Expand Up @@ -31,18 +31,11 @@
ClipText="True"
Text="{Loc player-tab-antagonist}"
MouseFilter="Pass"/>
<cc:VSeparator/>
<Label Name="PlaytimeLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"
Text="{Loc player-tab-playtime}"
MouseFilter="Pass"/>
<Label Name="BalanceLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"
Text="{Loc player-tab-balance}"
MouseFilter="Pass"/>
</BoxContainer>
</Control>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Client.AutoGenerated;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
Expand All @@ -20,7 +20,6 @@ public PlayerTabHeader()
JobLabel.OnKeyBindDown += JobClicked;
AntagonistLabel.OnKeyBindDown += AntagonistClicked;
PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
BalanceLabel.OnKeyBindDown += BalanceClicked; // Frontier
}

public Label GetHeader(Header header)
Expand All @@ -32,7 +31,6 @@ public Label GetHeader(Header header)
Header.Job => JobLabel,
Header.Antagonist => AntagonistLabel,
Header.Playtime => PlaytimeLabel,
Header.Balance => BalanceLabel, // Frontier
_ => throw new ArgumentOutOfRangeException(nameof(header), header, null)
};
}
Expand All @@ -44,7 +42,6 @@ public void ResetHeaderText()
JobLabel.Text = Loc.GetString("player-tab-job");
AntagonistLabel.Text = Loc.GetString("player-tab-antagonist");
PlaytimeLabel.Text = Loc.GetString("player-tab-playtime");
BalanceLabel.Text = Loc.GetString("player-tab-balance"); // Frontier
}

private void HeaderClicked(GUIBoundKeyEventArgs args, Header header)
Expand Down Expand Up @@ -83,11 +80,6 @@ private void PlaytimeClicked(GUIBoundKeyEventArgs args)
HeaderClicked(args, Header.Playtime);
}

private void BalanceClicked(GUIBoundKeyEventArgs args) // Frontier
{
HeaderClicked(args, Header.Balance);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Expand All @@ -99,7 +91,6 @@ protected override void Dispose(bool disposing)
JobLabel.OnKeyBindDown -= JobClicked;
AntagonistLabel.OnKeyBindDown -= AntagonistClicked;
PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
BalanceLabel.OnKeyBindDown -= BalanceClicked; // Frontier
}
}

Expand All @@ -109,7 +100,6 @@ public enum Header
Character,
Job,
Antagonist,
Playtime,
Balance // Frontier
Playtime
}
}
25 changes: 1 addition & 24 deletions Content.Server/Administration/Systems/AdminSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Content.Shared._NF.Bank.Events; // Frontier
using Content.Shared.Bank.Components; // Frontier
using Content.Shared.Bank.Events; // Frontier

namespace Content.Server.Administration.Systems
{
Expand Down Expand Up @@ -87,8 +84,6 @@ public override void Initialize()
SubscribeLocalEvent<RoleAddedEvent>(OnRoleEvent);
SubscribeLocalEvent<RoleRemovedEvent>(OnRoleEvent);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestartCleanup);

SubscribeLocalEvent<BalanceChangedEvent>(OnBalanceChanged); // Frontier
}

private void OnRoundRestartCleanup(RoundRestartCleanupEvent ev)
Expand Down Expand Up @@ -188,12 +183,6 @@ private void OnPlayerAttached(PlayerAttachedEvent ev)
UpdatePlayerList(ev.Player);
}

private void OnBalanceChanged(BalanceChangedEvent ev) // Frontier
{
if (ev.Amount == 0)
return;
UpdatePlayerList(ev.Session);
}
public override void Shutdown()
{
base.Shutdown();
Expand Down Expand Up @@ -221,23 +210,11 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
var name = data.UserName;
var entityName = string.Empty;
var identityName = string.Empty;
int balance = 0; // Frontier

if (session?.AttachedEntity != null)
{
entityName = EntityManager.GetComponent<MetaDataComponent>(session.AttachedEntity.Value).EntityName;
identityName = Identity.Name(session.AttachedEntity.Value, EntityManager);

// Frontier
if (EntityManager.TryGetComponent<BankAccountComponent>(session.AttachedEntity.Value, out var comp))
{
balance = comp.Balance;
}
else
{
balance = int.MinValue; // Ok
}
// Frontier
}

var antag = false;
Expand All @@ -258,7 +235,7 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
}

return new PlayerInfo(name, entityName, identityName, startingRole, antag, GetNetEntity(session?.AttachedEntity), data.UserId,
connected, _roundActivePlayers.Contains(data.UserId), overallPlaytime, balance); // Frontier - Added balance
connected, _roundActivePlayers.Contains(data.UserId), overallPlaytime);
}

private void OnPanicBunkerChanged(bool enabled)
Expand Down
47 changes: 31 additions & 16 deletions Content.Server/MassMedia/Systems/NewsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public override void Initialize()
base.Initialize();

// News writer
SubscribeLocalEvent<NewsWriterComponent, MapInitEvent>(OnMapInit);
// Frontier: News is shared across the sector. No need to create shuttle-local news caches.
// SubscribeLocalEvent<NewsWriterComponent, MapInitEvent>(OnMapInit);
// End Frontier

// New writer bui messages
Subs.BuiEvents<NewsWriterComponent>(NewsWriterUiKey.Key, subs =>
Expand Down Expand Up @@ -75,14 +77,17 @@ public override void Update(float frameTime)

#region Writer Event Handlers

private void OnMapInit(Entity<NewsWriterComponent> ent, ref MapInitEvent args)
{
var station = _station.GetOwningStation(ent);
if (!station.HasValue)
return;
// Frontier: News is shared across the sector. No need to create shuttle-local news caches.
// private void OnMapInit(Entity<NewsWriterComponent> ent, ref MapInitEvent args)
// {
// var station = _station.GetOwningStation(ent);
// if (!station.HasValue) {
// return;
// }

EnsureComp<StationNewsComponent>(station.Value);
}
// EnsureComp<StationNewsComponent>(station.Value);
// }
// End Frontier

private void OnWriteUiDeleteMessage(Entity<NewsWriterComponent> ent, ref NewsWriterDeleteMessage msg)
{
Expand Down Expand Up @@ -229,15 +234,25 @@ private void OnReaderUiReady(Entity<NewsReaderCartridgeComponent> ent, ref Cartr

private bool TryGetArticles(EntityUid uid, [NotNullWhen(true)] out List<NewsArticle>? articles)
{
if (_station.GetOwningStation(uid) is not { } station ||
!TryComp<StationNewsComponent>(station, out var stationNews))
{
articles = null;
return false;
// Frontier: Get sector-wide article set instead of set for this station.
// if (_station.GetOwningStation(uid) is not { } station ||
// !TryComp<StationNewsComponent>(station, out var stationNews))
// {
// articles = null;
// return false;
// }
// articles = stationNews.Articles;
// return true;

// Any SectorNewsComponent will have a complete article set, we ensure one exists before returning the complete set.
var query = EntityQueryEnumerator<SectorNewsComponent>();
if (query.MoveNext(out var _)) {
articles = SectorNewsComponent.Articles;
return true;
}

articles = stationNews.Articles;
return true;
articles = null;
return false;
// End Frontier
}

private void UpdateWriterUi(Entity<NewsWriterComponent> ent)
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/Worldgen/Prototypes/GCQueuePrototype.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Prototypes;

namespace Content.Server.Worldgen.Prototypes;

Expand All @@ -23,7 +23,7 @@ public sealed class GCQueuePrototype : IPrototype
/// The maximum amount of time that can be spent processing this queue.
/// </summary>
[DataField("maximumTickTime")]
public TimeSpan MaximumTickTime { get; } = TimeSpan.FromMilliseconds(5); // Frontier 1<5
public TimeSpan MaximumTickTime { get; } = TimeSpan.FromMilliseconds(1);

/// <summary>
/// The minimum depth before entities in the queue actually get processed for deletion.
Expand All @@ -38,3 +38,4 @@ public sealed class GCQueuePrototype : IPrototype
[DataField("trySkipQueue")]
public bool TrySkipQueue { get; }
}

44 changes: 3 additions & 41 deletions Content.Server/Worldgen/Systems/LocalityLoaderSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using Content.Server.Worldgen.Components;
using Content.Server.Worldgen.Components;
using Robust.Server.GameObjects;
using Content.Server._NF.Worldgen.Components.Debris; // Frontier
using Content.Shared.Humanoid; // Frontier
using Content.Shared.Mobs.Components; // Frontier
using Robust.Server.GameObjects; // Frontier
using Robust.Shared.Spawners; // Frontier

namespace Content.Server.Worldgen.Systems;

Expand All @@ -15,13 +10,6 @@ public sealed class LocalityLoaderSystem : BaseWorldSystem
{
[Dependency] private readonly TransformSystem _xformSys = default!;

private const float DebrisActiveDuration = 5*60; // Frontier - Duration to reset the despawn timer to when a debris is loaded into a player's view.

public override void Initialize() // Frontier
{
SubscribeLocalEvent<SpaceDebrisComponent, EntityTerminatingEvent>(OnDebrisDespawn);
}

/// <inheritdoc />
public override void Update(float frameTime)
{
Expand Down Expand Up @@ -57,8 +45,6 @@ public override void Update(float frameTime)
if ((_xformSys.GetWorldPosition(loaderXform) - _xformSys.GetWorldPosition(xform)).Length() > loadable.LoadingDistance)
continue;

ResetTimedDespawn(uid); // Frontier - Reset the TimedDespawnComponent's lifetime when loaded

RaiseLocalEvent(uid, new LocalStructureLoadedEvent());
RemCompDeferred<LocalityLoaderComponent>(uid);
done = true;
Expand All @@ -68,34 +54,10 @@ public override void Update(float frameTime)
}
}
}

// Frontier
private void ResetTimedDespawn(EntityUid uid)
{
if (TryComp<TimedDespawnComponent>(uid, out var timedDespawn))
{
timedDespawn.Lifetime = DebrisActiveDuration;
}
else
{
// Add TimedDespawnComponent if it does not exist
timedDespawn = AddComp<TimedDespawnComponent>(uid);
timedDespawn.Lifetime = DebrisActiveDuration;
}
}

private void OnDebrisDespawn(EntityUid entity, SpaceDebrisComponent component, EntityTerminatingEvent e)
{
var mobQuery = AllEntityQuery<HumanoidAppearanceComponent, MobStateComponent, TransformComponent>();

while (mobQuery.MoveNext(out var mob, out _, out _, out var xform))
if (xform.MapUid is not null && xform.GridUid == entity)
_xformSys.SetCoordinates(mob, new(xform.MapUid.Value, _xformSys.GetWorldPosition(xform)));
}
// Frontier
}

/// <summary>
/// An event fired on a loadable entity when a local loader enters its vicinity.
/// A directed fired on a loadable entity when a local loader enters it's vicinity.
/// </summary>
public record struct LocalStructureLoadedEvent;

Loading

0 comments on commit cb61efa

Please sign in to comment.