Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Player.js
Show First 20 Lines • Show All 733 Lines • ▼ Show 20 Lines | Player.prototype.OnGlobalInitGame = function(msg) | ||||
// Replace the "{civ}" code with this civ ID | // Replace the "{civ}" code with this civ ID | ||||
let disabledTemplates = this.disabledTemplates; | let disabledTemplates = this.disabledTemplates; | ||||
this.disabledTemplates = {}; | this.disabledTemplates = {}; | ||||
for (let template in disabledTemplates) | for (let template in disabledTemplates) | ||||
if (disabledTemplates[template]) | if (disabledTemplates[template]) | ||||
this.disabledTemplates[template.replace(/\{civ\}/g, this.civ)] = true; | this.disabledTemplates[template.replace(/\{civ\}/g, this.civ)] = true; | ||||
}; | }; | ||||
Player.prototype.OnGlobalPlayerDefeated = function(msg) | |||||
{ | |||||
let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); | |||||
let worldPopulation = cmpPlayerManager.GetMaxWorldPopulation(); | |||||
if (worldPopulation) | |||||
this.SetMaxPopulation(worldPopulation / cmpPlayerManager.GetActivePlayers().length); | |||||
}; | |||||
Stan: Maybe this operation could be in PlayerManager instead? | |||||
Done Inline ActionsYeah, sounds about right, will try that. Freagarach: Yeah, sounds about right, will try that. | |||||
/** | /** | ||||
* Keep track of population effects of all entities that | * Keep track of population effects of all entities that | ||||
* become owned or unowned by this player | * become owned or unowned by this player | ||||
*/ | */ | ||||
Player.prototype.OnGlobalOwnershipChanged = function(msg) | Player.prototype.OnGlobalOwnershipChanged = function(msg) | ||||
{ | { | ||||
if (msg.from != this.playerID && msg.to != this.playerID) | if (msg.from != this.playerID && msg.to != this.playerID) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Maybe this operation could be in PlayerManager instead?