Skip to content

Commit

Permalink
Merge branch 'RCD-change' of https://github.com/VividPups/frontier-st…
Browse files Browse the repository at this point in the history
…ation-14 into RCD-change
  • Loading branch information
VividPups committed Sep 21, 2024
2 parents 9a0481e + 015fa24 commit 7b027aa
Show file tree
Hide file tree
Showing 917 changed files with 42,191 additions and 4,490 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
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Shared.Nyanotrasen.Item.PseudoItem;

namespace Content.Client.Nyanotrasen.Item.PseudoItem;

public sealed class PseudoItemSystem : SharedPseudoItemSystem
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
private bool _isPopulating;

private StationRecordFilterType _currentFilterType;
[Dependency] private readonly IPrototypeManager _prototype = default!; // Frontier

public GeneralStationRecordConsoleWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this); // Frontier

_currentFilterType = StationRecordFilterType.Name;

Expand Down Expand Up @@ -178,10 +180,21 @@ private void PopulateJobsContainer(IReadOnlyDictionary<ProtoId<JobPrototype>, in
JobListing.RemoveAllChildren();
foreach (var (job, amount) in jobList)
{
// Skip overflow jobs.
if (amount < 0 || amount is null)
continue;

// Get proper job names when possible
string jobName;
if (_prototype.TryIndex(job, out var jobProto))
jobName = jobProto.LocalizedName;
else
jobName = job;

var jobEntry = new JobRow
{
Job = job,
JobName = { Text = job },
JobName = { Text = jobName },
JobAmount = { Text = amount.ToString() },
};
jobEntry.DecreaseJobSlot.OnPressed += (args) => { OnJobSubtract?.Invoke(args); };
Expand Down
86 changes: 86 additions & 0 deletions Content.Client/_EstacaoPirata/Cards/Card/CardSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System.Linq;
using Content.Shared._EstacaoPirata.Cards.Card;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;

namespace Content.Client._EstacaoPirata.Cards.Card;

/// <summary>
/// This handles...
/// </summary>
public sealed class CardSystem : EntitySystem
{
[Dependency] private readonly SpriteSystem _spriteSystem = default!;
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<CardComponent, ComponentStartup>(OnComponentStartupEvent);
SubscribeNetworkEvent<CardFlipUpdatedEvent>(OnFlip);
}

private void OnComponentStartupEvent(EntityUid uid, CardComponent comp, ComponentStartup args)
{
if (!TryComp(uid, out SpriteComponent? spriteComponent))
return;

for (var i = 0; i < spriteComponent.AllLayers.Count(); i++)
{
//Log.Debug($"Layer {i}");
if (!spriteComponent.TryGetLayer(i, out var layer) || layer.State.Name == null)
continue;

var rsi = layer.RSI ?? spriteComponent.BaseRSI;
if (rsi == null)
continue;

//Log.Debug("FOI");
comp.FrontSprite.Add(new SpriteSpecifier.Rsi(rsi.Path, layer.State.Name));
}

comp.BackSprite ??= comp.FrontSprite;
Dirty(uid, comp);
UpdateSprite(uid, comp);
}

private void OnFlip(CardFlipUpdatedEvent args)
{
if (!TryComp(GetEntity(args.Card), out CardComponent? comp))
return;
UpdateSprite(GetEntity(args.Card), comp);
}

private void UpdateSprite(EntityUid uid, CardComponent comp)
{
var newSprite = comp.Flipped ? comp.BackSprite : comp.FrontSprite;
if (newSprite == null)
return;

if (!TryComp(uid, out SpriteComponent? spriteComponent))
return;

var layerCount = newSprite.Count();

//inserts Missing Layers
if (spriteComponent.AllLayers.Count() < layerCount)
{
for (var i = spriteComponent.AllLayers.Count(); i < layerCount; i++)
{
spriteComponent.AddBlankLayer(i);
}
}
//Removes extra layers
else if (spriteComponent.AllLayers.Count() > layerCount)
{
for (var i = spriteComponent.AllLayers.Count() - 1; i >= layerCount; i--)
{
spriteComponent.RemoveLayer(i);
}
}

for (var i = 0; i < newSprite.Count(); i++)
{
var layer = newSprite[i];
spriteComponent.LayerSetSprite(i, layer);
}
}
}
84 changes: 84 additions & 0 deletions Content.Client/_EstacaoPirata/Cards/CardSpriteSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using System.Linq;
using Content.Shared._EstacaoPirata.Cards.Stack;
using Robust.Client.GameObjects;

namespace Content.Client._EstacaoPirata.Cards;

/// <summary>
/// This handles...
/// </summary>
public sealed class CardSpriteSystem : EntitySystem
{
/// <inheritdoc/>
public override void Initialize()
{

}

public bool TryAdjustLayerQuantity(Entity<SpriteComponent, CardStackComponent> uid, int? cardLimit = null)
{
var sprite = uid.Comp1;
var stack = uid.Comp2;
var cardCount = cardLimit == null ? stack.Cards.Count : Math.Min(stack.Cards.Count, cardLimit.Value);

var layerCount = 0;
//Gets the quantity of layers
foreach (var card in stack.Cards.TakeLast(cardCount))
{
if (!TryComp(card, out SpriteComponent? cardSprite))
return false;

layerCount += cardSprite.AllLayers.Count();
}
//inserts Missing Layers
if (sprite.AllLayers.Count() < layerCount)
{
for (var i = sprite.AllLayers.Count(); i < layerCount; i++)
{
sprite.AddBlankLayer(i);
}
}
//Removes extra layers
else if (sprite.AllLayers.Count() > layerCount)
{
for (var i = sprite.AllLayers.Count() - 1; i >= layerCount; i--)
{
sprite.RemoveLayer(i);
}
}


return true;
}

public bool TryHandleLayerConfiguration(Entity<SpriteComponent, CardStackComponent> uid, int cardCount, Func<Entity<SpriteComponent>, int, int, bool> layerFunc)
{
var sprite = uid.Comp1;
var stack = uid.Comp2;

// int = index of what card it is from
List<(int, ISpriteLayer)> layers = [];

var i = 0;
foreach (var card in stack.Cards.TakeLast(cardCount))
{
if (!TryComp(card, out SpriteComponent? cardSprite))
return false;
layers.AddRange(cardSprite.AllLayers.Select(layer => (i, layer)));
i++;
}

var j = 0;
foreach (var obj in layers)
{
var (cardIndex, layer) = obj;
sprite.LayerSetVisible(j, true);
sprite.LayerSetTexture(j, layer.Texture);
sprite.LayerSetState(j, layer.RsiState.Name);
layerFunc.Invoke((uid, sprite), cardIndex, j);
j++;
}

return true;
}
}
Loading

0 comments on commit 7b027aa

Please sign in to comment.