mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Improve tunnel performance by caching receivers
This commit is contained in:
@@ -3,6 +3,7 @@ import { Component } from "../component";
|
||||
import { globalConfig } from "../../core/config";
|
||||
import { types } from "../../savegame/serialization";
|
||||
import { gItemRegistry } from "../../core/global_registries";
|
||||
import { Entity } from "../entity";
|
||||
|
||||
/** @enum {string} */
|
||||
export const enumUndergroundBeltMode = {
|
||||
@@ -10,6 +11,13 @@ export const enumUndergroundBeltMode = {
|
||||
receiver: "receiver",
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* entity: Entity,
|
||||
* distance: number
|
||||
* }} LinkedUndergroundBelt
|
||||
*/
|
||||
|
||||
export class UndergroundBeltComponent extends Component {
|
||||
static getId() {
|
||||
return "UndergroundBelt";
|
||||
@@ -52,6 +60,13 @@ export class UndergroundBeltComponent extends Component {
|
||||
* @type {Array<[BaseItem, number]>} Format is [Item, remaining seconds until transfer/ejection]
|
||||
*/
|
||||
this.pendingItems = [];
|
||||
|
||||
/**
|
||||
* The linked entity, used to speed up performance. This contains either
|
||||
* the entrance or exit depending on the tunnel type
|
||||
* @type {LinkedUndergroundBelt}
|
||||
*/
|
||||
this.cachedLinkedEntity = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user