storage to human bug fixed

This commit is contained in:
2025-09-24 18:12:36 +05:30
parent 14c4a3246f
commit 8ff3573af2

View File

@@ -291,7 +291,7 @@ export function useRetrieveHandler() {
return;
}
if (human && !human.isScheduled && human.state === "idle" && human.currentLoad < action.loadCapacity) {
if (human) {
const triggeredModel = action.triggers[0]?.triggeredAsset?.triggeredModel?.modelUuid
? getEventByModelUuid(selectedProduct.productUuid, action.triggers[0].triggeredAsset.triggeredModel.modelUuid)
: null;
@@ -445,19 +445,21 @@ export function useRetrieveHandler() {
);
}
monitoredHumansRef.current.add(human.modelUuid);
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
if (lastMaterial) {
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
if (material) {
removeLastMaterial(storageUnit.modelUuid);
updateCurrentLoad(storageUnit.modelUuid, -1);
incrementHumanLoad(human.modelUuid, 1);
addCurrentMaterialToHuman(human.modelUuid, material.materialType, material.materialId);
retrieveLogStatus(material.materialName, `is picked by ${human.modelName}`);
if (humanAsset?.animationState?.current === "pickup" && humanAsset.animationState.isCompleted) {
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
if (lastMaterial) {
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
if (material) {
removeLastMaterial(storageUnit.modelUuid);
updateCurrentLoad(storageUnit.modelUuid, -1);
incrementHumanLoad(human.modelUuid, 1);
addCurrentMaterialToHuman(human.modelUuid, material.materialType, material.materialId);
retrieveLogStatus(material.materialName, `is picked by ${human.modelName}`);
retrievalCountRef.current.set(actionUuid, currentCount + 1);
retrievalCountRef.current.set(actionUuid, currentCount + 1);
}
monitoredHumansRef.current.delete(human.modelUuid);
}
monitoredHumansRef.current.delete(human.modelUuid);
}
}
}