1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

minor cleanups

This commit is contained in:
Sense101 2021-06-24 09:53:41 +01:00
parent ac6fe1a74b
commit 3032f45af2
3 changed files with 8 additions and 9 deletions

View File

@ -47,7 +47,7 @@ export class GoalAcceptorComponent extends Component {
this.currentDeliveredItems = 0;
}
getRequiredItemsPerSecond() {
getRequiredSecondsPerItem() {
return (
globalConfig.goalAcceptorsPerProducer /
(globalConfig.puzzleModeSpeed * globalConfig.beltSpeedItemsPerSecond)

View File

@ -28,9 +28,8 @@ export class GoalAcceptorSystem extends GameSystemWithFilter {
continue;
}
if (now - goalComp.lastDelivery.time > goalComp.getRequiredItemsPerSecond()) {
goalComp.lastDelivery = null;
goalComp.currentDeliveredItems = 0;
if (now - goalComp.lastDelivery.time > goalComp.getRequiredSecondsPerItem()) {
goalComp.clearItems();
}
if (goalComp.currentDeliveredItems < globalConfig.goalAcceptorItemsRequired) {

View File

@ -573,13 +573,13 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const item = payload.items[0].item;
const now = this.root.time.now();
goalComp.currentDeliveredItems = Math.min(
goalComp.currentDeliveredItems + 1,
globalConfig.goalAcceptorItemsRequired
);
if (goalComp.item && !item.equals(goalComp.item)) {
goalComp.clearItems();
} else {
goalComp.currentDeliveredItems = Math.min(
goalComp.currentDeliveredItems + 1,
globalConfig.goalAcceptorItemsRequired
);
}
if (this.root.gameMode.getIsEditor()) {