forked from 0ad/0ad
Check if components exist before using them.
Remove EntityLimits and TechnologyManager from the gaia player template. This was SVN commit r16120.
This commit is contained in:
parent
4243433f94
commit
bd31f83587
@ -56,14 +56,17 @@ GuiInterface.prototype.GetSimulationState = function(player)
|
||||
var cmpPlayer = Engine.QueryInterface(playerEnt, IID_Player);
|
||||
|
||||
// Work out what phase we are in
|
||||
var cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager);
|
||||
var phase = "";
|
||||
if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|
||||
phase = "city";
|
||||
else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|
||||
phase = "town";
|
||||
else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|
||||
phase = "village";
|
||||
var cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager);
|
||||
if (cmpTechnologyManager)
|
||||
{
|
||||
if (cmpTechnologyManager.IsTechnologyResearched("phase_city"))
|
||||
phase = "city";
|
||||
else if (cmpTechnologyManager.IsTechnologyResearched("phase_town"))
|
||||
phase = "town";
|
||||
else if (cmpTechnologyManager.IsTechnologyResearched("phase_village"))
|
||||
phase = "village";
|
||||
}
|
||||
|
||||
// store player ally/neutral/enemy data as arrays
|
||||
var allies = [];
|
||||
@ -91,20 +94,20 @@ GuiInterface.prototype.GetSimulationState = function(player)
|
||||
"team": cmpPlayer.GetTeam(),
|
||||
"teamsLocked": cmpPlayer.GetLockTeams(),
|
||||
"cheatsEnabled": cmpPlayer.GetCheatsEnabled(),
|
||||
"disabledTemplates": cmpPlayer.GetDisabledTemplates(),
|
||||
"phase": phase,
|
||||
"isAlly": allies,
|
||||
"isMutualAlly": mutualAllies,
|
||||
"isNeutral": neutrals,
|
||||
"isEnemy": enemies,
|
||||
"entityLimits": cmpPlayerEntityLimits.GetLimits(),
|
||||
"entityCounts": cmpPlayerEntityLimits.GetCounts(),
|
||||
"entityLimitChangers": cmpPlayerEntityLimits.GetLimitChangers(),
|
||||
"disabledTemplates": cmpPlayer.GetDisabledTemplates(),
|
||||
"researchQueued": cmpTechnologyManager.GetQueuedResearch(),
|
||||
"researchStarted": cmpTechnologyManager.GetStartedResearch(),
|
||||
"researchedTechs": cmpTechnologyManager.GetResearchedTechs(),
|
||||
"classCounts": cmpTechnologyManager.GetClassCounts(),
|
||||
"typeCountsByClass": cmpTechnologyManager.GetTypeCountsByClass()
|
||||
"entityLimits": cmpPlayerEntityLimits ? cmpPlayerEntityLimits.GetLimits() : null,
|
||||
"entityCounts": cmpPlayerEntityLimits ? cmpPlayerEntityLimits.GetCounts() : null,
|
||||
"entityLimitChangers": cmpPlayerEntityLimits ? cmpPlayerEntityLimits.GetLimitChangers() : null,
|
||||
"researchQueued": cmpTechnologyManager ? cmpTechnologyManager.GetQueuedResearch() : null,
|
||||
"researchStarted": cmpTechnologyManager ? cmpTechnologyManager.GetStartedResearch() : null,
|
||||
"researchedTechs": cmpTechnologyManager ? cmpTechnologyManager.GetResearchedTechs() : null,
|
||||
"classCounts": cmpTechnologyManager ? cmpTechnologyManager.GetClassCounts() : null,
|
||||
"typeCountsByClass": cmpTechnologyManager ? cmpTechnologyManager.GetTypeCountsByClass() : null
|
||||
};
|
||||
ret.players.push(playerData);
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity>
|
||||
<EntityLimits>
|
||||
<Limits/>
|
||||
<LimitChangers/>
|
||||
<LimitRemovers/>
|
||||
</EntityLimits>
|
||||
<Player/>
|
||||
<TechnologyManager/>
|
||||
</Entity>
|
||||
|
Loading…
Reference in New Issue
Block a user