Generalize reinforcement insertion / extraction.

This commit is contained in:
Paul Chote
2013-12-20 18:57:29 +13:00
parent 09b694095c
commit 883b014888
3 changed files with 54 additions and 53 deletions

View File

@@ -28,7 +28,19 @@ Actor.MoveNear = function(actor, location, nearEnough)
end
Actor.ScriptedMove = function(actor, location)
actor:QueueActivity(OpenRA.New("Move", { location }))
if Actor.HasTrait(actor, "Helicopter") then
actor:QueueActivity(OpenRA.New("HeliFly", { location.CenterPosition }))
else
actor:QueueActivity(OpenRA.New("Move", { location }))
end
end
Actor.AfterMove = function(actor)
local heli = Actor.TraitOrDefault(actor, "Helicopter")
if heli ~= nil then
Actor.Turn(actor, heli.Info.InitialFacing)
Actor.HeliLand(actor, true)
end
end
Actor.Teleport = function(actor, location)
@@ -173,4 +185,12 @@ end
Actor.TraitInfo = function(actorType, className)
return Internal.TraitInfo(actorType, className)
end
Actor.InitialAltitude = function(actorName)
if Actor.HasTraitInfo("AircraftInfo") then
return Actor.TraitInfo(actorName, "AircraftInfo").CruiseAltitude
end
return 0
end