Ticket #3215: t3215_fix_observer_statusbars.patch
File t3215_fix_observer_statusbars.patch, 2.9 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/session/session.js
809 809 } 810 810 811 811 // Toggles the display of status bars for all of the player's entities. 812 812 function recalculateStatusBarDisplay() 813 813 { 814 if (g_ShowAllStatusBars) 815 var entities = Engine.PickFriendlyEntitiesOnScreen(Engine.GetPlayerID()); 814 if (g_IsObserver) 815 { 816 var entities = []; 817 var numPlayers = GetSimState().players.length; 818 for (let i = 1; i < numPlayers; ++i) 819 entities = entities.concat(Engine.GuiInterfaceCall("GetPlayerEntities", i)); 820 } 816 821 else 817 822 { 818 var selected = g_Selection.toList(); 819 for each (var ent in g_Selection.highlighted) 820 selected.push(ent); 821 822 // Remove selected entities from the 'all entities' array, to avoid disabling their status bars. 823 var entities = Engine.GuiInterfaceCall("GetPlayerEntities").filter( 824 function(idx) { return (selected.indexOf(idx) == -1); } 825 ); 823 if (g_ShowAllStatusBars) 824 var entities = Engine.PickFriendlyEntitiesOnScreen(Engine.GetPlayerID()); 825 else 826 { 827 // Get selected entities 828 var selected = g_Selection.toList(); 829 for each (var ent in g_Selection.highlighted) 830 selected.push(ent); 831 832 // Remove selected entities from the 'all entities' array, to avoid disabling their status bars. 833 entities = Engine.GuiInterfaceCall("GetPlayerEntities").filter( 834 function(idx) { return (selected.indexOf(idx) == -1); } 835 ); 836 } 826 837 } 827 828 838 Engine.GuiInterfaceCall("SetStatusBars", { "entities": entities, "enabled": g_ShowAllStatusBars }); 829 839 } 830 840 831 841 // Update the additional list of entities to be highlighted. 832 842 function updateAdditionalHighlight() -
binaries/data/mods/public/simulation/components/GuiInterface.js
887 887 if (cmpStatusBars) 888 888 cmpStatusBars.RegenerateSprites(); 889 889 } 890 890 }; 891 891 892 GuiInterface.prototype.GetPlayerEntities = function(player) 892 // The player variable will be set to the current player ID automatically. 893 // If you want the entity IDs of another player, use the specificPlayer argument. 894 GuiInterface.prototype.GetPlayerEntities = function(player, specificPlayer) 893 895 { 894 896 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 895 return cmpRangeManager.GetEntitiesByPlayer(player); 897 if (specificPlayer) 898 return cmpRangeManager.GetEntitiesByPlayer(specificPlayer); 899 else 900 return cmpRangeManager.GetEntitiesByPlayer(player); 896 901 }; 897 902 898 903 /** 899 904 * Displays the rally points of a given list of entities (carried in cmd.entities). 900 905 *