Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Timer.js
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | this.timers.set(id, { | ||||
"repeatTime": repeattime, | "repeatTime": repeattime, | ||||
"data": data | "data": data | ||||
}); | }); | ||||
return id; | return id; | ||||
}; | }; | ||||
/** | /** | ||||
* Updates the repeat time of a timer. | |||||
* Note that this will take only effect after the next update. | |||||
* | |||||
* @param {number} timerID - The timer to update. | |||||
* @param {number} newRepeatTime - The new repeat time to use. | |||||
*/ | |||||
Timer.prototype.UpdateRepeatTime = function(timerID, newRepeatTime) | |||||
{ | |||||
let timer = this.timers.get(timerID); | |||||
if (timer) | |||||
this.timers.set(timerID, { | |||||
"entity": timer.entity, | |||||
"iid": timer.iid, | |||||
"functionName": timer.functionName, | |||||
"time": timer.time, | |||||
Freagarach: We could correct for the difference in repeat time? | |||||
"repeatTime": newRepeatTime, | |||||
"data": timer.data | |||||
}); | |||||
}; | |||||
/** | |||||
* Cancels an existing timer that was created with SetTimeout/SetInterval. | * Cancels an existing timer that was created with SetTimeout/SetInterval. | ||||
*/ | */ | ||||
Timer.prototype.CancelTimer = function(id) | Timer.prototype.CancelTimer = function(id) | ||||
{ | { | ||||
this.timers.delete(id); | this.timers.delete(id); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
We could correct for the difference in repeat time?