Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Trigger.js
Show All 18 Lines | [ | ||||
"PlayerDefeated", | "PlayerDefeated", | ||||
"PlayerWon", | "PlayerWon", | ||||
"Range", | "Range", | ||||
"ResearchFinished", | "ResearchFinished", | ||||
"ResearchQueued", | "ResearchQueued", | ||||
"StructureBuilt", | "StructureBuilt", | ||||
"TrainingFinished", | "TrainingFinished", | ||||
"TrainingQueued", | "TrainingQueued", | ||||
"TreasureCollected" | "TreasureCollected", | ||||
"Attacked" | |||||
]; | ]; | ||||
Trigger.prototype.Init = function() | Trigger.prototype.Init = function() | ||||
{ | { | ||||
this.triggerPoints = {}; | this.triggerPoints = {}; | ||||
// Each event has its own set of actions determined by the map maker. | // Each event has its own set of actions determined by the map maker. | ||||
for (let eventName of this.eventNames) | for (let eventName of this.eventNames) | ||||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Lines | Trigger.prototype.OnGlobalPlayerWon = function(msg) | ||||
this.CallEvent("PlayerWon", msg); | this.CallEvent("PlayerWon", msg); | ||||
}; | }; | ||||
Trigger.prototype.OnGlobalDiplomacyChanged = function(msg) | Trigger.prototype.OnGlobalDiplomacyChanged = function(msg) | ||||
{ | { | ||||
this.CallEvent("DiplomacyChanged", msg); | this.CallEvent("DiplomacyChanged", msg); | ||||
}; | }; | ||||
Trigger.prototype.OnGlobalAttacked = function(msg) | |||||
{ | |||||
this.CallEvent("Attacked", msg); | |||||
}; | |||||
/** | /** | ||||
* Execute a function after a certain delay. | * Execute a function after a certain delay. | ||||
* | * | ||||
* @param {Number} time - Delay in milliseconds. | * @param {Number} time - Delay in milliseconds. | ||||
* @param {String} action - Name of the action function. | * @param {String} action - Name of the action function. | ||||
* @param {Object} data - Arbitrary object that will be passed to the action function. | * @param {Object} data - Arbitrary object that will be passed to the action function. | ||||
* @return {Number} The ID of the timer, so it can be stopped later. | * @return {Number} The ID of the timer, so it can be stopped later. | ||||
*/ | */ | ||||
Show All 40 Lines |
Wildfire Games · Phabricator