Do not allow resources to be negative.

This commit is contained in:
Adrian 2024-10-23 11:59:50 +02:00
parent 16db8ee0be
commit 11bcbbc8a6

View File

@ -30,6 +30,9 @@ export default function update(timestamp: number) {
if (V.resources[resource] > storage[resource]) { if (V.resources[resource] > storage[resource]) {
V.resources[resource] = storage[resource]; V.resources[resource] = storage[resource];
} }
else if (V.resources[resource] < 0) {
V.resources[resource] = 0;
}
}); });
return V; return V;