From 820ca8512f610b7a1e672c57c35d7ca2249d2069 Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Mon, 21 Jun 2021 12:01:31 +0200 Subject: [PATCH] custom jobs --- src/logic/evolution.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/logic/evolution.js b/src/logic/evolution.js index c850a9d..36d4dbc 100644 --- a/src/logic/evolution.js +++ b/src/logic/evolution.js @@ -9,6 +9,7 @@ class Evolution extends Arrangement { this.setup(); this.productIndex = 0; this.productsAmount = [...Array(ShelfCount)].map(() => 0); + this.backlog = [] } generate() { @@ -77,7 +78,19 @@ class Evolution extends Arrangement { } } + addCustomJobRequest(productName, amount, x, y) { + this.backlog.push({ + product: productName, + amount, + x, y + }); + } + getJobRequest() { + if (this.backlog.length > 0) { + return this.backlog.pop() + } + if (this.productIndex > ShelfCount) return null;