Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/InitGame.js
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if (settings.PlayerData[i] && !!settings.PlayerData[i].AI) | ||||
"ResourceGatherer/BaseSpeed": [{ "affects": ["Unit", "Structure"], "multiply": rate[AIDiff] }], | "ResourceGatherer/BaseSpeed": [{ "affects": ["Unit", "Structure"], "multiply": rate[AIDiff] }], | ||||
"Trader/GainMultiplier": [{ "affects": ["Unit", "Structure"], "multiply": rate[AIDiff] }], | "Trader/GainMultiplier": [{ "affects": ["Unit", "Structure"], "multiply": rate[AIDiff] }], | ||||
"Cost/BuildTime": [{ "affects": ["Unit", "Structure"], "multiply": time[AIDiff] }], | "Cost/BuildTime": [{ "affects": ["Unit", "Structure"], "multiply": time[AIDiff] }], | ||||
}, cmpPlayer.entity); | }, cmpPlayer.entity); | ||||
} | } | ||||
if (settings.PopulationCap) | if (settings.PopulationCap) | ||||
cmpPlayer.SetMaxPopulation(settings.PopulationCap); | cmpPlayer.SetMaxPopulation(settings.PopulationCap); | ||||
if (settings.AllyView) | |||||
Engine.QueryInterface(cmpPlayer.entity, IID_TechnologyManager)?.ResearchTechnology(cmpPlayer.template.SharedLosTech); | |||||
} | } | ||||
if (settings.WorldPopulationCap) | if (settings.WorldPopulationCap) | ||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).SetMaxWorldPopulation(settings.WorldPopulationCap); | Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).SetMaxWorldPopulation(settings.WorldPopulationCap); | ||||
// Update the grid with all entities created for the map init. | // Update the grid with all entities created for the map init. | ||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_Pathfinder).UpdateGrid(); | Engine.QueryInterface(SYSTEM_ENTITY, IID_Pathfinder).UpdateGrid(); | ||||
// Map or player data (handicap...) dependent initialisations of components (i.e. garrisoned units). | // Map or player data (handicap...) dependent initialisations of components (i.e. garrisoned units). | ||||
Engine.BroadcastMessage(MT_InitGame, {}); | Engine.BroadcastMessage(MT_InitGame, {}); | ||||
cmpAIManager.TryLoadSharedComponent(); | cmpAIManager.TryLoadSharedComponent(); | ||||
cmpAIManager.RunGamestateInit(); | cmpAIManager.RunGamestateInit(); | ||||
} | } | ||||
Engine.RegisterGlobal("PreInitGame", PreInitGame); | Engine.RegisterGlobal("PreInitGame", PreInitGame); | ||||
Engine.RegisterGlobal("InitGame", InitGame); | Engine.RegisterGlobal("InitGame", InitGame); |
Wildfire Games · Phabricator