You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tobspr_shapez.io/src/js/game/time/base_game_speed.js

56 lines
1.0 KiB

/* typehints:start */
import { GameRoot } from "../root";
/* typehints:end */
import { BasicSerializableObject } from "../../savegame/serialization";
export class BaseGameSpeed extends BasicSerializableObject {
/**
* @param {GameRoot} root
*/
constructor(root) {
super();
this.root = root;
this.initializeAfterDeserialize(root);
}
/** @returns {string} */
static getId() {
abstract;
return "unknown-speed";
}
getId() {
// @ts-ignore
return this.constructor.getId();
}
static getSchema() {
return {};
}
initializeAfterDeserialize(root) {
this.root = root;
}
/**
* Returns the time multiplier
*/
getTimeMultiplier() {
return 1;
}
/**
* Returns how many logic steps there may be queued
*/
getMaxLogicStepsInQueue() {
return 3;
}
// Internals
/** @returns {BaseGameSpeed} */
newSpeed(instance) {
return new instance(this.root);
}
}