Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GuiInterface.js
function GuiInterface() {} | function GuiInterface() {} | ||||
elexis: `fi`? | |||||
GuiInterface.prototype.Schema = | GuiInterface.prototype.Schema = | ||||
"<a:component type='system'/><empty/>"; | "<a:component type='system'/><empty/>"; | ||||
GuiInterface.prototype.Serialize = function() | GuiInterface.prototype.Serialize = function() | ||||
{ | { | ||||
// This component isn't network-synchronised for the biggest part | // This component isn't network-synchronised for the biggest part | ||||
// So most of the attributes shouldn't be serialized | // So most of the attributes shouldn't be serialized | ||||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | for (let i = 0; i < n; ++i) | ||||
let cmpPlayerStatisticsTracker = Engine.QueryInterface(playerEnt, IID_StatisticsTracker); | let cmpPlayerStatisticsTracker = Engine.QueryInterface(playerEnt, IID_StatisticsTracker); | ||||
if (cmpPlayerStatisticsTracker) | if (cmpPlayerStatisticsTracker) | ||||
ret.players[i].statistics = cmpPlayerStatisticsTracker.GetStatistics(); | ret.players[i].statistics = cmpPlayerStatisticsTracker.GetStatistics(); | ||||
} | } | ||||
return ret; | return ret; | ||||
}; | }; | ||||
GuiInterface.prototype.GetEndGameCampaignData = function(player) | |||||
{ | |||||
// TODO here: return some relevant information, possibly based on initial attributes + some trigger data? | |||||
Done Inline Actionsthe campaign should decide itself, can be added later, likely calling some getter function from a trigger script or so. nuke the todo elexis: the campaign should decide itself, can be added later, likely calling some getter function from… | |||||
Not Done Inline ActionsThat's already contained in the GetSimulationState elexis: That's already contained in the GetSimulationState | |||||
// return whether player lost or won at the very least. | |||||
let cmpPlayer = QueryPlayerIDInterface(player, IID_Player); | |||||
let status = cmpPlayer.GetState(); | |||||
return {"status" : status}; | |||||
Not Done Inline ActionsSpace after { and before } elexis: Space after { and before } | |||||
Done Inline ActionsUnneeded comment, can become a single statement. elexis: Unneeded comment, can become a single statement.
Always having a property on a separate line in… | |||||
} | |||||
Done Inline ActionsThe reason why I'm not using CallEvents is:
I can change this to CallEvent if we agree that CallEvent should return the value of the trigger. wraitii: The reason why I'm not using CallEvents is:
- that doesn't return the value
- I don't care… | |||||
GuiInterface.prototype.GetRenamedEntities = function(player) | GuiInterface.prototype.GetRenamedEntities = function(player) | ||||
{ | { | ||||
if (this.miragedEntities[player]) | if (this.miragedEntities[player]) | ||||
return this.renamedEntities.concat(this.miragedEntities[player]); | return this.renamedEntities.concat(this.miragedEntities[player]); | ||||
else | else | ||||
return this.renamedEntities; | return this.renamedEntities; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 1,753 Lines • ▼ Show 20 Lines | |||||
// (GUI scripts are non-deterministic and untrusted, so these functions must be | // (GUI scripts are non-deterministic and untrusted, so these functions must be | ||||
// appropriately careful. They are called with a first argument "player", which is | // appropriately careful. They are called with a first argument "player", which is | ||||
// trusted and indicates the player associated with the current client; no data should | // trusted and indicates the player associated with the current client; no data should | ||||
// be returned unless this player is meant to be able to see it.) | // be returned unless this player is meant to be able to see it.) | ||||
let exposedFunctions = { | let exposedFunctions = { | ||||
"GetSimulationState": 1, | "GetSimulationState": 1, | ||||
"GetExtendedSimulationState": 1, | "GetExtendedSimulationState": 1, | ||||
"GetEndGameCampaignData": 1, | |||||
"GetRenamedEntities": 1, | "GetRenamedEntities": 1, | ||||
"ClearRenamedEntities": 1, | "ClearRenamedEntities": 1, | ||||
"GetEntityState": 1, | "GetEntityState": 1, | ||||
"GetExtendedEntityState": 1, | "GetExtendedEntityState": 1, | ||||
"GetAverageRangeForBuildings": 1, | "GetAverageRangeForBuildings": 1, | ||||
"GetTemplateData": 1, | "GetTemplateData": 1, | ||||
"GetTechnologyData": 1, | "GetTechnologyData": 1, | ||||
"IsTechnologyResearched": 1, | "IsTechnologyResearched": 1, | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
fi?