1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Merge pull request #198 from Phlosioneer/remove-belt-cache

Optimize belt cache
This commit is contained in:
tobspr
2020-06-24 20:26:22 +02:00
committed by GitHub
2 changed files with 38 additions and 43 deletions

View File

@@ -5,6 +5,7 @@ import { BaseItem } from "../base_item";
import { Vector, enumDirection } from "../../core/vector";
import { Math_PI, Math_sin, Math_cos } from "../../core/builtins";
import { globalConfig } from "../../core/config";
import { Entity } from "../entity";
export class BeltComponent extends Component {
static getId() {
@@ -12,6 +13,7 @@ export class BeltComponent extends Component {
}
static getSchema() {
// The followUpCache field is not serialized.
return {
direction: types.string,
sortedItems: types.array(types.pair(types.float, types.obj(gItemRegistry))),
@@ -34,6 +36,9 @@ export class BeltComponent extends Component {
/** @type {Array<[number, BaseItem]>} */
this.sortedItems = [];
/** @type {Entity} */
this.followUpCache = null;
}
/**