Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/common-api/shared.js
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | m.SharedScript.prototype.Deserialize = function(data) | ||||
this._entityMetadata = data.metadata; | this._entityMetadata = data.metadata; | ||||
this.isDeserialized = true; | this.isDeserialized = true; | ||||
}; | }; | ||||
m.SharedScript.prototype.GetTemplate = function(name) | m.SharedScript.prototype.GetTemplate = function(name) | ||||
{ | { | ||||
if (this._templates[name] === undefined) | if (this._templates[name] === undefined) | ||||
this._templates[name] = Engine.GetTemplate(name) || null; | this._templates[name] = SimEngine.GetTemplate(name) || null; | ||||
return this._templates[name]; | return this._templates[name]; | ||||
}; | }; | ||||
/** | /** | ||||
* Initialize the shared component. | * Initialize the shared component. | ||||
* We need to know the initial state of the game for this, as we will use it. | * We need to know the initial state of the game for this, as we will use it. | ||||
* This is called right at the end of the map generation. | * This is called right at the end of the map generation. | ||||
▲ Show 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | m.SharedScript.prototype.changeEntityInResourceMapHelper = function(ent, multiplication = 1) | ||||
const strength = multiplication * ent.resourceSupplyMax() / this.normalizationFactor[grp]; | const strength = multiplication * ent.resourceSupplyMax() / this.normalizationFactor[grp]; | ||||
this.resourceMaps[resource].addInfluence(x, y, this.influenceRadius[grp] / cellSize, strength / 2, "constant"); | this.resourceMaps[resource].addInfluence(x, y, this.influenceRadius[grp] / cellSize, strength / 2, "constant"); | ||||
this.resourceMaps[resource].addInfluence(x, y, this.influenceRadius[grp] / cellSize, strength / 2); | this.resourceMaps[resource].addInfluence(x, y, this.influenceRadius[grp] / cellSize, strength / 2); | ||||
this.ccResourceMaps[resource].addInfluence(x, y, this.ccInfluenceRadius[grp] / cellSize, strength, "constant"); | this.ccResourceMaps[resource].addInfluence(x, y, this.ccInfluenceRadius[grp] / cellSize, strength, "constant"); | ||||
}; | }; | ||||
return m; | return m; | ||||
}(API3); | }(API3); | ||||
Lint: no-use-before-define: 'API3' was used before it was defined. | |||||
Wildfire Games · Phabricator
'API3' was used before it was defined.