Guest User

URA0107 Script

a guest
Dec 12th, 2015
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.24 KB | None | 0 0
  1. -- ****************************************************************************
  2. -- **
  3. -- **  File     :  /cdimage/units/URA0107/URA0107_script.lua
  4. -- **  Author(s):  John Comes, David Tomandl
  5. -- **
  6. -- **  Summary  :  Cybran T1 Air Transport Script
  7. -- **
  8. -- **  Copyright © 2006 Gas Powered Games, Inc.  All rights reserved.
  9. -- ****************************************************************************
  10.  
  11. local AirTransport = import('/lua/defaultunits.lua').AirTransport
  12. local explosion = import('/lua/defaultexplosions.lua')
  13. local util = import('/lua/utilities.lua')
  14.  
  15. URA0107 = Class(AirTransport) {
  16.     Weapons = {
  17.     },
  18.  
  19.     AirDestructionEffectBones = { 'Left_Exhaust', 'Right_Exhaust', 'Char04', 'Char03', 'Char02', 'Char01',
  20.                                   'Front_Left_Leg03_B02', 'Front_Right_Leg03_B02', 'Front_Left_Leg01_B02', 'Front_Right_Leg01_B02',
  21.                                   'Right_AttachPoint01', 'Right_AttachPoint02', 'Right_AttachPoint03', 'Right_AttachPoint04',
  22.                                   'Left_AttachPoint01', 'Left_AttachPoint02', 'Left_AttachPoint03', 'Left_AttachPoint04', },
  23.  
  24.     BeamExhaustIdle = '/effects/emitters/missile_exhaust_fire_beam_05_emit.bp',
  25.     BeamExhaustCruise = '/effects/emitters/missile_exhaust_fire_beam_04_emit.bp',
  26.  
  27.     OnStopBeingBuilt = function(self,builder,layer)
  28.         AirTransport.OnStopBeingBuilt(self,builder,layer)
  29.         self.AnimManip = CreateAnimator(self)
  30.         self.Trash:Add(self.AnimManip)
  31.         self.AnimManip:PlayAnim(self:GetBlueprint().Display.AnimationTakeOff, false):SetRate(1)
  32.     end,
  33.  
  34.     OnMotionVertEventChange = function(self, new, old)
  35.         AirTransport.OnMotionVertEventChange(self, new, old)
  36.         -- Aborting a landing
  37.         if ((new == 'Top' or new == 'Up') and old == 'Down') then
  38.             self.AnimManip:SetRate(-1)
  39.         elseif (new == 'Down') then
  40.             self.AnimManip:PlayAnim(self:GetBlueprint().Display.AnimationLand, false):SetRate(1.5)
  41. -- NOTE: We need to add funtionality to fit this guy on the platform            
  42. --         elseif (new == 'Bottom') then
  43. --             self.AnimManip:PlayAnim(self:GetBlueprint().Display.AnimationIdle, true):SetRate(1)
  44.         elseif (new == 'Up') then
  45.             self.AnimManip:PlayAnim(self:GetBlueprint().Display.AnimationTakeOff, false):SetRate(1)
  46.         end
  47.     end,
  48.  
  49.     --  Override air destruction effects so we can do something custom here
  50.     CreateUnitAirDestructionEffects = function( self, scale )
  51.         self:ForkThread(self.AirDestructionEffectsThread, self )
  52.     end,
  53.  
  54.     AirDestructionEffectsThread = function( self )
  55.         local numExplosions = math.floor( table.getn( self.AirDestructionEffectBones ) * 0.5 )
  56.         for i = 0, numExplosions do
  57.             explosion.CreateDefaultHitExplosionAtBone( self, self.AirDestructionEffectBones[util.GetRandomInt( 1, numExplosions )], 0.5 )
  58.             WaitSeconds( util.GetRandomFloat( 0.2, 0.9 ))
  59.         end
  60.     end,    
  61.  
  62.     OnStopBeingBuilt = function(self,builder,layer)
  63.         AirTransport.OnStopBeingBuilt(self,builder,layer)
  64.         self:SetMaintenanceConsumptionInactive()
  65.         self:SetScriptBit('RULEUTC_StealthToggle', true)
  66.         self:RequestRefreshUI()
  67.     end,
  68.    
  69. }
  70.  
  71. TypeClass = URA0107
Advertisement
Add Comment
Please, Sign In to add comment