Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/helpers/Setup.js
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | function LoadMapSettings(settings) | ||||
if (gameSettings.victoryConditions.indexOf("regicide") != -1) | if (gameSettings.victoryConditions.indexOf("regicide") != -1) | ||||
gameSettings.regicideGarrison = settings.RegicideGarrison; | gameSettings.regicideGarrison = settings.RegicideGarrison; | ||||
cmpEndGameManager.SetGameSettings(gameSettings); | cmpEndGameManager.SetGameSettings(gameSettings); | ||||
cmpEndGameManager.SetAlliedVictory(settings.LockTeams || !settings.LastManStanding); | cmpEndGameManager.SetAlliedVictory(settings.LockTeams || !settings.LastManStanding); | ||||
if (settings.LockTeams && settings.LastManStanding) | if (settings.LockTeams && settings.LastManStanding) | ||||
warn("Last man standing is only available in games with unlocked teams!"); | warn("Last man standing is only available in games with unlocked teams!"); | ||||
let cmpCaptureManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_CaptureManager); | |||||
cmpCaptureManager.SetCapturableGame(settings.Capturable); | |||||
cmpCaptureManager.SetWonderVictory(gameSettings.victoryConditions.indexOf("wonder") != -1); | |||||
cmpCaptureManager.SetRelicVictory(gameSettings.victoryConditions.indexOf("capture_the_relic") != -1); | |||||
elexis: The scripts should be agnostic of the victory conditions that may exist. Instead it there would… | |||||
if (settings.Garrison) | if (settings.Garrison) | ||||
for (let holder in settings.Garrison) | for (let holder in settings.Garrison) | ||||
{ | { | ||||
let cmpGarrisonHolder = Engine.QueryInterface(+holder, IID_GarrisonHolder); | let cmpGarrisonHolder = Engine.QueryInterface(+holder, IID_GarrisonHolder); | ||||
if (!cmpGarrisonHolder) | if (!cmpGarrisonHolder) | ||||
warn("Map error in Setup.js: entity " + holder + " can not garrison units"); | warn("Map error in Setup.js: entity " + holder + " can not garrison units"); | ||||
else | else | ||||
cmpGarrisonHolder.initGarrison = settings.Garrison[holder]; | cmpGarrisonHolder.initGarrison = settings.Garrison[holder]; | ||||
} | } | ||||
let cmpCeasefireManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_CeasefireManager); | let cmpCeasefireManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_CeasefireManager); | ||||
if (settings.Ceasefire) | if (settings.Ceasefire) | ||||
cmpCeasefireManager.StartCeasefire(settings.Ceasefire * 60 * 1000); | cmpCeasefireManager.StartCeasefire(settings.Ceasefire * 60 * 1000); | ||||
} | } | ||||
Engine.RegisterGlobal("LoadMapSettings", LoadMapSettings); | Engine.RegisterGlobal("LoadMapSettings", LoadMapSettings); |
Wildfire Games · Phabricator
The scripts should be agnostic of the victory conditions that may exist. Instead it there would have to be a property in the victory type json file that restricts which identity classes must be capturable regardless of the gamesetup option.