1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00
tobspr_shapez.io/src/js/game/components/belt_reader.js
2021-02-26 16:29:37 +01:00

45 lines
1.1 KiB
JavaScript

import { Component } from "../component";
import { BaseItem } from "../base_item";
import { typeItemSingleton } from "../item_resolver";
import { types } from "../../savegame/serialization";
export class BeltReaderComponent extends Component {
static getId() {
return "BeltReader";
}
static getSchema() {
return {
lastItem: types.nullable(typeItemSingleton),
};
}
constructor() {
super();
/**
* Which items went through the reader, we only store the time
* @type {Array<number>}
*/
this.lastItemTimes = [];
/**
* Which item passed the reader last
* @type {BaseItem}
*/
this.lastItem = null;
/**
* Stores the last throughput we computed
* @type {number}
*/
this.lastThroughput = 0;
/**
* Stores when we last computed the throughput
* @type {number}
*/
this.lastThroughputComputation = 0;
}
}