Do not allow resources to be negative.
This commit is contained in:
parent
16db8ee0be
commit
11bcbbc8a6
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user