Ticket #2160: Regicide_v1.7.1.patch
File Regicide_v1.7.1.patch, 10.1 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
498 498 "ExploreMap": "exploreMap", 499 499 "DisableTreasures": "disableTreasures", 500 500 "LockTeams": "lockTeams", 501 "LastManStanding" : "lastManStanding", 501 "LastManStanding": "lastManStanding", 502 "RegicideGarrison": "regicideGarrison", 502 503 "CheatsEnabled": "enableCheats" 503 504 }; 504 505 … … 1183 1184 { 1184 1185 delete g_GameAttributes.settings.WonderDuration; 1185 1186 delete g_GameAttributes.settings.LastManStanding; 1187 delete g_GameAttributes.settings.RegicideGarrison; 1186 1188 } 1187 1189 1188 1190 if (mapSettings.PlayerData) … … 1380 1382 setGUIBoolean("revealMap", "revealMapText", !!mapSettings.RevealMap); 1381 1383 setGUIBoolean("lockTeams", "lockTeamsText", !!mapSettings.LockTeams); 1382 1384 setGUIBoolean("lastManStanding", "lastManStandingText", !!mapSettings.LastManStanding); 1385 setGUIBoolean("regicideGarrison", "regicideGarrisonText", !!mapSettings.RegicideGarrison); 1383 1386 setGUIBoolean("enableRating", "enableRatingText", !!mapSettings.RatingEnabled); 1384 1387 1385 1388 Engine.GetGUIObjectByName("optionWonderDuration").hidden = … … 1386 1389 g_GameAttributes.settings.GameType && 1387 1390 g_GameAttributes.settings.GameType != "wonder"; 1388 1391 Engine.GetGUIObjectByName("optionLastManStanding").hidden = mapSettings.LockTeams; 1392 Engine.GetGUIObjectByName("optionRegicideGarrison").hidden = 1393 g_GameAttributes.settings.GameType && 1394 g_GameAttributes.settings.GameType != "regicide"; 1389 1395 1390 1396 Engine.GetGUIObjectByName("cheatWarningText").hidden = !g_IsNetworked || !mapSettings.CheatsEnabled; 1391 1397 … … 1403 1409 1404 1410 for (let ctrl of ["victoryCondition", "wonderDuration", "populationCap", 1405 1411 "startingResources", "ceasefire", "revealMap", 1406 "exploreMap", "disableTreasures", "lockTeams", "lastManStanding"]) 1412 "exploreMap", "disableTreasures", "lockTeams", 1413 "lastManStanding", "regicideGarrison"]) 1407 1414 hideControl(ctrl, ctrl + "Text", notScenario); 1408 1415 1409 1416 Engine.GetGUIObjectByName("civResetButton").hidden = !notScenario; -
binaries/data/mods/public/gui/gamesetup/gamesetup.xml
335 335 </object> 336 336 </object> 337 337 338 <object name="option PopulationCap" size="14 98 94% 126">338 <object name="optionRegicideGarrison" size="14 98 94% 126"> 339 339 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 340 <translatableAttribute id="caption">Hero Garrison:</translatableAttribute> 341 </object> 342 <object name="regicideGarrisonText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/> 343 <object name="regicideGarrison" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip"> 344 <translatableAttribute id="tooltip">Toggle whether heroes can be garrisoned.</translatableAttribute> 345 </object> 346 </object> 347 348 <object name="optionPopulationCap" size="14 128 94% 156"> 349 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 340 350 <translatableAttribute id="caption">Population Cap:</translatableAttribute> 341 351 </object> 342 352 <object name="populationCapText" size="40% 0 100% 100%" type="text" style="ModernLeftLabelText"/> … … 345 355 </object> 346 356 </object> 347 357 348 <object name="optionStartingResources" size="14 1 28 94% 156">358 <object name="optionStartingResources" size="14 158 94% 186"> 349 359 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 350 360 <translatableAttribute id="caption">Starting Resources:</translatableAttribute> 351 361 </object> … … 355 365 </object> 356 366 </object> 357 367 358 <object name="optionCeasefire" size="14 1 58 94% 186">368 <object name="optionCeasefire" size="14 188 94% 216"> 359 369 <object size="0 0 40% 28" type="text" style="ModernRightLabelText"> 360 370 <translatableAttribute id="caption">Ceasefire:</translatableAttribute> 361 371 </object> … … 440 450 name="hideMoreOptions" 441 451 type="button" 442 452 style="StoneButton" 443 size="50%-70 4 28 50%+70 456"453 size="50%-70 458 50%+70 486" 444 454 tooltip_style="onscreenToolTip" 445 455 hotkey="cancel" 446 456 > -
binaries/data/mods/public/maps/scripts/Regicide.js
6 6 7 7 Trigger.prototype.InitRegicideGame = function(msg) 8 8 { 9 let cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager); 10 this.regicideGarrison = !!cmpEndGameManager.GetGameTypeSettings().regicideGarrison; 11 9 12 let playersCivs = []; 10 13 for (let playerID = 1; playerID < TriggerHelper.GetNumberOfPlayers(); ++playerID) 11 14 playersCivs[playerID] = QueryPlayerIDInterface(playerID).GetCiv(); … … 89 92 90 93 hero = hero[0]; 91 94 95 if (!this.regicideGarrison && !isShip) 96 QueryPlayerIDInterface(playerID).AddDisabledGarrisonClass("Hero"); 97 92 98 if (isShip) 93 99 { 94 100 let cmpUnitAI = Engine.QueryInterface(hero, IID_UnitAI); … … 102 108 return undefined; 103 109 }; 104 110 111 Trigger.prototype.CheckRegicideHeroGarrison = function(data) 112 { 113 if (this.regicideHeroes.indexOf(...data.removed) == -1 || this.regicideGarrison) 114 return; 115 116 QueryOwnerInterface(...data.removed).AddDisabledGarrisonClass("Hero"); 117 }; 118 105 119 let cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 106 120 cmpTrigger.regicideHeroes = []; 121 cmpTrigger.regicideGarrison = false; 107 122 cmpTrigger.DoAfterDelay(0, "InitRegicideGame", {}); 108 123 cmpTrigger.RegisterTrigger("OnOwnershipChanged", "CheckRegicideDefeat", { "enabled": true }); 124 cmpTrigger.RegisterTrigger("OnGarrisonedUnitsChanged", "CheckRegicideHeroGarrison", { "enabled": true }); -
binaries/data/mods/public/simulation/components/GarrisonHolder.js
196 196 if (!this.IsGarrisoningAllowed()) 197 197 return false; 198 198 199 let cmpPlayer = QueryOwnerInterface(entity); 199 200 var cmpIdentity = Engine.QueryInterface(entity, IID_Identity); 200 201 if (!cmpIdentity) 201 202 return false; 202 203 var entityClasses = cmpIdentity.GetClassesList(); 204 if (cmpPlayer && entityClasses.some(className => cmpPlayer.GetDisabledGarrisonClasses().indexOf(className) != -1)) 205 return false; 206 203 207 return MatchesClassList(entityClasses, this.template.List._string); 204 208 }; 205 209 -
binaries/data/mods/public/simulation/components/interfaces/Trigger.js
11 11 * sent from Player component. 12 12 */ 13 13 Engine.RegisterMessageType("DisabledTechnologiesChanged"); 14 15 /** 16 * Message of the form {} 17 * sent from Player component. 18 */ 19 Engine.RegisterMessageType("DisabledGarrisonClassesChanged"); -
binaries/data/mods/public/simulation/components/Player.js
53 53 this.disabledTemplates = {}; 54 54 this.disabledTechnologies = {}; 55 55 this.startingTechnologies = []; 56 this.disabledGarrisonClasses = []; 56 57 }; 57 58 58 59 Player.prototype.SetPlayerID = function(id) … … 853 854 this.startingTechnologies = techs; 854 855 }; 855 856 857 Player.prototype.AddDisabledGarrisonClass = function(className) 858 { 859 if (this.disabledGarrisonClasses.indexOf(className) == -1) 860 this.disabledGarrisonClasses.push(className); 861 Engine.BroadcastMessage(MT_DisabledGarrisonClassesChanged, {}); 862 }; 863 864 Player.prototype.RemoveDisabledGarrisonClasses = function(className) 865 { 866 this.disabledGarrisonClasses.splice(this.disabledGarrisonClasses.indexOf(className), 1); 867 Engine.BroadcastMessage(MT_DisabledGarrisonClassesChanged, {}); 868 }; 869 870 Player.prototype.SetDisabledGarrisonClasses = function(classes) 871 { 872 for (let className of classes) 873 this.disabledGarrisonClasses.push(className); 874 Engine.BroadcastMessage(MT_DisabledGarrisonClassesChanged, {}); 875 }; 876 877 Player.prototype.GetDisabledGarrisonClasses = function() 878 { 879 return this.disabledGarrisonClasses; 880 }; 881 856 882 Engine.RegisterComponentType(IID_Player, "Player", Player); -
binaries/data/mods/public/simulation/components/Trigger.js
11 11 "CinemaPathEnded", 12 12 "CinemaQueueEnded", 13 13 "ConstructionStarted", 14 "GarrisonedUnitsChanged", 14 15 "Interval", 15 16 "OwnershipChanged", 16 17 "PlayerCommand", … … 265 266 this.CallEvent("PlayerWon", msg); 266 267 }; 267 268 269 Trigger.prototype.OnGlobalGarrisonedUnitsChanged = function(msg) 270 { 271 this.CallEvent("GarrisonedUnitsChanged", msg); 272 }; 273 268 274 /** 269 275 * Execute a function after a certain delay. 270 276 * -
binaries/data/mods/public/simulation/helpers/Setup.js
47 47 let gameTypeSettings = {}; 48 48 if (settings.WonderDuration) 49 49 gameTypeSettings.wonderDuration = settings.WonderDuration * 60 * 1000; 50 if (settings.GameType == "regicide") 51 gameTypeSettings.regicideGarrison = settings.RegicideGarrison; 50 52 if (settings.GameType) 51 53 cmpEndGameManager.SetGameType(settings.GameType, gameTypeSettings); 52 54