From 38f1a765d708eee90fcbb562f6e20b452052527e Mon Sep 17 00:00:00 2001 From: Red <96445749+TheShuEd@users.noreply.github.com> Date: Thu, 11 Sep 2025 00:22:21 +0300 Subject: [PATCH] Some random tasks (#1763) * Update venicialis.yml * Update CP14CurrencySystem.Converter.cs * fix #1759 * fix #1605 * fix #1604 --- .../_CP14/LockKey/CP14ClientLockKetSystem.cs | 50 +++++++++++++++++ .../CP14MagicEnergyStatusControl.cs | 55 +++++++++++++++++++ .../MagicEnergy/CP14MagicEnergySystem.cs | 12 +++- .../Currency/CP14CurrencySystem.Converter.cs | 8 +-- .../_CP14/Entities/Mobs/Species/base.yml | 1 + .../Prototypes/_CP14/Maps/venicialis.yml | 1 + 6 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 Content.Client/_CP14/LockKey/CP14ClientLockKetSystem.cs create mode 100644 Content.Client/_CP14/MagicEnergy/CP14MagicEnergyStatusControl.cs diff --git a/Content.Client/_CP14/LockKey/CP14ClientLockKetSystem.cs b/Content.Client/_CP14/LockKey/CP14ClientLockKetSystem.cs new file mode 100644 index 0000000000..ba530cf2b9 --- /dev/null +++ b/Content.Client/_CP14/LockKey/CP14ClientLockKetSystem.cs @@ -0,0 +1,50 @@ +using System.Text; +using Content.Client.Items; +using Content.Client.Stylesheets; +using Content.Shared._CP14.LockKey.Components; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Shared.Timing; + +namespace Content.Client._CP14.LockKey; + +public sealed class CP14ClientLockKeySystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + + Subs.ItemStatus(ent => new CP14KeyStatusControl(ent)); + } +} + + +public sealed class CP14KeyStatusControl : Control +{ + private readonly Entity _parent; + private readonly RichTextLabel _label; + public CP14KeyStatusControl(Entity parent) + { + _parent = parent; + + _label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } }; + AddChild(_label); + } + + protected override void FrameUpdate(FrameEventArgs args) + { + base.FrameUpdate(args); + + if (_parent.Comp.LockShape is null) + return; + + var sb = new StringBuilder("("); + foreach (var item in _parent.Comp.LockShape) + { + sb.Append($"{item} "); + } + + sb.Append(")"); + _label.Text = sb.ToString(); + } +} diff --git a/Content.Client/_CP14/MagicEnergy/CP14MagicEnergyStatusControl.cs b/Content.Client/_CP14/MagicEnergy/CP14MagicEnergyStatusControl.cs new file mode 100644 index 0000000000..e97ec535fd --- /dev/null +++ b/Content.Client/_CP14/MagicEnergy/CP14MagicEnergyStatusControl.cs @@ -0,0 +1,55 @@ +using Content.Client.Stylesheets; +using Content.Shared._CP14.MagicEnergy.Components; +using Robust.Client.Graphics; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Shared.Timing; + +namespace Content.Client._CP14.MagicEnergy; + +public sealed class CP14MagicEnergyStatusControl : Control +{ + private readonly Entity _parent; + private readonly IEntityManager _entMan; + private readonly RichTextLabel _label; + private readonly ProgressBar _progress; + + public CP14MagicEnergyStatusControl(Entity parent) + { + _entMan = IoCManager.Resolve(); + _progress = new ProgressBar + { + MaxValue = 1, + Value = 0 + }; + _progress.SetHeight = 8f; + _progress.ForegroundStyleBoxOverride = new StyleBoxFlat(Color.FromHex("#3fc488")); + _progress.BackgroundStyleBoxOverride = new StyleBoxFlat(Color.FromHex("#0f2d42")); + _progress.Margin = new Thickness(0, 4); + _label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } }; + + if (!_entMan.TryGetComponent(parent, out var container)) + return; + + _parent = (parent.Owner, container); + + var boxContainer = new BoxContainer(); + + boxContainer.Orientation = BoxContainer.LayoutOrientation.Vertical; + + boxContainer.AddChild(_label); + boxContainer.AddChild(_progress); + + AddChild(boxContainer); + } + + protected override void FrameUpdate(FrameEventArgs args) + { + base.FrameUpdate(args); + + _progress.Value = (float)(_parent.Comp.Energy / _parent.Comp.MaxEnergy); + + var power = (int) (_parent.Comp.Energy / _parent.Comp.MaxEnergy * 100); + _label.Text = $"{power}%"; + } +} diff --git a/Content.Client/_CP14/MagicEnergy/CP14MagicEnergySystem.cs b/Content.Client/_CP14/MagicEnergy/CP14MagicEnergySystem.cs index d2caad324a..262f38a0a7 100644 --- a/Content.Client/_CP14/MagicEnergy/CP14MagicEnergySystem.cs +++ b/Content.Client/_CP14/MagicEnergy/CP14MagicEnergySystem.cs @@ -1,5 +1,15 @@ +using Content.Client.Items; using Content.Shared._CP14.MagicEnergy; +using Content.Shared._CP14.MagicEnergy.Components; namespace Content.Client._CP14.MagicEnergy; -public sealed class CP14MagicEnergySystem : CP14SharedMagicEnergySystem; +public sealed class CP14MagicEnergySystem : CP14SharedMagicEnergySystem +{ + public override void Initialize() + { + base.Initialize(); + + Subs.ItemStatus( ent => new CP14MagicEnergyStatusControl(ent)); + } +} diff --git a/Content.Server/_CP14/Currency/CP14CurrencySystem.Converter.cs b/Content.Server/_CP14/Currency/CP14CurrencySystem.Converter.cs index ea96eff1c3..cfcc3133ec 100644 --- a/Content.Server/_CP14/Currency/CP14CurrencySystem.Converter.cs +++ b/Content.Server/_CP14/Currency/CP14CurrencySystem.Converter.cs @@ -31,7 +31,7 @@ public sealed partial class CP14CurrencySystem Verb copperVerb = new() { Text = Loc.GetString("cp14-currency-converter-get-cp"), - Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/_CP14/Objects/Economy/cp_coin.rsi/coin10.png")), + Icon = new SpriteSpecifier.Rsi(new ("/Textures/_CP14/Objects/Economy/cp_coin.rsi"), "coin10"), Category = VerbCategory.CP14CurrencyConvert, Priority = 1, CloseMenu = false, @@ -51,7 +51,7 @@ public sealed partial class CP14CurrencySystem Verb silverVerb = new() { Text = Loc.GetString("cp14-currency-converter-get-sp"), - Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/_CP14/Objects/Economy/sp_coin.rsi/coin10.png")), + Icon = new SpriteSpecifier.Rsi(new ("/Textures/_CP14/Objects/Economy/sp_coin.rsi"), "coin10"), Category = VerbCategory.CP14CurrencyConvert, Priority = 2, CloseMenu = false, @@ -70,7 +70,7 @@ public sealed partial class CP14CurrencySystem Verb goldVerb = new() { Text = Loc.GetString("cp14-currency-converter-get-gp"), - Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/_CP14/Objects/Economy/gp_coin.rsi/coin10.png")), + Icon = new SpriteSpecifier.Rsi(new ("/Textures/_CP14/Objects/Economy/gp_coin.rsi"), "coin10"), Category = VerbCategory.CP14CurrencyConvert, Priority = 3, CloseMenu = false, @@ -89,7 +89,7 @@ public sealed partial class CP14CurrencySystem Verb platinumVerb = new() { Text = Loc.GetString("cp14-currency-converter-get-pp"), - Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/_CP14/Objects/Economy/pp_coin.rsi/coin10.png")), + Icon = new SpriteSpecifier.Rsi(new ("/Textures/_CP14/Objects/Economy/pp_coin.rsi"), "coin10"), Category = VerbCategory.CP14CurrencyConvert, Priority = 4, CloseMenu = false, diff --git a/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml b/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml index 608cfc8041..67ac1ff06d 100644 --- a/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/_CP14/Entities/Mobs/Species/base.yml @@ -151,6 +151,7 @@ - type: Body prototype: CP14Human requiredLegs: 2 + - type: Crawler - type: Identity - type: Hands - type: ComplexInteraction diff --git a/Resources/Prototypes/_CP14/Maps/venicialis.yml b/Resources/Prototypes/_CP14/Maps/venicialis.yml index 23a700b652..4d0a0eacde 100644 --- a/Resources/Prototypes/_CP14/Maps/venicialis.yml +++ b/Resources/Prototypes/_CP14/Maps/venicialis.yml @@ -49,6 +49,7 @@ - type: CP14StationProceduralLocation location: VenicialistFort modifiers: + - DemiplaneArcSingle - RaidSpawners - CopperOre - CopperOre