Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.59 KB | None | 0 0
  1. #****************************************************************************
  2. #**
  3. #** File : /cdimage/units/URL0001/URL0001_script.lua
  4. #** Author(s): John Comes, David Tomandl, Jessica St. Croix, Gordon Duclos, Andres Mendez
  5. #**
  6. #** Summary : Cybran Commander Unit Script
  7. #**
  8. #** Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
  9. #****************************************************************************
  10. local CWalkingLandUnit = import('/lua/cybranunits.lua').CWalkingLandUnit
  11. local CWeapons = import('/lua/cybranweapons.lua')
  12. local EffectUtil = import('/lua/EffectUtilities.lua')
  13. local Buff = import('/lua/sim/Buff.lua')
  14.  
  15. #local CAAMissileNaniteWeapon = CWeapons.CAAMissileNaniteWeapon
  16. local CCannonMolecularWeapon = CWeapons.CCannonMolecularWeapon
  17. local CIFCommanderDeathWeapon = CWeapons.CIFCommanderDeathWeapon
  18. local EffectTemplate = import('/lua/EffectTemplates.lua')
  19. local CDFHeavyMicrowaveLaserGeneratorCom = CWeapons.CDFHeavyMicrowaveLaserGeneratorCom
  20. local CDFOverchargeWeapon = CWeapons.CDFOverchargeWeapon
  21. local CANTorpedoLauncherWeapon = CWeapons.CANTorpedoLauncherWeapon
  22. local Entity = import('/lua/sim/Entity.lua').Entity
  23.  
  24. URL0001 = Class(CWalkingLandUnit) {
  25. DeathThreadDestructionWaitTime = 2,
  26.  
  27. Weapons = {
  28. DeathWeapon = Class(CIFCommanderDeathWeapon) {},
  29. RightRipper = Class(CCannonMolecularWeapon) {},
  30. Torpedo = Class(CANTorpedoLauncherWeapon) {},
  31. MLG = Class(CDFHeavyMicrowaveLaserGeneratorCom) {
  32. DisabledFiringBones = {'Turret_Muzzle_03'},
  33.  
  34. SetOnTransport = function(self, transportstate)
  35. CDFHeavyMicrowaveLaserGeneratorCom.SetOnTransport(self, transportstate)
  36. self:ForkThread(self.OnTransportWatch)
  37. end,
  38.  
  39. OnTransportWatch = function(self)
  40. while self:GetOnTransport() do
  41. self:PlayFxBeamEnd()
  42. self:SetWeaponEnabled(false)
  43. WaitSeconds(0.3)
  44. end
  45. end,
  46. },
  47.  
  48. OverCharge = Class(CDFOverchargeWeapon) {
  49. OnCreate = function(self)
  50. CDFOverchargeWeapon.OnCreate(self)
  51. self:SetWeaponEnabled(false)
  52. self.AimControl:SetEnabled(false)
  53. self.AimControl:SetPrecedence(0)
  54. self.unit:SetOverchargePaused(false)
  55. end,
  56.  
  57. OnEnableWeapon = function(self)
  58. if self:BeenDestroyed() then return end
  59. CDFOverchargeWeapon.OnEnableWeapon(self)
  60. self:SetWeaponEnabled(true)
  61. self.unit:SetWeaponEnabledByLabel('RightRipper', false)
  62. self.unit:BuildManipulatorSetEnabled(false)
  63. self.AimControl:SetEnabled(true)
  64. self.AimControl:SetPrecedence(20)
  65. self.unit.BuildArmManipulator:SetPrecedence(0)
  66. self.AimControl:SetHeadingPitch( self.unit:GetWeaponManipulatorByLabel('RightRipper'):GetHeadingPitch() )
  67. end,
  68.  
  69. OnWeaponFired = function(self)
  70. CDFOverchargeWeapon.OnWeaponFired(self)
  71. self:OnDisableWeapon()
  72. self:ForkThread(self.PauseOvercharge)
  73. end,
  74.  
  75. OnDisableWeapon = function(self)
  76. if self.unit:BeenDestroyed() then return end
  77. self:SetWeaponEnabled(false)
  78. self.unit:SetWeaponEnabledByLabel('RightRipper', true)
  79. self.unit:BuildManipulatorSetEnabled(false)
  80. self.AimControl:SetEnabled(false)
  81. self.AimControl:SetPrecedence(0)
  82. self.unit.BuildArmManipulator:SetPrecedence(0)
  83. self.unit:GetWeaponManipulatorByLabel('RightRipper'):SetHeadingPitch( self.AimControl:GetHeadingPitch() )
  84. end,
  85.  
  86. PauseOvercharge = function(self)
  87. if not self.unit:IsOverchargePaused() then
  88. self.unit:SetOverchargePaused(true)
  89. WaitSeconds(1/self:GetBlueprint().RateOfFire)
  90. self.unit:SetOverchargePaused(false)
  91. end
  92. end,
  93.  
  94. OnFire = function(self)
  95. if not self.unit:IsOverchargePaused() then
  96. CDFOverchargeWeapon.OnFire(self)
  97. end
  98. end,
  99. IdleState = State(CDFOverchargeWeapon.IdleState) {
  100. OnGotTarget = function(self)
  101. if not self.unit:IsOverchargePaused() then
  102. CDFOverchargeWeapon.IdleState.OnGotTarget(self)
  103. end
  104. end,
  105. OnFire = function(self)
  106. if not self.unit:IsOverchargePaused() then
  107. ChangeState(self, self.RackSalvoFiringState)
  108. end
  109. end,
  110. },
  111. RackSalvoFireReadyState = State(CDFOverchargeWeapon.RackSalvoFireReadyState) {
  112. OnFire = function(self)
  113. if not self.unit:IsOverchargePaused() then
  114. CDFOverchargeWeapon.RackSalvoFireReadyState.OnFire(self)
  115. end
  116. end,
  117. },
  118. },
  119. },
  120.  
  121. # ********
  122. # Creation
  123. # ********
  124. OnCreate = function(self)
  125. CWalkingLandUnit.OnCreate(self)
  126. self:SetCapturable(false)
  127. self:HideBone('Back_Upgrade', true)
  128. self:HideBone('Right_Upgrade', true)
  129. if self:GetBlueprint().General.BuildBones then
  130. self:SetupBuildBones()
  131. end
  132. # Restrict what enhancements will enable later
  133. self:AddBuildRestriction( categories.CYBRAN * (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER) )
  134. end,
  135.  
  136.  
  137. OnPrepareArmToBuild = function(self)
  138. CWalkingLandUnit.OnPrepareArmToBuild(self)
  139. if self:BeenDestroyed() then return end
  140. self:BuildManipulatorSetEnabled(true)
  141. self.BuildArmManipulator:SetPrecedence(20)
  142. self:SetWeaponEnabledByLabel('RightRipper', false)
  143. self:SetWeaponEnabledByLabel('OverCharge', false)
  144. self.BuildArmManipulator:SetHeadingPitch( self:GetWeaponManipulatorByLabel('RightRipper'):GetHeadingPitch() )
  145. end,
  146.  
  147. OnStopCapture = function(self, target)
  148. CWalkingLandUnit.OnStopCapture(self, target)
  149. if self:BeenDestroyed() then return end
  150. self:BuildManipulatorSetEnabled(false)
  151. self.BuildArmManipulator:SetPrecedence(0)
  152. self:SetWeaponEnabledByLabel('RightRipper', true)
  153. self:SetWeaponEnabledByLabel('OverCharge', false)
  154. self:GetWeaponManipulatorByLabel('RightRipper'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() )
  155. end,
  156.  
  157. OnFailedCapture = function(self, target)
  158. CWalkingLandUnit.OnFailedCapture(self, target)
  159. if self:BeenDestroyed() then return end
  160. self:BuildManipulatorSetEnabled(false)
  161. self.BuildArmManipulator:SetPrecedence(0)
  162. self:SetWeaponEnabledByLabel('RightRipper', true)
  163. self:SetWeaponEnabledByLabel('OverCharge', false)
  164. self:GetWeaponManipulatorByLabel('RightRipper'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() )
  165. end,
  166.  
  167. OnStopReclaim = function(self, target)
  168. CWalkingLandUnit.OnStopReclaim(self, target)
  169. if self:BeenDestroyed() then return end
  170. self:BuildManipulatorSetEnabled(false)
  171. self.BuildArmManipulator:SetPrecedence(0)
  172. self:SetWeaponEnabledByLabel('RightRipper', true)
  173. self:SetWeaponEnabledByLabel('OverCharge', false)
  174. self:GetWeaponManipulatorByLabel('RightRipper'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() )
  175. end,
  176.  
  177. OnStopBeingBuilt = function(self,builder,layer)
  178. CWalkingLandUnit.OnStopBeingBuilt(self,builder,layer)
  179. self:SetWeaponEnabledByLabel('RightRipper', true)
  180. self:SetWeaponEnabledByLabel('MLG', false)
  181. self:SetWeaponEnabledByLabel('Torpedo', false)
  182. self:SetMaintenanceConsumptionInactive()
  183. self:DisableUnitIntel('RadarStealth')
  184. self:DisableUnitIntel('SonarStealth')
  185. self:DisableUnitIntel('Cloak')
  186. self:DisableUnitIntel('Sonar')
  187. self:HideBone('Back_Upgrade', true)
  188. self:HideBone('Right_Upgrade', true)
  189. self:ForkThread(self.GiveInitialResources)
  190. end,
  191.  
  192. OnFailedToBuild = function(self)
  193. CWalkingLandUnit.OnFailedToBuild(self)
  194. if self:BeenDestroyed() then return end
  195. self:BuildManipulatorSetEnabled(false)
  196. self.BuildArmManipulator:SetPrecedence(0)
  197. self:SetWeaponEnabledByLabel('RightRipper', true)
  198. self:SetWeaponEnabledByLabel('OverCharge', false)
  199. self:GetWeaponManipulatorByLabel('RightRipper'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() )
  200. end,
  201.  
  202. OnStartBuild = function(self, unitBeingBuilt, order)
  203. CWalkingLandUnit.OnStartBuild(self, unitBeingBuilt, order)
  204. self.UnitBeingBuilt = unitBeingBuilt
  205. self.UnitBuildOrder = order
  206. self.BuildingUnit = true
  207. end,
  208.  
  209. OnStopBuild = function(self, unitBeingBuilt)
  210. CWalkingLandUnit.OnStopBuild(self, unitBeingBuilt)
  211. if self:BeenDestroyed() then return end
  212. self:BuildManipulatorSetEnabled(false)
  213. self.BuildArmManipulator:SetPrecedence(0)
  214. self:SetWeaponEnabledByLabel('RightRipper', true)
  215. self:SetWeaponEnabledByLabel('OverCharge', false)
  216. self:GetWeaponManipulatorByLabel('RightRipper'):SetHeadingPitch( self.BuildArmManipulator:GetHeadingPitch() )
  217. self.UnitBeingBuilt = nil
  218. self.UnitBuildOrder = nil
  219. self.BuildingUnit = false
  220. end,
  221.  
  222. PlayCommanderWarpInEffect = function(self)
  223. self:HideBone(0, true)
  224. self:SetUnSelectable(true)
  225. self:SetBusy(true)
  226. self:SetBlockCommandQueue(true)
  227. self:ForkThread(self.WarpInEffectThread)
  228. end,
  229.  
  230. WarpInEffectThread = function(self)
  231. self:PlayUnitSound('CommanderArrival')
  232. self:CreateProjectile( '/effects/entities/UnitTeleport01/UnitTeleport01_proj.bp', 0, 1.35, 0, nil, nil, nil):SetCollision(false)
  233. WaitSeconds(2.1)
  234. self:SetMesh('/units/url0001/URL0001_PhaseShield_mesh', true)
  235. self:ShowBone(0, true)
  236. self:HideBone('Back_Upgrade', true)
  237. self:HideBone('Right_Upgrade', true)
  238. self:SetUnSelectable(false)
  239. self:SetBusy(false)
  240. self:SetBlockCommandQueue(false)
  241.  
  242. local totalBones = self:GetBoneCount() - 1
  243. local army = self:GetArmy()
  244. for k, v in EffectTemplate.UnitTeleportSteam01 do
  245. for bone = 1, totalBones do
  246. CreateAttachedEmitter(self,bone,army, v)
  247. end
  248. end
  249.  
  250. WaitSeconds(6)
  251. self:SetMesh(self:GetBlueprint().Display.MeshBlueprint, true)
  252. end,
  253.  
  254. GiveInitialResources = function(self)
  255. WaitTicks(2)
  256. self:GetAIBrain():GiveResource('Energy', self:GetBlueprint().Economy.StorageEnergy)
  257. self:GetAIBrain():GiveResource('Mass', self:GetBlueprint().Economy.StorageMass)
  258. end,
  259.  
  260.  
  261.  
  262. OnScriptBitSet = function(self, bit)
  263. if bit == 8 then # cloak toggle
  264. self:StopUnitAmbientSound( 'ActiveLoop' )
  265. self:SetMaintenanceConsumptionInactive()
  266. self:DisableUnitIntel('Cloak')
  267. self:DisableUnitIntel('RadarStealth')
  268. self:DisableUnitIntel('RadarStealthField')
  269. self:DisableUnitIntel('SonarStealth')
  270. self:DisableUnitIntel('SonarStealthField')
  271. end
  272. end,
  273.  
  274. OnScriptBitClear = function(self, bit)
  275. if bit == 8 then # cloak toggle
  276. self:PlayUnitAmbientSound( 'ActiveLoop' )
  277. self:SetMaintenanceConsumptionActive()
  278. self:EnableUnitIntel('Cloak')
  279. self:EnableUnitIntel('RadarStealth')
  280. self:EnableUnitIntel('RadarStealthField')
  281. self:EnableUnitIntel('SonarStealth')
  282. self:EnableUnitIntel('SonarStealthField')
  283. end
  284. end,
  285.  
  286.  
  287.  
  288. # *************
  289. # Build/Upgrade
  290. # *************
  291. CreateBuildEffects = function( self, unitBeingBuilt, order )
  292. EffectUtil.SpawnBuildBots( self, unitBeingBuilt, 5, self.BuildEffectsBag )
  293. EffectUtil.CreateCybranBuildBeams( self, unitBeingBuilt, self:GetBlueprint().General.BuildBones.BuildEffectBones, self.BuildEffectsBag )
  294. end,
  295.  
  296. CreateEnhancement = function(self, enh)
  297. CWalkingLandUnit.CreateEnhancement(self, enh)
  298. if enh == 'Teleporter' then
  299. self:AddCommandCap('RULEUCC_Teleport')
  300. elseif enh == 'TeleporterRemove' then
  301. RemoveUnitEnhancement(self, 'Teleporter')
  302. RemoveUnitEnhancement(self, 'TeleporterRemove')
  303. self:RemoveCommandCap('RULEUCC_Teleport')
  304. elseif enh == 'StealthGenerator' then
  305. self:AddToggleCap('RULEUTC_CloakToggle')
  306. if self.IntelEffectsBag then
  307. EffectUtil.CleanupEffectBag(self,'IntelEffectsBag')
  308. self.IntelEffectsBag = nil
  309. end
  310. self.CloakEnh = false
  311. self.StealthEnh = true
  312. self:EnableUnitIntel('RadarStealth')
  313. self:EnableUnitIntel('SonarStealth')
  314. elseif enh == 'StealthGeneratorRemove' then
  315. self:RemoveToggleCap('RULEUTC_CloakToggle')
  316. self:DisableUnitIntel('RadarStealth')
  317. self:DisableUnitIntel('SonarStealth')
  318. self.StealthEnh = false
  319. self.CloakEnh = false
  320. self.StealthFieldEffects = false
  321. self.CloakingEffects = false
  322. elseif enh == 'ResourceAllocation' then
  323. local bp = self:GetBlueprint().Enhancements[enh]
  324. local bpEcon = self:GetBlueprint().Economy
  325. if not bp then return end
  326. self:SetProductionPerSecondEnergy(bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy or 0)
  327. self:SetProductionPerSecondMass(bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass or 0)
  328. elseif enh == 'ResourceAllocationRemove' then
  329. local bpEcon = self:GetBlueprint().Economy
  330. self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0)
  331. self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0)
  332. elseif enh == 'CloakingGenerator' then
  333. local bp = self:GetBlueprint().Enhancements[enh]
  334. if not bp then return end
  335. self.StealthEnh = false
  336. self.CloakEnh = true
  337. self:EnableUnitIntel('Cloak')
  338. if not Buffs['CybranACUCloakBonus'] then
  339. BuffBlueprint {
  340. Name = 'CybranACUCloakBonus',
  341. DisplayName = 'CybranACUCloakBonus',
  342. BuffType = 'ACUCLOAKBONUS',
  343. Stacks = 'ALWAYS',
  344. Duration = -1,
  345. Affects = {
  346. MaxHealth = {
  347. Add = bp.NewHealth,
  348. Mult = 1.0,
  349. },
  350. },
  351. }
  352. end
  353. if Buff.HasBuff( self, 'CybranACUCloakBonus' ) then
  354. Buff.RemoveBuff( self, 'CybranACUCloakBonus' )
  355. end
  356. Buff.ApplyBuff(self, 'CybranACUCloakBonus')
  357. elseif enh == 'CloakingGeneratorRemove' then
  358. self:RemoveToggleCap('RULEUTC_CloakToggle')
  359. self:DisableUnitIntel('Cloak')
  360. self.CloakEnh = false
  361. if Buff.HasBuff( self, 'CybranACUCloakBonus' ) then
  362. Buff.RemoveBuff( self, 'CybranACUCloakBonus' )
  363. end
  364. #T2 Engineering
  365. elseif enh =='AdvancedEngineering' then
  366. local bp = self:GetBlueprint().Enhancements[enh]
  367. if not bp then return end
  368. local cat = ParseEntityCategory(bp.BuildableCategoryAdds)
  369. self:RemoveBuildRestriction(cat)
  370. if not Buffs['CybranACUT2BuildRate'] then
  371. BuffBlueprint {
  372. Name = 'CybranACUT2BuildRate',
  373. DisplayName = 'CybranACUT2BuildRate',
  374. BuffType = 'ACUBUILDRATE',
  375. Stacks = 'REPLACE',
  376. Duration = -1,
  377. Affects = {
  378. BuildRate = {
  379. Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate,
  380. Mult = 1,
  381. },
  382. MaxHealth = {
  383. Add = bp.NewHealth,
  384. Mult = 1.0,
  385. },
  386. Regen = {
  387. Add = bp.NewRegenRate,
  388. Mult = 1.0,
  389. },
  390. },
  391. }
  392. end
  393. Buff.ApplyBuff(self, 'CybranACUT2BuildRate')
  394. elseif enh =='AdvancedEngineeringRemove' then
  395. local bp = self:GetBlueprint().Economy.BuildRate
  396. if not bp then return end
  397. self:RestoreBuildRestrictions()
  398. self:AddBuildRestriction( categories.CYBRAN * (categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER) )
  399. if Buff.HasBuff( self, 'CybranACUT2BuildRate' ) then
  400. Buff.RemoveBuff( self, 'CybranACUT2BuildRate' )
  401. end
  402. #T3 Engineering
  403. elseif enh =='T3Engineering' then
  404. local bp = self:GetBlueprint().Enhancements[enh]
  405. if not bp then return end
  406. local cat = ParseEntityCategory(bp.BuildableCategoryAdds)
  407. self:RemoveBuildRestriction(cat)
  408. if not Buffs['CybranACUT3BuildRate'] then
  409. BuffBlueprint {
  410. Name = 'CybranACUT3BuildRate',
  411. DisplayName = 'CybranCUT3BuildRate',
  412. BuffType = 'ACUBUILDRATE',
  413. Stacks = 'REPLACE',
  414. Duration = -1,
  415. Affects = {
  416. BuildRate = {
  417. Add = bp.NewBuildRate - self:GetBlueprint().Economy.BuildRate,
  418. Mult = 1,
  419. },
  420. MaxHealth = {
  421. Add = bp.NewHealth,
  422. Mult = 1.0,
  423. },
  424. Regen = {
  425. Add = bp.NewRegenRate,
  426. Mult = 1.0,
  427. },
  428. },
  429. }
  430. end
  431. Buff.ApplyBuff(self, 'CybranACUT3BuildRate')
  432. elseif enh =='T3EngineeringRemove' then
  433. local bp = self:GetBlueprint().Economy.BuildRate
  434. if not bp then return end
  435. self:RestoreBuildRestrictions()
  436. if Buff.HasBuff( self, 'CybranACUT3BuildRate' ) then
  437. Buff.RemoveBuff( self, 'CybranACUT3BuildRate' )
  438. end
  439. self:AddBuildRestriction( categories.CYBRAN * ( categories.BUILTBYTIER2COMMANDER + categories.BUILTBYTIER3COMMANDER) )
  440. elseif enh =='CoolingUpgrade' then
  441. local bp = self:GetBlueprint().Enhancements[enh]
  442. local wep = self:GetWeaponByLabel('RightRipper')
  443. wep:ChangeMaxRadius(bp.NewMaxRadius or 44)
  444. wep:ChangeRateOfFire(bp.NewRateOfFire or 2)
  445. wep:AddDamageMod(bp.ZephyrDamageMod)
  446. local microwave = self:GetWeaponByLabel('MLG')
  447. microwave:ChangeMaxRadius(bp.NewMaxRadius or 44)
  448. local oc = self:GetWeaponByLabel('OverCharge')
  449. oc:ChangeMaxRadius(bp.NewMaxRadius or 44)
  450. elseif enh == 'CoolingUpgradeRemove' then
  451. local wep = self:GetWeaponByLabel('RightRipper')
  452. local bpDisrupt = self:GetBlueprint().Weapon[1].RateOfFire
  453. wep:ChangeRateOfFire(bpDisrupt or 1)
  454. bpDisrupt = self:GetBlueprint().Weapon[1].MaxRadius
  455. wep:ChangeMaxRadius(bpDisrupt or 22)
  456. local microwave = self:GetWeaponByLabel('MLG')
  457. microwave:ChangeMaxRadius(bpDisrupt or 22)
  458. local oc = self:GetWeaponByLabel('OverCharge')
  459. oc:ChangeMaxRadius(bpDisrupt or 22)
  460. elseif enh == 'MicrowaveLaserGenerator' then
  461. self:SetWeaponEnabledByLabel('MLG', true)
  462. elseif enh == 'MicrowaveLaserGeneratorRemove' then
  463. self:SetWeaponEnabledByLabel('MLG', false)
  464. elseif enh == 'NaniteTorpedoTube' then
  465. self:SetWeaponEnabledByLabel('Torpedo', true)
  466. self:EnableUnitIntel('Sonar')
  467. elseif enh == 'NaniteTorpedoTubeRemove' then
  468. self:SetWeaponEnabledByLabel('Torpedo', false)
  469. self:DisableUnitIntel('Sonar')
  470. end
  471. end,
  472.  
  473. # **********
  474. # Intel
  475. # **********
  476. IntelEffects = {
  477. Cloak = {
  478. {
  479. Bones = {
  480. 'Head',
  481. 'Right_Turret',
  482. 'Left_Turret',
  483. 'Right_Arm_B01',
  484. 'Left_Arm_B01',
  485. 'Chest_Right',
  486. 'Chest_Left',
  487. 'Left_Leg_B01',
  488. 'Left_Leg_B02',
  489. 'Left_Foot_B01',
  490. 'Right_Leg_B01',
  491. 'Right_Leg_B02',
  492. 'Right_Foot_B01',
  493. },
  494. Scale = 1.0,
  495. Type = 'Cloak01',
  496. },
  497. },
  498. Field = {
  499. {
  500. Bones = {
  501. 'Head',
  502. 'Right_Turret',
  503. 'Left_Turret',
  504. 'Right_Arm_B01',
  505. 'Left_Arm_B01',
  506. 'Chest_Right',
  507. 'Chest_Left',
  508. 'Left_Leg_B01',
  509. 'Left_Leg_B02',
  510. 'Left_Foot_B01',
  511. 'Right_Leg_B01',
  512. 'Right_Leg_B02',
  513. 'Right_Foot_B01',
  514. },
  515. Scale = 1.6,
  516. Type = 'Cloak01',
  517. },
  518. },
  519. },
  520.  
  521. OnIntelEnabled = function(self)
  522. CWalkingLandUnit.OnIntelEnabled(self)
  523. if self.CloakEnh and self:IsIntelEnabled('Cloak') then
  524. self:SetEnergyMaintenanceConsumptionOverride(self:GetBlueprint().Enhancements['CloakingGenerator'].MaintenanceConsumptionPerSecondEnergy or 0)
  525. self:SetMaintenanceConsumptionActive()
  526. if not self.IntelEffectsBag then
  527. self.IntelEffectsBag = {}
  528. self.CreateTerrainTypeEffects( self, self.IntelEffects.Cloak, 'FXIdle', self:GetCurrentLayer(), nil, self.IntelEffectsBag )
  529. end
  530. elseif self.StealthEnh and self:IsIntelEnabled('RadarStealth') and self:IsIntelEnabled('SonarStealth') then
  531. self:SetEnergyMaintenanceConsumptionOverride(self:GetBlueprint().Enhancements['StealthGenerator'].MaintenanceConsumptionPerSecondEnergy or 0)
  532. self:SetMaintenanceConsumptionActive()
  533. if not self.IntelEffectsBag then
  534. self.IntelEffectsBag = {}
  535. self.CreateTerrainTypeEffects( self, self.IntelEffects.Field, 'FXIdle', self:GetCurrentLayer(), nil, self.IntelEffectsBag )
  536. end
  537. end
  538. end,
  539.  
  540. OnIntelDisabled = function(self)
  541. CWalkingLandUnit.OnIntelDisabled(self)
  542. if self.IntelEffectsBag then
  543. EffectUtil.CleanupEffectBag(self,'IntelEffectsBag')
  544. self.IntelEffectsBag = nil
  545. end
  546. if self.CloakEnh and not self:IsIntelEnabled('Cloak') then
  547. self:SetMaintenanceConsumptionInactive()
  548. elseif self.StealthEnh and not self:IsIntelEnabled('RadarStealth') and not self:IsIntelEnabled('SonarStealth') then
  549. self:SetMaintenanceConsumptionInactive()
  550. end
  551. end,
  552.  
  553. # *****
  554. # Death
  555. # *****
  556. OnKilled = function(self, instigator, type, overkillRatio)
  557. local bp
  558. for k, v in self:GetBlueprint().Buffs do
  559. if v.Add.OnDeath then
  560. bp = v
  561. end
  562. end
  563. #if we could find a blueprint with v.Add.OnDeath, then add the buff
  564. if bp != nil then
  565. #Apply Buff
  566. self:AddBuff(bp)
  567. end
  568. #otherwise, we should finish killing the unit
  569. CWalkingLandUnit.OnKilled(self, instigator, type, overkillRatio)
  570. end,
  571.  
  572. OnPaused = function(self)
  573. CWalkingLandUnit.OnPaused(self)
  574. if self.BuildingUnit then
  575. CWalkingLandUnit.StopBuildingEffects(self, self:GetUnitBeingBuilt())
  576. end
  577. end,
  578.  
  579. OnUnpaused = function(self)
  580. if self.BuildingUnit then
  581. CWalkingLandUnit.StartBuildingEffects(self, self:GetUnitBeingBuilt(), self.UnitBuildOrder)
  582. end
  583. CWalkingLandUnit.OnUnpaused(self)
  584. end,
  585. }
  586.  
  587. TypeClass = URL0001
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement