From 11bcbbc8a6b125514268200d267eedec2e0ddf44 Mon Sep 17 00:00:00 2001 From: Adrian Gaudebert Date: Wed, 23 Oct 2024 11:59:50 +0200 Subject: [PATCH] Do not allow resources to be negative. --- src/update.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/update.ts b/src/update.ts index 437e8a1..055a3f0 100644 --- a/src/update.ts +++ b/src/update.ts @@ -30,6 +30,9 @@ export default function update(timestamp: number) { if (V.resources[resource] > storage[resource]) { V.resources[resource] = storage[resource]; } + else if (V.resources[resource] < 0) { + V.resources[resource] = 0; + } }); return V;