Fix projected world coordinate calculation for Lua API.
This commit is contained in:
@@ -64,16 +64,26 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
return actors.ToArray();
|
||||
}
|
||||
|
||||
[Desc("Returns the location of the top-left corner of the map.")]
|
||||
[Desc("Returns the location of the top-left corner of the map (assuming zero terrain height).")]
|
||||
public WPos TopLeft
|
||||
{
|
||||
get { return new WPos(Context.World.Map.Bounds.Left * 1024, Context.World.Map.Bounds.Top * 1024, 0); }
|
||||
get
|
||||
{
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
return Context.World.Map.ProjectedTopLeft;
|
||||
}
|
||||
}
|
||||
|
||||
[Desc("Returns the location of the bottom-right corner of the map.")]
|
||||
[Desc("Returns the location of the bottom-right corner of the map (assuming zero terrain height).")]
|
||||
public WPos BottomRight
|
||||
{
|
||||
get { return new WPos(Context.World.Map.Bounds.Right * 1024, Context.World.Map.Bounds.Bottom * 1024, 0); }
|
||||
get
|
||||
{
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
return Context.World.Map.ProjectedBottomRight;
|
||||
}
|
||||
}
|
||||
|
||||
[Desc("Returns a random cell inside the visible region of the map.")]
|
||||
|
||||
@@ -64,7 +64,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
height = Math.Max(2, height);
|
||||
|
||||
map.Resize(width + 2, height + tileset.MaxGroundHeight + 2);
|
||||
map.ResizeCordon(1, 1, width + 1, height + tileset.MaxGroundHeight + 1);
|
||||
|
||||
var tl = new MPos(1, 1);
|
||||
var br = new MPos(width, height + tileset.MaxGroundHeight);
|
||||
map.SetBounds(tl, br);
|
||||
|
||||
map.PlayerDefinitions = new MapPlayers(map.Rules, map.SpawnPoints.Value.Length).ToMiniYaml();
|
||||
map.FixOpenAreas(modRules);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user