Skip to content

Commit

Permalink
Merge branch 'master' into Barge-Solar-Adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
dustylens authored Feb 6, 2025
2 parents e9360b0 + 5b56d7c commit ee26c27
Show file tree
Hide file tree
Showing 95 changed files with 2,002 additions and 429 deletions.
10 changes: 10 additions & 0 deletions Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ public void Populate(HealthAnalyzerScannedUserMessage msg)
MaxWidth = 300
});

// Frontier: uncloneable text
if (msg.Uncloneable == true)
AlertsContainer.AddChild(new RichTextLabel
{
Text = Loc.GetString("health-analyzer-window-entity-uncloneable-text"),
Margin = new Thickness(0, 4),
MaxWidth = 300
});
// End Frontier

if (msg.Bleeding == true)
AlertsContainer.AddChild(new RichTextLabel
{
Expand Down
10 changes: 9 additions & 1 deletion Content.Client/Inventory/StrippableBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using Robust.Shared.Map;
using static Content.Client.Inventory.ClientInventorySystem;
using static Robust.Client.UserInterface.Control;
using Content.Shared._EE.Strip.Components; // EE

namespace Content.Client.Inventory
{
Expand Down Expand Up @@ -172,7 +173,9 @@ private void AddHandButton(Hand hand)
button.BlockedRect.MouseFilter = MouseFilterMode.Ignore;
}

UpdateEntityIcon(button, hand.HeldEntity);
// Goobstation: use virtual entity if hidden
UpdateEntityIcon(button, EntMan.HasComponent<StripMenuHiddenComponent>(hand.HeldEntity) ? _virtualHiddenEntity : hand.HeldEntity);
// End Goobstation
_strippingMenu!.HandsContainer.AddChild(button);
}

Expand Down Expand Up @@ -214,6 +217,11 @@ private void AddInventoryButton(EntityUid invUid, string slotId, InventoryCompon
if (entity != null && _strippable.IsStripHidden(slotDef, _player.LocalEntity))
entity = _virtualHiddenEntity;

// Goobstation/EE: hide strip menu items
if (entity != null && EntMan.HasComponent<StripMenuHiddenComponent>(entity))
entity = _virtualHiddenEntity;
// End Goobstation/EE

var button = new SlotButton(new SlotData(slotDef, container));
button.Pressed += SlotPressed;

Expand Down
14 changes: 1 addition & 13 deletions Content.Client/_EstacaoPirata/Cards/Card/CardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Content.Client._EstacaoPirata.Cards.Card;
/// </summary>
public sealed class CardSystem : EntitySystem
{
[Dependency] private readonly SpriteSystem _spriteSystem = default!;
/// <inheritdoc/>
public override void Initialize()
{
Expand Down Expand Up @@ -38,7 +37,7 @@ private void OnComponentStartupEvent(EntityUid uid, CardComponent comp, Componen
}

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

Expand All @@ -52,30 +51,19 @@ private void OnFlip(CardFlipUpdatedEvent args)
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++)
{
Expand Down
21 changes: 6 additions & 15 deletions Content.Client/_EstacaoPirata/Cards/CardSpriteSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ namespace Content.Client._EstacaoPirata.Cards;
public sealed class CardSpriteSystem : EntitySystem
{
/// <inheritdoc/>
public override void Initialize()
{

}
public override void Initialize() { }

public bool TryAdjustLayerQuantity(Entity<SpriteComponent, CardStackComponent> uid, int? cardLimit = null)
{
Expand All @@ -23,7 +20,8 @@ public bool TryAdjustLayerQuantity(Entity<SpriteComponent, CardStackComponent> u

var layerCount = 0;
//Gets the quantity of layers
foreach (var card in stack.Cards.TakeLast(cardCount))
var relevantCards = stack.Cards.TakeLast(cardCount).ToList();
foreach (var card in relevantCards)
{
if (!TryComp(card, out SpriteComponent? cardSprite))
return false;
Expand All @@ -33,21 +31,13 @@ public bool TryAdjustLayerQuantity(Entity<SpriteComponent, CardStackComponent> u
layerCount = int.Max(1, layerCount); // Frontier: you need one layer.
//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;
}
Expand All @@ -61,7 +51,8 @@ public bool TryHandleLayerConfiguration(Entity<SpriteComponent, CardStackCompone
List<(int, ISpriteLayer)> layers = [];

var i = 0;
foreach (var card in stack.Cards.TakeLast(cardCount))
var cards = stack.Cards.TakeLast(cardCount).ToList();
foreach (var card in cards)
{
if (!TryComp(card, out SpriteComponent? cardSprite))
return false;
Expand Down
20 changes: 11 additions & 9 deletions Content.Client/_EstacaoPirata/Cards/Deck/CardDeckSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ public override void Update(float frameTime)
private bool TryGetCardLayer(EntityUid card, out SpriteComponent.Layer? layer)
{
layer = null;
if (!TryComp(card, out SpriteComponent? cardSprite))
return false;

if (!cardSprite.TryGetLayer(0, out var l))
if (!TryComp(card, out SpriteComponent? cardSprite)
|| !cardSprite.TryGetLayer(0, out var l))
return false;

layer = l;
Expand All @@ -75,13 +73,10 @@ private bool TryGetCardLayer(EntityUid card, out SpriteComponent.Layer? layer)

private void UpdateSprite(EntityUid uid, CardDeckComponent comp)
{
if (!TryComp(uid, out SpriteComponent? sprite))
if (!TryComp(uid, out SpriteComponent? sprite)
|| !TryComp(uid, out CardStackComponent? cardStack))
return;

if (!TryComp(uid, out CardStackComponent? cardStack))
return;


// Prevents error appearing at spawnMenu
if (cardStack.Cards.Count <= 0 || !TryGetCardLayer(cardStack.Cards.Last(), out var cardlayer) ||
cardlayer == null)
Expand Down Expand Up @@ -132,7 +127,14 @@ private void OnAppearanceChanged(EntityUid uid, CardDeckComponent comp, Appearan
}
private void OnComponentStartupEvent(EntityUid uid, CardDeckComponent comp, ComponentStartup args)
{
if (!TryComp(uid, out CardStackComponent? stack))
{
_notInitialized[(uid, comp)] = 0;
return;
}

if (stack.Cards.Count <= 0)
_notInitialized[(uid, comp)] = 0;
UpdateSprite(uid, comp);
}

Expand Down
55 changes: 50 additions & 5 deletions Content.Client/_EstacaoPirata/Cards/Hand/CardHandSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
using System.Numerics;
using Content.Shared._EstacaoPirata.Cards.Hand;
using Content.Shared._EstacaoPirata.Cards.Stack;
Expand All @@ -10,6 +11,7 @@ namespace Content.Client._EstacaoPirata.Cards.Hand;
/// </summary>
public sealed class CardHandSystem : EntitySystem
{
private readonly Dictionary<Entity<CardHandComponent>, int> _notInit = [];
[Dependency] private readonly CardSpriteSystem _cardSpriteSystem = default!;


Expand All @@ -23,13 +25,50 @@ public override void Initialize()
SubscribeNetworkEvent<CardStackFlippedEvent>(OnStackFlip);
}

public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var (ent, value) in _notInit)
{
if (value >= 5)
{
_notInit.Remove(ent);
continue;
}
_notInit[ent] = value + 1;
if (!TryComp(ent.Owner, out CardStackComponent? stack) || stack.Cards.Count <= 0)
continue;

// If cards were correctly initialized, we update the sprite
UpdateSprite(ent.Owner, ent.Comp);
_notInit.Remove(ent);
}
}

private bool TryGetCardLayer(EntityUid card, out SpriteComponent.Layer? layer)
{
layer = null;
if (!TryComp(card, out SpriteComponent? cardSprite)
|| !cardSprite.TryGetLayer(0, out var l))
return false;

layer = l;
return true;
}

private void UpdateSprite(EntityUid uid, CardHandComponent comp)
{
if (!TryComp(uid, out SpriteComponent? sprite))
if (!TryComp(uid, out SpriteComponent? sprite)
|| !TryComp(uid, out CardStackComponent? cardStack))
return;

if (!TryComp(uid, out CardStackComponent? cardStack))
// Prevents error appearing at spawnMenu
if (cardStack.Cards.Count <= 0 || !TryGetCardLayer(cardStack.Cards.Last(), out var cardlayer) ||
cardlayer == null)
{
_notInit[(uid, comp)] = 0;
return;
}

_cardSpriteSystem.TryAdjustLayerQuantity((uid, sprite, cardStack), comp.CardLimit);

Expand Down Expand Up @@ -60,15 +99,15 @@ private void UpdateSprite(EntityUid uid, CardHandComponent comp)
}
else
{
var intervalAngle = comp.Angle / (cardCount-1);
var intervalAngle = comp.Angle / (cardCount - 1);
var intervalSize = comp.XOffset / (cardCount - 1);

_cardSpriteSystem.TryHandleLayerConfiguration(
(uid, sprite, cardStack),
cardCount,
(sprt, cardIndex, layerIndex) =>
{
var angle = (-(comp.Angle/2)) + cardIndex * intervalAngle;
var angle = (-(comp.Angle / 2)) + cardIndex * intervalAngle;
var x = (-(comp.XOffset / 2)) + cardIndex * intervalSize;
var y = -(x * x) + 0.10f;

Expand Down Expand Up @@ -99,7 +138,13 @@ private void OnStackStart(CardStackInitiatedEvent args)
}
private void OnComponentStartupEvent(EntityUid uid, CardHandComponent comp, ComponentStartup args)
{

if (!TryComp(uid, out CardStackComponent? stack))
{
_notInit[(uid, comp)] = 0;
return;
}
if (stack.Cards.Count <= 0)
_notInit[(uid, comp)] = 0;
UpdateSprite(uid, comp);
}

Expand Down
20 changes: 3 additions & 17 deletions Content.Client/_EstacaoPirata/Cards/Hand/UI/CardHandMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,13 @@ public sealed partial class CardHandMenu : RadialMenu
[Dependency] private readonly EntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

private readonly SpriteSystem _spriteSystem;
private readonly SharedPopupSystem _popup;

public event Action<NetEntity>? CardHandDrawMessageAction;

private EntityUid _owner;

public CardHandMenu(EntityUid owner, CardHandMenuBoundUserInterface bui)
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

_spriteSystem = _entManager.System<SpriteSystem>();
_popup = _entManager.System<SharedPopupSystem>();

_owner = owner;

// Find the main radial container
var main = FindControl<RadialContainer>("Main");

Expand All @@ -42,19 +32,15 @@ public CardHandMenu(EntityUid owner, CardHandMenuBoundUserInterface bui)

foreach (var card in stack.Cards)
{
if (_playerManager.LocalSession == null)
return;
if (!_entManager.TryGetComponent<CardComponent>(card, out var cardComp))
if (_playerManager.LocalSession == null
|| !_entManager.TryGetComponent<CardComponent>(card, out var cardComp))
return;

string cardName;
if (cardComp.Flipped && _entManager.TryGetComponent<MetaDataComponent>(card, out var metadata))
{
cardName = metadata.EntityName;
}
else
{
cardName = Loc.GetString(cardComp.Name);
}

var button = new CardMenuButton()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Content.Shared._EstacaoPirata.Cards.Hand;
using Content.Shared.RCD;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Shared.Prototypes;

namespace Content.Client._EstacaoPirata.Cards.Hand.UI;

Expand Down Expand Up @@ -32,10 +30,7 @@ protected override void Open()
_menu.OpenCenteredAt(_inputManager.MouseScreenPosition.Position / vpSize);
}

public void SendCardHandDrawMessage(NetEntity e)
{
SendMessage(new CardHandDrawMessage(e));
}
public void SendCardHandDrawMessage(NetEntity e) => SendMessage(new CardHandDrawMessage(e));

protected override void Dispose(bool disposing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public sealed class ReagentDispenserSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly OpenableSystem _openable = default!;
[Dependency] private readonly LabelSystem _label = default!; // Frontier
[Dependency] private readonly SharedContainerSystem _containers = default!; // Frontier

public override void Initialize()
{
Expand Down Expand Up @@ -279,8 +280,10 @@ private void OnMapInit(EntityUid uid, ReagentDispenserComponent component, MapIn
{
for (var i = 0; i < packPrototype.Inventory.Count && i < component.StorageSlots.Count; i++)
{
if (component.StorageSlots[i].ContainerSlot == null)
continue;
var item = Spawn(packPrototype.Inventory[i], Transform(uid).Coordinates);
if (!_itemSlotsSystem.TryInsert(uid, component.StorageSlots[i].ID!, item, null, excludeUserAudio: true))
if (!_containers.Insert(item, component.StorageSlots[i].ContainerSlot!)) // ContainerSystem.Insert is silent.
QueueDel(item);
}
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Medical/CryoPodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ private void OnActivateUI(Entity<CryoPodComponent> entity, ref AfterActivatableU
: 0,
null,
null,
null
null,
null // Frontier
));
}

Expand Down
Loading

0 comments on commit ee26c27

Please sign in to comment.