Ticket #3730: t3730_show_rallypoints_to_observers_v1.patch
File t3730_show_rallypoints_to_observers_v1.patch, 3.9 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/session/messages.js
var g_NotificationsTypes = 234 234 "resetselectionpannel": function(notification, player) 235 235 { 236 236 if (player != Engine.GetPlayerID()) 237 237 return; 238 238 g_Selection.rebuildSelection({}); 239 }, 240 "set-rallypoint": function(notification, player) 241 { 242 // GUI update needed in case another client sent the command 243 // (change-perspective, control-all-units or observer) 244 Engine.GuiInterfaceCall("DisplayRallyPoint", { 245 "entities": notification.entities, 246 "x": notification.x, 247 "z": notification.z, 248 "queued": notification.queued, 249 "isObserver": g_IsObserver 250 }); 251 Engine.GuiInterfaceCall("DisplayRallyPoint", { "entities": g_Selection.toList(), "isObserver": g_IsObserver }); 252 }, 253 "unset-rallypoint": function(notification, player) 254 { 255 Engine.GuiInterfaceCall("DisplayRallyPoint", { "entities": g_Selection.toList(), "isObserver": g_IsObserver }); 239 256 } 240 257 }; 241 258 242 259 /** 243 260 * Loads all known cheat commands. -
binaries/data/mods/public/gui/session/session.js
function onTick() 441 441 g_Selection.dirty = false; 442 442 443 443 onSimulationUpdate(); 444 444 445 445 // Display rally points for selected buildings 446 if (!g_IsObserver) 447 Engine.GuiInterfaceCall("DisplayRallyPoint", { "entities": g_Selection.toList() }); 446 Engine.GuiInterfaceCall("DisplayRallyPoint", { "entities": g_Selection.toList(), "isObserver": g_IsObserver }); 448 447 } 449 448 450 449 updateTimers(); 451 450 452 451 updateMenuPosition(tickLength); -
binaries/data/mods/public/simulation/components/GuiInterface.js
GuiInterface.prototype.DisplayRallyPoint 890 890 if (!cmpRallyPoint) 891 891 continue; 892 892 893 893 // Verify the owner 894 894 let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); 895 if (! (cmpPlayer && cmpPlayer.CanControlAllUnits()))895 if (!cmd.isObserver && !(cmpPlayer && cmpPlayer.CanControlAllUnits())) 896 896 if (!cmpOwnership || cmpOwnership.GetOwner() != player) 897 897 continue; 898 898 899 899 // If the command was passed an explicit position, use that and 900 900 // override the real rally point position; otherwise use the real position -
binaries/data/mods/public/simulation/helpers/Commands.js
var g_Commands = { 393 393 394 394 cmpRallyPoint.AddPosition(cmd.x, cmd.z); 395 395 cmpRallyPoint.AddData(cmd.data); 396 396 } 397 397 } 398 399 var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); 400 cmpGuiInterface.PushNotification({ 401 "type": "set-rallypoint", 402 "players": [player], 403 "entities": cmd.entities, 404 "x": cmd.x, 405 "z": cmd.z, 406 "queued": cmd.queued 407 }); 398 408 }, 399 409 400 410 "unset-rallypoint": function(player, cmd, data) 401 411 { 402 412 for each (var ent in data.entities) 403 413 { 404 414 var cmpRallyPoint = Engine.QueryInterface(ent, IID_RallyPoint); 405 415 if (cmpRallyPoint) 406 416 cmpRallyPoint.Reset(); 407 417 } 418 419 var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); 420 cmpGuiInterface.PushNotification({ 421 "type": "unset-rallypoint", 422 "players": [player], 423 "entities": data.entities 424 }); 408 425 }, 409 426 410 427 "defeat-player": function(player, cmd, data) 411 428 { 412 429 // Send "OnPlayerDefeated" message to player