human bug fixed
This commit is contained in:
@@ -169,14 +169,24 @@ export function useRetrieveHandler() {
|
|||||||
if (vehicle && !vehicle.isActive && vehicle.state === "idle" && vehicle.isPicking && vehicle.currentLoad < vehicle.point.action.loadCapacity) {
|
if (vehicle && !vehicle.isActive && vehicle.state === "idle" && vehicle.isPicking && vehicle.currentLoad < vehicle.point.action.loadCapacity) {
|
||||||
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
|
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
|
||||||
if (material) {
|
if (material) {
|
||||||
addCurrentAction(triggeredModel.modelUuid, retrieval.action.triggers[0]?.triggeredAsset.triggeredAction?.actionUuid ?? "", material.materialType, material.materialId);
|
addCurrentAction(
|
||||||
|
triggeredModel.modelUuid,
|
||||||
|
retrieval.action.triggers[0]?.triggeredAsset.triggeredAction?.actionUuid ?? "",
|
||||||
|
material.materialType,
|
||||||
|
material.materialId
|
||||||
|
);
|
||||||
retrieveLogStatus(material.materialName, `is being picked by ${armBot?.modelName}`);
|
retrieveLogStatus(material.materialName, `is being picked by ${armBot?.modelName}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
|
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
|
||||||
if (material) {
|
if (material) {
|
||||||
addCurrentAction(triggeredModel.modelUuid, retrieval.action.triggers[0]?.triggeredAsset.triggeredAction?.actionUuid ?? "", material.materialType, material.materialId);
|
addCurrentAction(
|
||||||
|
triggeredModel.modelUuid,
|
||||||
|
retrieval.action.triggers[0]?.triggeredAsset.triggeredAction?.actionUuid ?? "",
|
||||||
|
material.materialType,
|
||||||
|
material.materialId
|
||||||
|
);
|
||||||
retrieveLogStatus(material.materialName, `is being picked by ${armBot?.modelName}`);
|
retrieveLogStatus(material.materialName, `is being picked by ${armBot?.modelName}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,7 +292,9 @@ export function useRetrieveHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (human && !human.isScheduled && human.state === "idle" && human.currentLoad < action.loadCapacity) {
|
if (human && !human.isScheduled && human.state === "idle" && human.currentLoad < action.loadCapacity) {
|
||||||
const triggeredModel = action.triggers[0]?.triggeredAsset?.triggeredModel?.modelUuid ? getEventByModelUuid(selectedProduct.productUuid, action.triggers[0].triggeredAsset.triggeredModel.modelUuid) : null;
|
const triggeredModel = action.triggers[0]?.triggeredAsset?.triggeredModel?.modelUuid
|
||||||
|
? getEventByModelUuid(selectedProduct.productUuid, action.triggers[0].triggeredAsset.triggeredModel.modelUuid)
|
||||||
|
: null;
|
||||||
|
|
||||||
const storageAction = getActionByUuid(selectedProduct.productUuid, actionUuid);
|
const storageAction = getActionByUuid(selectedProduct.productUuid, actionUuid);
|
||||||
|
|
||||||
@@ -290,7 +302,18 @@ export function useRetrieveHandler() {
|
|||||||
const model = getVehicleById(triggeredModel.modelUuid);
|
const model = getVehicleById(triggeredModel.modelUuid);
|
||||||
if (model && !model.isActive && model.state === "idle" && model.isPicking && model.currentLoad < model.point.action.loadCapacity) {
|
if (model && !model.isActive && model.state === "idle" && model.isPicking && model.currentLoad < model.point.action.loadCapacity) {
|
||||||
if (humanAsset?.animationState?.current === "idle") {
|
if (humanAsset?.animationState?.current === "idle") {
|
||||||
setCurrentAnimation(human.modelUuid, "pickup", true, false, false);
|
if (!monitoredHumansRef.current.has(human.modelUuid)) {
|
||||||
|
addHumanToMonitor(
|
||||||
|
human.modelUuid,
|
||||||
|
() => {
|
||||||
|
if (humanAsset?.animationState?.current === "idle") {
|
||||||
|
setCurrentAnimation(human.modelUuid, "pickup", true, false, false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action.actionUuid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
monitoredHumansRef.current.add(human.modelUuid);
|
||||||
} else if (humanAsset?.animationState?.current === "pickup" && humanAsset.animationState.isCompleted) {
|
} else if (humanAsset?.animationState?.current === "pickup" && humanAsset.animationState.isCompleted) {
|
||||||
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
||||||
if (lastMaterial) {
|
if (lastMaterial) {
|
||||||
@@ -305,6 +328,7 @@ export function useRetrieveHandler() {
|
|||||||
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
monitoredHumansRef.current.delete(human.modelUuid);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -312,7 +336,18 @@ export function useRetrieveHandler() {
|
|||||||
const armBot = getArmBotById(triggeredModel.modelUuid);
|
const armBot = getArmBotById(triggeredModel.modelUuid);
|
||||||
if (armBot && !armBot.isActive && armBot.state === "idle" && !armBot.currentAction) {
|
if (armBot && !armBot.isActive && armBot.state === "idle" && !armBot.currentAction) {
|
||||||
if (humanAsset?.animationState?.current === "idle") {
|
if (humanAsset?.animationState?.current === "idle") {
|
||||||
setCurrentAnimation(human.modelUuid, "pickup", true, false, false);
|
if (!monitoredHumansRef.current.has(human.modelUuid)) {
|
||||||
|
addHumanToMonitor(
|
||||||
|
human.modelUuid,
|
||||||
|
() => {
|
||||||
|
if (humanAsset?.animationState?.current === "idle") {
|
||||||
|
setCurrentAnimation(human.modelUuid, "pickup", true, false, false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action.actionUuid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
monitoredHumansRef.current.add(human.modelUuid);
|
||||||
} else if (humanAsset?.animationState?.current === "pickup" && humanAsset.animationState.isCompleted) {
|
} else if (humanAsset?.animationState?.current === "pickup" && humanAsset.animationState.isCompleted) {
|
||||||
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
||||||
if (lastMaterial) {
|
if (lastMaterial) {
|
||||||
@@ -327,6 +362,7 @@ export function useRetrieveHandler() {
|
|||||||
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
monitoredHumansRef.current.delete(human.modelUuid);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -334,7 +370,18 @@ export function useRetrieveHandler() {
|
|||||||
const model = getConveyorById(triggeredModel.modelUuid);
|
const model = getConveyorById(triggeredModel.modelUuid);
|
||||||
if (model && !model.isPaused) {
|
if (model && !model.isPaused) {
|
||||||
if (humanAsset?.animationState?.current === "idle") {
|
if (humanAsset?.animationState?.current === "idle") {
|
||||||
setCurrentAnimation(human.modelUuid, "pickup", true, false, false);
|
if (!monitoredHumansRef.current.has(human.modelUuid)) {
|
||||||
|
addHumanToMonitor(
|
||||||
|
human.modelUuid,
|
||||||
|
() => {
|
||||||
|
if (humanAsset?.animationState?.current === "idle") {
|
||||||
|
setCurrentAnimation(human.modelUuid, "pickup", true, false, false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action.actionUuid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
monitoredHumansRef.current.add(human.modelUuid);
|
||||||
} else if (humanAsset?.animationState?.current === "pickup" && humanAsset.animationState.isCompleted) {
|
} else if (humanAsset?.animationState?.current === "pickup" && humanAsset.animationState.isCompleted) {
|
||||||
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
||||||
if (lastMaterial) {
|
if (lastMaterial) {
|
||||||
@@ -349,6 +396,7 @@ export function useRetrieveHandler() {
|
|||||||
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
monitoredHumansRef.current.delete(human.modelUuid);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -385,6 +433,18 @@ export function useRetrieveHandler() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (triggeredModel?.type === "storageUnit") {
|
} else if (triggeredModel?.type === "storageUnit") {
|
||||||
|
if (!monitoredHumansRef.current.has(human.modelUuid)) {
|
||||||
|
addHumanToMonitor(
|
||||||
|
human.modelUuid,
|
||||||
|
() => {
|
||||||
|
if (humanAsset?.animationState?.current === "idle") {
|
||||||
|
setCurrentAnimation(human.modelUuid, "pickup", true, false, false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action.actionUuid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
monitoredHumansRef.current.add(human.modelUuid);
|
||||||
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
const lastMaterial = getLastMaterial(storageUnit.modelUuid);
|
||||||
if (lastMaterial) {
|
if (lastMaterial) {
|
||||||
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
|
const material = createNewMaterial(lastMaterial.materialId, lastMaterial.materialType, storageAction as StorageAction);
|
||||||
@@ -397,6 +457,7 @@ export function useRetrieveHandler() {
|
|||||||
|
|
||||||
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
retrievalCountRef.current.set(actionUuid, currentCount + 1);
|
||||||
}
|
}
|
||||||
|
monitoredHumansRef.current.delete(human.modelUuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user