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

Get rid of 'builtins' file since its useless and causes performance issues

This commit is contained in:
tobspr
2020-06-27 10:51:52 +02:00
parent 14246929b3
commit 2e266f5f21
60 changed files with 256 additions and 403 deletions

View File

@@ -1,4 +1,3 @@
import { Math_min } from "../../core/builtins";
import { globalConfig } from "../../core/config";
import { DrawParameters } from "../../core/draw_parameters";
import { gMetaBuildingRegistry } from "../../core/global_registries";
@@ -482,7 +481,7 @@ export class BeltSystem extends GameSystemWithFilter {
}
// Limit speed to avoid belts going backwards
const speedMultiplier = Math_min(this.root.hubGoals.getBeltBaseSpeed(), 10);
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
// SYNC with systems/item_acceptor.js:drawEntityUnderlays!
// 126 / 42 is the exact animation speed of the png animation

View File

@@ -6,7 +6,6 @@ import { enumDirectionToVector, enumDirectionToAngle } from "../../core/vector";
import { ItemAcceptorComponent } from "../components/item_acceptor";
import { Loader } from "../../core/loader";
import { drawRotatedSprite } from "../../core/draw_utils";
import { Math_radians, Math_min } from "../../core/builtins";
import { BELT_ANIM_COUNT } from "./belt";
export class ItemAcceptorSystem extends GameSystemWithFilter {
@@ -98,7 +97,7 @@ export class ItemAcceptorSystem extends GameSystemWithFilter {
}
// Limit speed to avoid belts going backwards
const speedMultiplier = Math_min(this.root.hubGoals.getBeltBaseSpeed(), 10);
const speedMultiplier = Math.min(this.root.hubGoals.getBeltBaseSpeed(), 10);
const underlays = acceptorComp.beltUnderlays;
for (let i = 0; i < underlays.length; ++i) {
@@ -118,7 +117,7 @@ export class ItemAcceptorSystem extends GameSystemWithFilter {
sprite: this.underlayBeltSprites[animationIndex % this.underlayBeltSprites.length],
x: (transformedPos.x + 0.5) * globalConfig.tileSize,
y: (transformedPos.y + 0.5) * globalConfig.tileSize,
angle: Math_radians(angle),
angle: Math.radians(angle),
size: globalConfig.tileSize,
});
}

View File

@@ -1,4 +1,3 @@
import { Math_min } from "../../core/builtins";
import { globalConfig } from "../../core/config";
import { DrawParameters } from "../../core/draw_parameters";
import { createLogger } from "../../core/logging";
@@ -207,7 +206,7 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
const targetEntity = sourceSlot.cachedTargetEntity;
// Advance items on the slot
sourceSlot.progress = Math_min(1, sourceSlot.progress + progressGrowth);
sourceSlot.progress = Math.min(1, sourceSlot.progress + progressGrowth);
// Check if we are still in the process of ejecting, can't proceed then
if (sourceSlot.progress < 1.0) {

View File

@@ -1,4 +1,3 @@
import { Math_max } from "../../core/builtins";
import { globalConfig } from "../../core/config";
import { BaseItem } from "../base_item";
import { enumColorMixingResults } from "../colors";
@@ -21,7 +20,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const ejectorComp = entity.components.ItemEjector;
// First of all, process the current recipe
processorComp.secondsUntilEject = Math_max(
processorComp.secondsUntilEject = Math.max(
0,
processorComp.secondsUntilEject - this.root.dynamicTickrate.deltaSeconds
);

View File

@@ -1,4 +1,3 @@
import { Math_max } from "../../core/builtins";
import { globalConfig } from "../../core/config";
import { Loader } from "../../core/loader";
import {
@@ -40,7 +39,7 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
// Decrease remaining time of all items in belt
for (let k = 0; k < pendingItems.length; ++k) {
const item = pendingItems[k];
item[1] = Math_max(0, item[1] - delta);
item[1] = Math.max(0, item[1] - delta);
if (G_IS_DEV && globalConfig.debug.instantBelts) {
item[1] = 0;
}