Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/helpers/InitGame.js
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | if (settings.PlayerData[i] && !!settings.PlayerData[i].AI) | ||||
cmpPlayer.SetAI(true); | cmpPlayer.SetAI(true); | ||||
AIDiff = Math.min(AIDiff, rate.length - 1); | AIDiff = Math.min(AIDiff, rate.length - 1); | ||||
cmpModifiersManager.AddModifiers("AI Bonus", { | cmpModifiersManager.AddModifiers("AI Bonus", { | ||||
"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) | |||||
cmpPlayer.SetMaxPopulation(settings.PopulationCap); | |||||
if (settings.WorldPopulationCap) | |||||
{ | |||||
let popCap = settings.WorldPopulationCap; | |||||
Stan: Gaia?
What if a player with 300 soldiers resigns? | |||||
Done Inline ActionsThen there are 300 GAIA soldiers? Trees and such are also entities so discriminating which entities to count for GAIA and which not is not really feasable, IMHO. Freagarach: Then there are 300 GAIA soldiers? Trees and such are also entities so discriminating which… | |||||
SilierUnsubmitted Done Inline Actionsinline Silier: inline | |||||
let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); | |||||
cmpPlayerManager.SetMaxWorldPopulation(popCap); | |||||
cmpPlayerManager.RedistributeWorldPopulation(); | |||||
} | |||||
} | } | ||||
// 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
Gaia?
What if a player with 300 soldiers resigns?