Merge pull request #4395 from Mailaender/lua-reinforce-fix

Fixed NLua.Exceptions.LuaScriptException: [string "mods/common/lua/openra.lua"]:9
This commit is contained in:
Paul Chote
2013-12-30 18:51:40 -08:00
2 changed files with 5 additions and 5 deletions

View File

@@ -2,8 +2,8 @@ Reinforcements = { }
Reinforcements.Insert = function(owner, transportName, passengerNames, enterPath, exitPath)
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
local altitude = { Rules.InitialAltitude(transportName), "Int32" }
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], Facing = facing, Altitude = altitude })
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], CenterPosition = center, Facing = facing })
local cargo = Actor.Trait(transport, "Cargo")
local passengers = { }
@@ -24,8 +24,8 @@ end
Reinforcements.Extract = function(owner, transportName, passengerNames, enterPath, exitPath)
local facing = { Map.GetFacing(CPos.op_Subtraction(enterPath[2], enterPath[1]), 0), "Int32" }
local altitude = { Rules.InitialAltitude(transportName), "Int32" }
local transport = Actor.Create(transportName, { Owner = owner, Location = enterPath[1], Facing = facing, Altitude = altitude })
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], CenterPosition = center, Facing = facing })
local cargo = Actor.Trait(transport, "Cargo")
Utils.Do(Utils.Skip(enterPath, 1), function(l) Actor.ScriptedMove(transport, l) end)

View File

@@ -15,7 +15,7 @@ end
Rules.InitialAltitude = function(actorType)
local ai = Rules.TraitInfoOrDefault(actorType, "AircraftInfo")
if ai ~= nil then
return ai.CruiseAltitude
return ai.CruiseAltitude.Range
end
return 0
end