mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Micro optimization for item acceptor
This commit is contained in:
parent
757b79b69e
commit
a057d68a8e
@ -7,6 +7,7 @@ import { ItemAcceptorComponent } from "../components/item_acceptor";
|
|||||||
import { Loader } from "../../core/loader";
|
import { Loader } from "../../core/loader";
|
||||||
import { drawRotatedSprite } from "../../core/draw_utils";
|
import { drawRotatedSprite } from "../../core/draw_utils";
|
||||||
import { BELT_ANIM_COUNT } from "./belt";
|
import { BELT_ANIM_COUNT } from "./belt";
|
||||||
|
import { fastArrayDelete } from "../../core/utils";
|
||||||
|
|
||||||
export class ItemAcceptorSystem extends GameSystemWithFilter {
|
export class ItemAcceptorSystem extends GameSystemWithFilter {
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
@ -36,7 +37,12 @@ export class ItemAcceptorSystem extends GameSystemWithFilter {
|
|||||||
const anim = animations[animIndex];
|
const anim = animations[animIndex];
|
||||||
anim.animProgress += progress;
|
anim.animProgress += progress;
|
||||||
if (anim.animProgress > 1) {
|
if (anim.animProgress > 1) {
|
||||||
animations.splice(animIndex, 1);
|
// Original
|
||||||
|
// animations.splice(animIndex, 1);
|
||||||
|
|
||||||
|
// Faster variant
|
||||||
|
fastArrayDelete(animations, animIndex);
|
||||||
|
|
||||||
animIndex -= 1;
|
animIndex -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user