Advertisement
Guest User

Untitled

a guest
Feb 26th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.95 KB | None | 0 0
  1. UpdateUnitMesh = function(self)
  2.         if self:CanChangeMesh() and not self:BeenDestroyed() then
  3.             if not self:GetUnitParam('FirstTimeMeshChangeDone') then
  4.                 self:SetUnitParam('FirstTimeMeshChangeDone', true)
  5.                 self:AddUnitThread('UpdateFirstUnitMeshChange',{})
  6.             else
  7.                 local bpDisplay = self:GetBlueprintParam('Display')                                                    
  8.                 local CurrentMesh = self:GetCurrentMesh()
  9.                 local IntelMeshes = self:GetIntelMeshes()
  10.                 local Intels = self:GetEnabledIntels()
  11.                 local UnitMeshes = self:GetUnitMeshes()
  12.                 local ChangeMesh = true
  13.                                                
  14.                 if table.getn(UnitMeshes) > 0 then
  15.                     for id, Params in UnitMeshes do
  16.                         local MeshIntelType = Params.inteltype
  17.                                                                
  18.                         if Intels[MeshIntelType] then
  19.                             local Mesh = Params.mesh
  20.                                                                        
  21.                             if Intels[MeshIntelType] then
  22.                                 local Mesh = Params.mesh
  23.                                 local KeepActor = Params.keepactor or true
  24.                                 local ClearStructureIntel = Params.clearstructureintel
  25.                                                    
  26.                                 if Mesh then
  27.                                     if bpDisplay[Mesh] then
  28.                                         if CurrentMesh != MeshIntelType then
  29.                                             self:SetMesh(bpDisplay[Mesh], KeepActor)
  30.                                             self:SetUnitParam('CurrentMesh', MeshIntelType)
  31.                                                
  32.                                             if ClearStructureIntel then
  33.                                                 self:ClearStructureUnitIntel()
  34.                                                 self:SetUnitParam('ClearStructureIntel', true)
  35.                                             end
  36.                                                
  37.                                             ChangeMesh = false
  38.                                             break
  39.                                         else
  40.                                             if CurrentMesh == MeshIntelType then
  41.                                                 ChangeMesh = false
  42.                                                 break
  43.                                             end
  44.                                         end
  45.                                     end
  46.                                 end
  47.                             end
  48.                         end
  49.                     end
  50.                 end
  51.                            
  52.                 if table.getn(IntelMeshes) > 0 then
  53.                     if ChangeMesh then
  54.                         for id, Params in IntelMeshes do
  55.                             local MeshIntelType = Params.inteltype
  56.                                                                                                                        
  57.                             if Intels[MeshIntelType] then
  58.                                 local Mesh = Params.mesh
  59.                                 local KeepActor = Params.keepactor or true
  60.                                 local ClearStructureIntel = Params.clearstructureintel
  61.                                                    
  62.                                 if Mesh then
  63.                                     if bpDisplay[Mesh] then
  64.                                         if CurrentMesh != MeshIntelType then
  65.                                             self:SetMesh(bpDisplay[Mesh], KeepActor)
  66.                                             self:SetUnitParam('CurrentMesh', MeshIntelType)
  67.                                                    
  68.                                             if ClearStructureIntel then
  69.                                                 self:ClearStructureUnitIntel()
  70.                                                 self:SetUnitParam('ClearStructureIntel', true)
  71.                                             end    
  72.                                                    
  73.                                             ChangeMesh = false
  74.                                             break
  75.                                         else
  76.                                             if CurrentMesh == MeshIntelType then
  77.                                                 ChangeMesh = false
  78.                                                 break
  79.                                             end
  80.                                         end
  81.                                     end
  82.                                 end
  83.                             end
  84.                         end
  85.                     end
  86.                 end
  87.  
  88.                 if ChangeMesh and CurrentMesh != 'MeshBlueprint' then
  89.                     self:SetUnitParam('ClearStructureIntel', nil)
  90.                     self:SetMesh(bpDisplay.MeshBlueprint, true)
  91.                     self:SetUnitParam('CurrentMesh', 'MeshBlueprint')
  92.                 end
  93.             end
  94.         end
  95.     end,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement