InitialAltitude is now part of CenterPositition in Lua, too
followup of #4371
This commit is contained in:
@@ -2,8 +2,8 @@ Reinforcements = { }
|
|||||||
|
|
||||||
Reinforcements.Insert = function(owner, transportName, passengerNames, enterPath, exitPath)
|
Reinforcements.Insert = function(owner, transportName, passengerNames, enterPath, exitPath)
|
||||||
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
|
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
|
||||||
local altitude = { Rules.InitialAltitude(transportName), "Int32" }
|
local center = WPos.op_Addition(enterPath[1].CenterPosition, WVec.New(0, 0, Rules.InitialAltitude(transportName)))
|
||||||
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], Facing = facing, Altitude = altitude })
|
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], CenterPosition = center, Facing = facing })
|
||||||
local cargo = Actor.Trait(transport, "Cargo")
|
local cargo = Actor.Trait(transport, "Cargo")
|
||||||
local passengers = { }
|
local passengers = { }
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ end
|
|||||||
|
|
||||||
Reinforcements.Extract = function(owner, transportName, passengerNames, enterPath, exitPath)
|
Reinforcements.Extract = function(owner, transportName, passengerNames, enterPath, exitPath)
|
||||||
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
|
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
|
||||||
local altitude = { Rules.InitialAltitude(transportName), "Int32" }
|
local center = WPos.op_Addition(enterPath[1].CenterPosition, WVec.New(0, 0, Rules.InitialAltitude(transportName)))
|
||||||
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], Facing = facing, Altitude = altitude })
|
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], CenterPosition = center, Facing = facing })
|
||||||
local cargo = Actor.Trait(transport, "Cargo")
|
local cargo = Actor.Trait(transport, "Cargo")
|
||||||
|
|
||||||
Utils.Do(Utils.Skip(enterPath, 1), function(l) Actor.ScriptedMove(transport, l) end)
|
Utils.Do(Utils.Skip(enterPath, 1), function(l) Actor.ScriptedMove(transport, l) end)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ end
|
|||||||
Rules.InitialAltitude = function(actorType)
|
Rules.InitialAltitude = function(actorType)
|
||||||
local ai = Rules.TraitInfoOrDefault(actorType, "AircraftInfo")
|
local ai = Rules.TraitInfoOrDefault(actorType, "AircraftInfo")
|
||||||
if ai ~= nil then
|
if ai ~= nil then
|
||||||
return ai.CruiseAltitude
|
return ai.CruiseAltitude.Range
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user