78 lines
2.9 KiB
Lua
78 lines
2.9 KiB
Lua
#****************************************************************************
|
|
#**
|
|
#** File : /cdimage/units/LAWARRIORH7/LAWARRIORH7_script.lua
|
|
#** Author(s): John Comes, David Tomandl, Jessica St. Croix, Gordon Duclos, Andres Mendez, Kami, FuegoTigre
|
|
#**
|
|
#** Summary : Warrior H-7 Attack Helicopter Script
|
|
#**
|
|
#** Copyright © 2006 Gas Powered Games, Inc. All rights reserved.
|
|
#****************************************************************************
|
|
|
|
local TAirUnit = import('/lua/terranunits.lua').TAirUnit
|
|
local explosion = import('/lua/defaultexplosions.lua')
|
|
local util = import('/lua/utilities.lua')
|
|
local TDFGaussCannonWeapon = import('/lua/terranweapons.lua').TDFGaussCannonWeapon
|
|
local TSAMLauncher = import('/lua/terranweapons.lua').TSAMLauncher
|
|
|
|
|
|
|
|
|
|
LAWARRIORH7 = Class(TAirUnit) {
|
|
BeamExhaustCruise = '/effects/emitters/transport_thruster_beam_01_emit.bp',
|
|
BeamExhaustIdle = '/effects/emitters/transport_thruster_beam_02_emit.bp',
|
|
|
|
Weapons = {
|
|
AC2 = Class(TDFGaussCannonWeapon) {},
|
|
SRM4 = Class(TSAMLauncher) {},
|
|
},
|
|
|
|
DestructionTicks = 250,
|
|
EngineRotateBones = {'R_Engine', 'L_Engine', },
|
|
|
|
OnStopBeingBuilt = function(self,builder,layer)
|
|
TAirUnit.OnStopBeingBuilt(self,builder,layer)
|
|
self.EngineManipulators = {}
|
|
|
|
# create the engine thrust manipulators
|
|
for k, v in self.EngineRotateBones do
|
|
table.insert(self.EngineManipulators, CreateThrustController(self, "thruster", v))
|
|
end
|
|
|
|
# set up the thursting arcs for the engines
|
|
for keys,values in self.EngineManipulators do
|
|
# XMAX,XMIN,YMAX,YMIN,ZMAX,ZMIN, TURNMULT, TURNSPEED
|
|
values:SetThrustingParam( 0.0, 0.0, -0.1, 0.1, -0.0, 0.0, 1.0, 0.25 )
|
|
end
|
|
|
|
self.LandingAnimManip = CreateAnimator(self)
|
|
self.LandingAnimManip:SetPrecedence(0)
|
|
self.Trash:Add(self.LandingAnimManip)
|
|
self.LandingAnimManip:PlayAnim(self:GetBlueprint().Display.AnimationLand):SetRate(1)
|
|
self:ForkThread(self.ExpandThread)
|
|
end,
|
|
|
|
OnMotionVertEventChange = function(self, new, old)
|
|
TAirUnit.OnMotionVertEventChange(self, new, old)
|
|
if (new == 'Down') then
|
|
self.LandingAnimManip:SetRate(-1)
|
|
elseif (new == 'Up') then
|
|
self.LandingAnimManip:SetRate(1)
|
|
end
|
|
end,
|
|
|
|
# Override air destruction effects so we can do something custom here
|
|
CreateUnitAirDestructionEffects = function( self, scale )
|
|
self:ForkThread(self.AirDestructionEffectsThread, self )
|
|
end,
|
|
|
|
AirDestructionEffectsThread = function( self )
|
|
local numExplosions = math.floor( table.getn( self.AirDestructionEffectBones ) * 0.5 )
|
|
for i = 0, numExplosions do
|
|
explosion.CreateDefaultHitExplosionAtBone( self, self.AirDestructionEffectBones[util.GetRandomInt( 1, numExplosions )], 0.5 )
|
|
WaitSeconds( util.GetRandomFloat( 0.2, 0.9 ))
|
|
end
|
|
end,
|
|
|
|
}
|
|
|
|
TypeClass = LAWARRIORH7 |