Fix construction ghost sprite offset (#42193)

This commit is contained in:
B_Kirill
2026-01-23 08:22:22 +10:00
committed by GitHub
parent bcd3612730
commit 64f96e1069

View 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++)
_sprite.CopySprite((dummy, targetSprite), (ghost.Value, sprite));
for (var i = 0; i < sprite.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.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++;
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);