Advertisement
Janne252

COH2 Disable unit selection visuals

Apr 25th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. function OnInit()
  2.     g_disabled_selection_visuals = {}
  3.  
  4.     Rule_Add(System_DisableSelectionVisualsTick)
  5. end
  6.  
  7. function Entity_GetUniqueKey(entity)
  8.     return "entity_" .. Entity_GetGameID(entity)
  9. end
  10.  
  11. function System_DisableSelectionVisualsTick()
  12.     for i = 1, World_GetPlayerCount() do
  13.         local player = World_GetPlayerAt(i)
  14.         local sg_squads = Player_GetSquads(player)
  15.         local eg_entities = Player_GetEntities(player)
  16.         SGroup_ForEach(sg_squads, function(sgid, idx, squad)
  17.             for j = 1, Squad_Count(squad) do
  18.                 local entity = Squad_EntityAt(squad, j-1)
  19.                 local entityKey = Entity_GetUniqueKey(entity)
  20.                
  21.                 if not g_disabled_selection_visuals[entityKey] then
  22.                     UI_EnableEntitySelectionVisuals(entity, false)
  23.                     g_disabled_selection_visuals[entityKey] = true
  24.                 end
  25.             end
  26.         end)
  27.        
  28.         EGroup_ForEach(eg_entities, function(egid, idx, entity)
  29.             local entityKey = Entity_GetUniqueKey(entity)
  30.             if not g_disabled_selection_visuals[entityKey] then
  31.                 UI_EnableEntitySelectionVisuals(entity, false)
  32.                 g_disabled_selection_visuals[entityKey] = true
  33.             end    
  34.         end)
  35.     end
  36. end
  37.  
  38. Scar_AddInit(OnInit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement