Editor actor move

This commit is contained in:
Wojciech Walaszek
2023-12-13 19:10:18 +01:00
committed by Gustas
parent ac610c54eb
commit 7b82d85b27
4 changed files with 160 additions and 41 deletions

View File

@@ -189,6 +189,22 @@ namespace OpenRA.Mods.Common.Traits
return ++CurrentToken;
}
public void MoveActor(EditorActorPreview preview, CPos location)
{
editorLayer.Remove(preview);
preview.ReplaceInit(new LocationInit(location));
var ios = preview.Info.TraitInfoOrDefault<IOccupySpaceInfo>();
if (ios != null && ios.SharesCell)
{
var actorSubCell = editorLayer.FreeSubCellAt(location);
if (actorSubCell != SubCell.Invalid)
preview.ReplaceInit(new SubCellInit(actorSubCell));
}
preview.UpdateFromMove();
editorLayer.Add(preview);
}
public int SetTerrainTemplate(WorldRenderer wr, TerrainTemplateInfo template)
{
terrainOrResourceCell = wr.Viewport.ViewToWorld(wr.Viewport.WorldToViewPx(Viewport.LastMousePos));