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

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-08-29 08:38:23 +00:00
import { Component } from "../component";
import { BaseItem } from "../base_item";
import { typeItemSingleton } from "../item_resolver";
2020-08-30 13:56:30 +00:00
import { types } from "../../savegame/serialization";
2020-08-29 08:38:23 +00:00
export class BeltReaderComponent extends Component {
static getId() {
return "BeltReader";
}
static getSchema() {
return {
2020-08-30 13:56:30 +00:00
lastItem: types.nullable(typeItemSingleton),
};
}
2020-08-29 08:38:23 +00:00
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;
}
2021-02-26 15:29:37 +00:00
}