Fix breakage of the old Lua API due to recent changes

Specifically, the CPos::CenterPosition -> Map::CenterOfCell rename (#5758),
as well as the additional argument to Paradrop::SetLZ (#5695).
This commit is contained in:
Oliver Brakmann
2014-07-06 01:21:22 +02:00
parent b9d84cb422
commit 3a67b3dec3
9 changed files with 26 additions and 16 deletions

View File

@@ -29,7 +29,7 @@ end
Actor.ScriptedMove = function(actor, location)
if Actor.HasTrait(actor, "Helicopter") then
Internal.HeliFlyToPos(actor, location.CenterPosition)
Internal.HeliFlyToPos(actor, Map.CenterOfCell(location))
else
actor:QueueActivity(OpenRA.New("Move", { location }))
end

View File

@@ -70,6 +70,10 @@ Map.ExpandFootprint = function(cells, allowDiagonal)
return Utils.EnumerableToTable(Internal.ExpandFootprint(cells, allowDiagonal))
end
Map.CenterOfCell = function(position)
return Internal.CenterOfCell(position)
end
CPos.New = function(x, y)
return OpenRA.New("CPos", { { x, "Int32" }, { y, "Int32" } })
end
@@ -102,4 +106,4 @@ end
WRange.FromCells = function(cells)
return WRange.New(cells * 1024)
end
end

View File

@@ -2,7 +2,7 @@ Reinforcements = { }
Reinforcements.Insert = function(owner, transportName, passengerNames, enterPath, exitPath)
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
local center = WPos.op_Addition(enterPath[1].CenterPosition, WVec.New(0, 0, Rules.InitialAltitude(transportName)))
local center = WPos.op_Addition(Map.CenterOfCell(enterPath[1]), WVec.New(0, 0, Rules.InitialAltitude(transportName)))
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], CenterPosition = center, Facing = facing })
local cargo = Actor.Trait(transport, "Cargo")
local passengers = { }
@@ -24,7 +24,7 @@ end
Reinforcements.Extract = function(owner, transportName, passengerNames, enterPath, exitPath)
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
local center = WPos.op_Addition(enterPath[1].CenterPosition, WVec.New(0, 0, Rules.InitialAltitude(transportName)))
local center = WPos.op_Addition(Map.CenterOfCell(enterPath[1]), WVec.New(0, 0, Rules.InitialAltitude(transportName)))
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], CenterPosition = center, Facing = facing })
local cargo = Actor.Trait(transport, "Cargo")

View File

@@ -2,10 +2,11 @@ SupportPowers = { }
SupportPowers.Airstrike = function(owner, planeName, enterLocation, bombLocation)
local facing = { Map.GetFacing(CPos.op_Subtraction(bombLocation, enterLocation), 0), "Int32" }
local center = WPos.op_Addition(enterLocation.CenterPosition, WVec.New(0, 0, Rules.InitialAltitude(planeName)))
local center = WPos.op_Addition(Map.CenterOfCell(enterLocation), WVec.New(0, 0, Rules.InitialAltitude(planeName)))
local plane = Actor.Create(planeName, { Location = enterLocation, Owner = owner, Facing = facing, CenterPosition = center })
Actor.Trait(plane, "AttackBomber"):SetTarget(bombLocation.CenterPosition)
Actor.Fly(plane, bombLocation.CenterPosition)
local bombLoc = Map.CenterOfCell(bombLocation)
Actor.Trait(plane, "AttackBomber"):SetTarget(bombLoc)
Actor.Fly(plane, bombLoc)
Actor.FlyOffMap(plane)
Actor.RemoveSelf(plane)
return plane
@@ -13,10 +14,10 @@ end
SupportPowers.Paradrop = function(owner, planeName, passengerNames, enterLocation, dropLocation)
local facing = { Map.GetFacing(CPos.op_Subtraction(dropLocation, enterLocation), 0), "Int32" }
local center = WPos.op_Addition(enterLocation.CenterPosition, WVec.New(0, 0, Rules.InitialAltitude(planeName)))
local center = WPos.op_Addition(Map.CenterOfCell(enterLocation), WVec.New(0, 0, Rules.InitialAltitude(planeName)))
local plane = Actor.Create(planeName, { Location = enterLocation, Owner = owner, Facing = facing, CenterPosition = center })
Actor.FlyAttackCell(plane, dropLocation)
Actor.Trait(plane, "ParaDrop"):SetLZ(dropLocation)
Actor.Trait(plane, "ParaDrop"):SetLZ(dropLocation, true)
local cargo = Actor.Trait(plane, "Cargo")
local passengers = { }
for i, passengerName in ipairs(passengerNames) do
@@ -38,4 +39,4 @@ SupportPowers.Chronoshift = function(unitLocationPairs, chronosphere, duration,
cs:Teleport(unit, cell, duration, killCargo, chronosphere)
end
end)
end
end