Move Utils.CenterOfCell into Map global
This commit is contained in:
@@ -86,6 +86,12 @@ namespace OpenRA.Mods.RA.Scripting
|
|||||||
return context.World.Map.ChooseRandomEdgeCell(context.World.SharedRandom);
|
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.")]
|
[Desc("Returns true if there is only one human player.")]
|
||||||
public bool IsSinglePlayer { get { return context.World.LobbyInfo.IsSinglePlayer; } }
|
public bool IsSinglePlayer { get { return context.World.LobbyInfo.IsSinglePlayer; } }
|
||||||
|
|
||||||
|
|||||||
@@ -89,11 +89,5 @@ namespace OpenRA.Mods.RA.Scripting
|
|||||||
|
|
||||||
return context.World.SharedRandom.Next(low, high);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ end
|
|||||||
|
|
||||||
ParadropSovietUnits = function()
|
ParadropSovietUnits = function()
|
||||||
local lz = Utils.Random(ParadropWaypoints).Location
|
local lz = Utils.Random(ParadropWaypoints).Location
|
||||||
local start = Utils.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
|
local start = Map.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 transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(lz) - start).Facing })
|
||||||
|
|
||||||
Utils.Do(ParadropUnitTypes, function(type)
|
Utils.Do(ParadropUnitTypes, function(type)
|
||||||
local a = Actor.Create(type, false, { Owner = soviets })
|
local a = Actor.Create(type, false, { Owner = soviets })
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ Paratroopers = { "e1", "e1", "e1", "e3", "e3" }
|
|||||||
|
|
||||||
ParadropSovietUnits = function()
|
ParadropSovietUnits = function()
|
||||||
local start = BaseRaidEntrypoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
|
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)
|
Utils.Do(Paratroopers, function(type)
|
||||||
local a = Actor.Create(type, false, { Owner = soviets })
|
local a = Actor.Create(type, false, { Owner = soviets })
|
||||||
@@ -66,8 +66,8 @@ AirRaid = function(planeTypes, ingress, egress, target)
|
|||||||
|
|
||||||
for i = 1, #planeTypes do
|
for i = 1, #planeTypes do
|
||||||
Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function()
|
Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function()
|
||||||
local start = Utils.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i]))
|
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 = (Utils.CenterOfCell(ingress[2]) - start).Facing })
|
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)
|
Utils.Do(ingress, function(wpt) plane.Move(wpt) end)
|
||||||
plane.Attack(target)
|
plane.Attack(target)
|
||||||
|
|||||||
Reference in New Issue
Block a user