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