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

Add building speed infos to all buildings

This commit is contained in:
tobspr
2020-05-17 15:32:19 +02:00
parent 97f52f509b
commit d58d15ef8c
23 changed files with 243 additions and 36 deletions

View File

@@ -11,6 +11,7 @@ import { MapChunkView } from "../map_chunk_view";
import { gMetaBuildingRegistry } from "../../core/global_registries";
import { MetaBeltBaseBuilding } from "../buildings/belt_base";
import { defaultBuildingVariant } from "../meta_building";
import { GameRoot } from "../root";
const BELT_ANIM_COUNT = 6;
@@ -109,7 +110,11 @@ export class BeltSystem extends GameSystemWithFilter {
}
update() {
const beltSpeed = this.root.hubGoals.getBeltBaseSpeed() * globalConfig.physicsDeltaSeconds;
// Divide by item spacing on belts since we use throughput and not speed
const beltSpeed =
this.root.hubGoals.getBeltBaseSpeed() *
globalConfig.physicsDeltaSeconds *
globalConfig.itemSpacingOnBelts;
for (let i = 0; i < this.allEntities.length; ++i) {
const entity = this.allEntities[i];

View File

@@ -31,7 +31,10 @@ export class ItemAcceptorSystem extends GameSystemWithFilter {
for (let animIndex = 0; animIndex < aceptorComp.itemConsumptionAnimations.length; ++animIndex) {
const anim = aceptorComp.itemConsumptionAnimations[animIndex];
anim.animProgress +=
globalConfig.physicsDeltaSeconds * this.root.hubGoals.getBeltBaseSpeed() * 2;
globalConfig.physicsDeltaSeconds *
this.root.hubGoals.getBeltBaseSpeed() *
2 *
globalConfig.itemSpacingOnBelts;
if (anim.animProgress > 1) {
aceptorComp.itemConsumptionAnimations.splice(animIndex, 1);
animIndex -= 1;

View File

@@ -13,7 +13,7 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
}
update() {
const effectiveBeltSpeed = this.root.hubGoals.getBeltBaseSpeed();
const effectiveBeltSpeed = this.root.hubGoals.getBeltBaseSpeed() * globalConfig.itemSpacingOnBelts;
const progressGrowth = (effectiveBeltSpeed / 0.5) * globalConfig.physicsDeltaSeconds;
// Try to find acceptors for every ejector

View File

@@ -1,11 +1,11 @@
import { globalConfig } from "../../core/config";
import { DrawParameters } from "../../core/draw_parameters";
import { enumDirectionToVector } from "../../core/vector";
import { BaseItem } from "../base_item";
import { MinerComponent } from "../components/miner";
import { Entity } from "../entity";
import { GameSystemWithFilter } from "../game_system_with_filter";
import { MapChunkView } from "../map_chunk_view";
import { enumDirectionToVector } from "../../core/vector";
import { Entity } from "../entity";
import { BaseItem } from "../base_item";
export class MinerSystem extends GameSystemWithFilter {
constructor(root) {