Move Utils.CenterOfCell into Map global

This commit is contained in:
Oliver Brakmann
2014-10-19 16:33:27 +02:00
parent 37c5d51f19
commit 35ccc79902
4 changed files with 11 additions and 11 deletions

View File

@@ -86,6 +86,12 @@ namespace OpenRA.Mods.RA.Scripting
return context.World.Map.ChooseRandomEdgeCell(context.World.SharedRandom);
}
[Desc("Returns the center of a cell in world coordinates.")]
public WPos CenterOfCell(CPos cell)
{
return context.World.Map.CenterOfCell(cell);
}
[Desc("Returns true if there is only one human player.")]
public bool IsSinglePlayer { get { return context.World.LobbyInfo.IsSinglePlayer; } }

View File

@@ -89,11 +89,5 @@ namespace OpenRA.Mods.RA.Scripting
return context.World.SharedRandom.Next(low, high);
}
[Desc("Returns the center of a cell in world coordinates.")]
public WPos CenterOfCell(CPos cell)
{
return context.World.Map.CenterOfCell(cell);
}
}
}

View File

@@ -84,8 +84,8 @@ end
ParadropSovietUnits = function()
local lz = Utils.Random(ParadropWaypoints).Location
local start = Utils.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(lz) - start).Facing })
local start = Map.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(lz) - start).Facing })
Utils.Do(ParadropUnitTypes, function(type)
local a = Actor.Create(type, false, { Owner = soviets })

View File

@@ -48,7 +48,7 @@ Paratroopers = { "e1", "e1", "e1", "e3", "e3" }
ParadropSovietUnits = function()
local start = BaseRaidEntrypoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(MCVDeployLocation.Location) - start).Facing })
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(MCVDeployLocation.Location) - start).Facing })
Utils.Do(Paratroopers, function(type)
local a = Actor.Create(type, false, { Owner = soviets })
@@ -66,8 +66,8 @@ AirRaid = function(planeTypes, ingress, egress, target)
for i = 1, #planeTypes do
Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function()
local start = Utils.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i]))
local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(ingress[2]) - start).Facing })
local start = Map.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i]))
local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(ingress[2]) - start).Facing })
Utils.Do(ingress, function(wpt) plane.Move(wpt) end)
plane.Attack(target)