]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix construction ghost sprite offset (#42193)
authorB_Kirill <153602297+B-Kirill@users.noreply.github.com>
Thu, 22 Jan 2026 22:22:22 +0000 (08:22 +1000)
committerGitHub <noreply@github.com>
Thu, 22 Jan 2026 22:22:22 +0000 (22:22 +0000)
Content.Client/Construction/ConstructionSystem.cs

index 9900f860c370818d06ec903c2b7e408f1a47546a..e2010df12c3bb85c83b0d3e4f74c90c4b14ba58c 100644 (file)
@@ -291,7 +291,6 @@ namespace Content.Client.Construction
             _ghosts.Add(comp.GhostId, ghost.Value);
 
             var sprite = Comp<SpriteComponent>(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<SpriteComponent>(dummy);
                 EntityManager.System<AppearanceSystem>().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<WallMountComponent>(ghost.Value).Arc = new(Math.Tau);