303 | | |
304 | | // Don't display the options for ourself, or if we or the other player aren't active anymore |
| 303 | |
| 304 | // Attack Request |
| 305 | var simState = GetSimState(); |
| 306 | let button = Engine.GetGUIObjectByName("diplomacyAttackRequest["+(i-1)+"]"); |
| 307 | button.hidden = simState.ceasefireActive || !(g_Players[i].isEnemy[we]); |
| 308 | button.tooltip = translate("Request your allies to attack this enemy"); |
| 309 | button.onpress = (function(i, we){ return function() { |
| 310 | Engine.PostNetworkCommand({"type": "attack-request", "source": we, "target": i}); |
| 311 | } })(i, we); |
| 312 | |
| 313 | // Don't display the options for ourself |
| 322 | |
| 323 | //Don't display tribute options but do display attack options if teams locked and not on our team |
| 324 | if (g_Players[we].teamsLocked && (g_Players[we].team != -1 && g_Players[i].team != -1 && g_Players[i].team != g_Players[we].team)) |
| 325 | { |
| 326 | for each (let a in ["TributeFood", "TributeWood", "TributeStone", "TributeMetal", "Ally", "Neutral", "Enemy"]) |
| 327 | Engine.GetGUIObjectByName("diplomacyPlayer"+a+"["+(i-1)+"]").hidden = true; |
| 328 | Engine.GetGUIObjectByName("diplomacyAttackRequest["+(i-1)+"]").hidden = false; |
| 329 | continue; |
| 330 | } |
351 | | // Attack Request |
352 | | var simState = GetSimState(); |
353 | | let button = Engine.GetGUIObjectByName("diplomacyAttackRequest["+(i-1)+"]"); |
354 | | button.hidden = simState.ceasefireActive || !(g_Players[i].isEnemy[we]); |
355 | | button.tooltip = translate("Request your allies to attack this enemy"); |
356 | | button.onpress = (function(i, we){ return function() { |
357 | | Engine.PostNetworkCommand({"type": "attack-request", "source": we, "target": i}); |
358 | | } })(i, we); |
359 | | |
360 | | // Skip our own teams on teams locked |
361 | | if (g_Players[we].teamsLocked && g_Players[we].team != -1 && g_Players[we].team == g_Players[i].team) |
| 369 | // Skip our own teams and other teams on teams locked |
| 370 | if (g_Players[we].teamsLocked && g_Players[we].team != -1 && g_Players[i].team != -1) |