From 64f96e106986bbacdfc9b7720e0e96b2e9eb0008 Mon Sep 17 00:00:00 2001 From: B_Kirill <153602297+B-Kirill@users.noreply.github.com> Date: Fri, 23 Jan 2026 08:22:22 +1000 Subject: [PATCH] Fix construction ghost sprite offset (#42193) --- .../Construction/ConstructionSystem.cs | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index 9900f860c3..e2010df12c 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -291,7 +291,6 @@ namespace Content.Client.Construction _ghosts.Add(comp.GhostId, ghost.Value); var sprite = Comp(ghost.Value); - _sprite.SetColor((ghost.Value, sprite), new Color(48, 255, 48, 128)); if (targetProto.TryGetComponent(out IconComponent? icon, EntityManager.ComponentFactory)) { @@ -306,22 +305,11 @@ namespace Content.Client.Construction var targetSprite = EnsureComp(dummy); EntityManager.System().OnChangeData(dummy, targetSprite); - var addedIndex = 0; - for (var i = 0; i < targetSprite.AllLayers.Count(); i++) - { - if (!targetSprite[i].Visible || !targetSprite[i].RsiState.IsValid) - continue; - - var rsi = targetSprite[i].Rsi ?? targetSprite.BaseRSI; - if (rsi is null || !rsi.TryGetState(targetSprite[i].RsiState, out var state) || - state.StateId.Name is null) - continue; + _sprite.CopySprite((dummy, targetSprite), (ghost.Value, sprite)); - _sprite.AddBlankLayer((ghost.Value, sprite), addedIndex); - _sprite.LayerSetSprite((ghost.Value, sprite), addedIndex, new SpriteSpecifier.Rsi(rsi.Path, state.StateId.Name)); - sprite.LayerSetShader(addedIndex, "unshaded"); - _sprite.LayerSetVisible((ghost.Value, sprite), addedIndex, true); - addedIndex++; + for (var i = 0; i < sprite.AllLayers.Count(); i++) + { + sprite.LayerSetShader(i, "unshaded"); } Del(dummy); @@ -329,6 +317,8 @@ namespace Content.Client.Construction else return false; + _sprite.SetColor((ghost.Value, sprite), new Color(48, 255, 48, 128)); + if (prototype.CanBuildInImpassable) EnsureComp(ghost.Value).Arc = new(Math.Tau); -- 2.52.0