Skip to content

Commit

Permalink
Merge branch 'master' into Remove-Microwave-Apothecary
Browse files Browse the repository at this point in the history
  • Loading branch information
MagnusCrowe committed Sep 23, 2024
2 parents 9a352f3 + 247ab91 commit 49877b1
Show file tree
Hide file tree
Showing 485 changed files with 35,276 additions and 2,282 deletions.
5 changes: 4 additions & 1 deletion Content.Client/Administration/AdminNameOverlay.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Numerics;
using Content.Client.Administration.Systems;
using Content.Shared._NF.Bank;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Enums;
Expand Down Expand Up @@ -61,12 +62,14 @@ 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 = playerInfo.Balance == int.MinValue ? "NO BALANCE" : BankSystemExtensions.ToCurrencyString(playerInfo.Balance); // Frontier
if (playerInfo.Antag)
{
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", Color.OrangeRed);
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 3), "ANTAG", Color.OrangeRed); // Frontier: 2<3
}
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 + lineoffset * 2, $"Balance: {balance}", playerInfo.Connected ? Color.Aquamarine : Color.White); // Frontier
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public PlayerTab()
SearchList.ItemKeyBindDown += (args, data) => OnEntryKeyBindDown?.Invoke(args, data);

RefreshPlayerList(_adminSystem.PlayerList);

}

#region Antag Overlay
Expand Down Expand Up @@ -198,6 +197,7 @@ 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
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
SizeFlagsStretchRatio="1"
HorizontalExpand="True"
ClipText="True"/>
<Label Name="BalanceLabel"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
</BoxContainer>
</PanelContainer>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Administration;
using Content.Shared._NF.Bank;
using Content.Shared.Administration;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
Expand Down Expand Up @@ -26,5 +27,6 @@ public PlayerTabEntry(PlayerInfo player, StyleBoxFlat styleBoxFlat)
BackgroundColorPanel.PanelOverride = styleBoxFlat;
OverallPlaytimeLabel.Text = player.PlaytimeString;
PlayerEntity = player.NetEntity;
BalanceLabel.Text = BankSystemExtensions.ToCurrencyString(player.Balance); // 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 @@ -37,7 +37,13 @@
HorizontalExpand="True"
ClipText="True"
Text="{Loc player-tab-playtime}"
MouseFilter="Pass"
ToolTip="{Loc player-tab-entry-tooltip}"/>
MouseFilter="Pass"/>
<cc:VSeparator/>
<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,6 +20,7 @@ public PlayerTabHeader()
JobLabel.OnKeyBindDown += JobClicked;
AntagonistLabel.OnKeyBindDown += AntagonistClicked;
PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
BalanceLabel.OnKeyBindDown += BalanceClicked; // Frontier
}

public Label GetHeader(Header header)
Expand All @@ -31,6 +32,7 @@ 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 @@ -42,6 +44,7 @@ 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 @@ -80,6 +83,11 @@ 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 @@ -91,6 +99,7 @@ protected override void Dispose(bool disposing)
JobLabel.OnKeyBindDown -= JobClicked;
AntagonistLabel.OnKeyBindDown -= AntagonistClicked;
PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
BalanceLabel.OnKeyBindDown -= BalanceClicked; // Frontier
}
}

Expand All @@ -100,6 +109,7 @@ public enum Header
Character,
Job,
Antagonist,
Playtime
Playtime,
Balance // Frontier
}
}
6 changes: 6 additions & 0 deletions Content.Client/_NF/Bank/BankSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Content.Shared.Bank;

namespace Content.Client.Bank;

// Shared is abstract.
public sealed partial class BankSystem : SharedBankSystem;
20 changes: 19 additions & 1 deletion Content.Server/Administration/Systems/AdminSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Content.Shared._NF.Bank.Events; // Frontier
using Content.Server.Bank; // Frontier

namespace Content.Server.Administration.Systems;

Expand All @@ -51,6 +53,7 @@ public sealed class AdminSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly StationRecordsSystem _stationRecords = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly BankSystem _bank = default!; // Frontier

private readonly Dictionary<NetUserId, PlayerInfo> _playerList = new();

Expand Down Expand Up @@ -96,6 +99,8 @@ 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 @@ -195,6 +200,13 @@ private void OnPlayerAttached(PlayerAttachedEvent ev)
UpdatePlayerList(ev.Player);
}

// Frontier: add balance
private void OnBalanceChanged(BalanceChangedEvent ev)
{
UpdatePlayerList(ev.Session);
}
// End Frontier

public override void Shutdown()
{
base.Shutdown();
Expand Down Expand Up @@ -223,11 +235,17 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
var name = data.UserName;
var entityName = string.Empty;
var identityName = string.Empty;
int balance = int.MinValue; // Frontier

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

// Frontier
if (!_bank.TryGetBalance(session.AttachedEntity.Value, out balance))
balance = int.MinValue; // Reset value to "no balance" flag value.
// Frontier
}

var antag = false;
Expand All @@ -248,7 +266,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);
connected, _roundActivePlayers.Contains(data.UserId), overallPlaytime, balance); // Frontier: added balance
}

private void OnPanicBunkerChanged(bool enabled)
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Administration/Systems/AdminVerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private void AddAdminVerbs(GetVerbsEvent<Verb> args)
var stationUid = _stations.GetOwningStation(args.Target);
var profile = _ticker.GetPlayerProfile(targetActor.PlayerSession);
var mobUid = _spawning.SpawnPlayerMob(coords.Value, null, profile, stationUid);
var mobUid = _spawning.SpawnPlayerMob(coords.Value, null, profile, stationUid, session: targetActor.PlayerSession); // Frontier: added session
var targetMind = _mindSystem.GetMind(args.Target);
if (targetMind != null)
Expand Down Expand Up @@ -208,7 +208,7 @@ private void AddAdminVerbs(GetVerbsEvent<Verb> args)
var stationUid = _stations.GetOwningStation(args.Target);
var profile = _ticker.GetPlayerProfile(targetActor.PlayerSession);
_spawning.SpawnPlayerMob(coords.Value, null, profile, stationUid);
_spawning.SpawnPlayerMob(coords.Value, null, profile, stationUid, session: targetActor.PlayerSession); // Frontier: added session
},
ConfirmationPopup = true,
Impact = LogImpact.High,
Expand Down
7 changes: 3 additions & 4 deletions Content.Server/Cloning/CloningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,10 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity<MindComponen
var mob = Spawn(speciesPrototype.Prototype, _transformSystem.GetMapCoordinates(uid));
_humanoidSystem.CloneAppearance(bodyToClone, mob);

// bank account transfer
if (TryComp<BankAccountComponent>(bodyToClone, out var bank))
// Frontier: bank account transfer
if (HasComp<BankAccountComponent>(bodyToClone))
{
var bankComp = EnsureComp<BankAccountComponent>(mob);
bankComp.Balance = bank.Balance;
EnsureComp<BankAccountComponent>(mob);
}

// Frontier
Expand Down
Loading

0 comments on commit 49877b1

Please sign in to comment.