fixed invManager wrong invState update
thanks chatGPT
This commit is contained in:
parent
8cd105b84c
commit
64f4304626
@ -142,6 +142,7 @@ class InvManager {
|
|||||||
|
|
||||||
while (loopProtect > 0) {
|
while (loopProtect > 0) {
|
||||||
loopProtect--;
|
loopProtect--;
|
||||||
|
|
||||||
if (topIndex < k) {
|
if (topIndex < k) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,10 +160,9 @@ class InvManager {
|
|||||||
Log.error("Failed to transfer items");
|
Log.error("Failed to transfer items");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update invState
|
|
||||||
var topState = invState.get(slots[topIndex]);
|
var topState = invState.get(slots[topIndex]);
|
||||||
topState.count += transferCount;
|
topState.count += transferCount;
|
||||||
invState.set(topIndex, topState);
|
invState.set(slots[topIndex], topState);
|
||||||
|
|
||||||
var botState = invState.get(slot);
|
var botState = invState.get(slot);
|
||||||
botState.count -= transferCount;
|
botState.count -= transferCount;
|
||||||
@ -174,6 +174,10 @@ class InvManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loopProtect < 0) {
|
||||||
|
Log.silly("Loopprotection triggerd");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user