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:
@@ -1,11 +1,10 @@
|
||||
import { Math_cos, Math_PI, Math_sin } from "../../core/builtins";
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { types } from "../../savegame/serialization";
|
||||
import { BeltPath } from "../belt_path";
|
||||
import { Component } from "../component";
|
||||
import { Entity } from "../entity";
|
||||
|
||||
export const curvedBeltLength = /* Math_PI / 4 */ 0.78;
|
||||
export const curvedBeltLength = /* Math.PI / 4 */ 0.78;
|
||||
|
||||
export class BeltComponent extends Component {
|
||||
static getId() {
|
||||
@@ -65,13 +64,13 @@ export class BeltComponent extends Component {
|
||||
|
||||
case enumDirection.right: {
|
||||
assert(progress <= curvedBeltLength + 0.02, "Invalid progress 2: " + progress);
|
||||
const arcProgress = (progress / curvedBeltLength) * 0.5 * Math_PI;
|
||||
return new Vector(0.5 - 0.5 * Math_cos(arcProgress), 0.5 - 0.5 * Math_sin(arcProgress));
|
||||
const arcProgress = (progress / curvedBeltLength) * 0.5 * Math.PI;
|
||||
return new Vector(0.5 - 0.5 * Math.cos(arcProgress), 0.5 - 0.5 * Math.sin(arcProgress));
|
||||
}
|
||||
case enumDirection.left: {
|
||||
assert(progress <= curvedBeltLength + 0.02, "Invalid progress 3: " + progress);
|
||||
const arcProgress = (progress / curvedBeltLength) * 0.5 * Math_PI;
|
||||
return new Vector(-0.5 + 0.5 * Math_cos(arcProgress), 0.5 - 0.5 * Math_sin(arcProgress));
|
||||
const arcProgress = (progress / curvedBeltLength) * 0.5 * Math.PI;
|
||||
return new Vector(-0.5 + 0.5 * Math.cos(arcProgress), 0.5 - 0.5 * Math.sin(arcProgress));
|
||||
}
|
||||
default:
|
||||
assertAlways(false, "Invalid belt direction: " + this.direction);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Math_radians } from "../../core/builtins";
|
||||
import { globalConfig } from "../../core/config";
|
||||
import { DrawParameters } from "../../core/draw_parameters";
|
||||
import { Rectangle } from "../../core/rectangle";
|
||||
@@ -253,7 +252,7 @@ export class StaticMapEntityComponent extends Component {
|
||||
const rotationCenterY = worldY + globalConfig.halfTileSize;
|
||||
|
||||
parameters.context.translate(rotationCenterX, rotationCenterY);
|
||||
parameters.context.rotate(Math_radians(this.rotation));
|
||||
parameters.context.rotate(Math.radians(this.rotation));
|
||||
|
||||
sprite.drawCached(
|
||||
parameters,
|
||||
@@ -264,7 +263,7 @@ export class StaticMapEntityComponent extends Component {
|
||||
false
|
||||
);
|
||||
|
||||
parameters.context.rotate(-Math_radians(this.rotation));
|
||||
parameters.context.rotate(-Math.radians(this.rotation));
|
||||
parameters.context.translate(-rotationCenterX, -rotationCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user