Debugged agv and conveyor interaction.

This commit is contained in:
2025-04-11 17:52:07 +05:30
parent 8ed035b969
commit 1256f33342
14 changed files with 906 additions and 858 deletions

View File

@@ -57,7 +57,7 @@
// pointActions: PointAction[][];
// pointTriggers: PointTrigger[][];
// speed: number;
// isplaying: boolean;
// isActive: boolean;
// }
// interface ProcessCreatorProps {
@@ -147,7 +147,7 @@
// pointActions: [],
// pointTriggers: [], // Added point triggers array
// speed: 1,
// isplaying: false,
// isActive: false,
// });
// // Enhanced connection checking function
@@ -283,7 +283,7 @@
// pointActions,
// pointTriggers,
// speed: processSpeed,
// isplaying: false,
// isActive: false,
// };
// },
// [scene]
@@ -410,7 +410,7 @@
// p.connections.targets.map((t: { modelUUID: string }) => t.modelUUID)
// )
// .join(","),
// isplaying: false,
// isActive: false,
// }));
// }, [convertedPaths]);
@@ -459,6 +459,7 @@ import {
ConveyorEventsSchema,
VehicleEventsSchema,
} from "../../../types/world/worldTypes";
import { usePlayButtonStore } from "../../../store/usePlayButtonStore";
// Type definitions
export interface PointAction {
@@ -495,7 +496,7 @@ export interface SimulationPath {
points: PathPoint[];
pathPosition: [number, number, number];
speed?: number;
isplaying: boolean;
isActive: boolean;
}
export interface Process {
@@ -505,7 +506,7 @@ export interface Process {
pointActions: PointAction[][];
pointTriggers: PointTrigger[][];
speed: number;
isplaying: boolean;
isActive: boolean;
}
interface ProcessCreatorProps {
@@ -538,13 +539,13 @@ function convertToSimulationPath(
actions: Array.isArray(point.actions)
? point.actions.map(normalizeAction)
: point.actions
? [normalizeAction(point.actions)]
: [],
? [normalizeAction(point.actions)]
: [],
triggers: Array.isArray(point.triggers)
? point.triggers.map(normalizeTrigger)
: point.triggers
? [normalizeTrigger(point.triggers)]
: [],
? [normalizeTrigger(point.triggers)]
: [],
connections: {
targets: point.connections.targets.map((target) => ({
modelUUID: target.modelUUID,
@@ -556,7 +557,7 @@ function convertToSimulationPath(
typeof path.speed === "string"
? parseFloat(path.speed) || 1
: path.speed || 1,
isplaying: false, // Added missing property
isActive: false, // Added missing property
};
} else {
// For vehicle paths, handle the case where triggers might not exist
@@ -570,8 +571,8 @@ function convertToSimulationPath(
actions: Array.isArray(path.points.actions)
? path.points.actions.map(normalizeAction)
: path.points.actions
? [normalizeAction(path.points.actions)]
: [],
? [normalizeAction(path.points.actions)]
: [],
triggers: [],
connections: {
targets: path.points.connections.targets.map((target) => ({
@@ -582,7 +583,7 @@ function convertToSimulationPath(
],
pathPosition: path.position,
speed: path.points.speed || 1,
isplaying: false,
isActive: false,
};
}
}
@@ -595,7 +596,7 @@ const createEmptyProcess = (): Process => ({
pointActions: [],
pointTriggers: [], // Added point triggers array
speed: 1,
isplaying: false,
isActive: false,
});
// Enhanced connection checking function
@@ -731,7 +732,7 @@ export function useProcessCreation() {
pointActions,
pointTriggers,
speed: processSpeed,
isplaying: false,
isActive: false,
};
},
[scene]
@@ -824,6 +825,7 @@ const ProcessCreator: React.FC<ProcessCreatorProps> = React.memo(
const { createProcessesFromPaths } = useProcessCreation();
const prevPathsRef = useRef<SimulationPath[]>([]);
const prevProcessesRef = useRef<Process[]>([]);
const { isPlaying } = usePlayButtonStore();
const convertedPaths = useMemo((): SimulationPath[] => {
if (!simulationStates) return [];
@@ -858,7 +860,7 @@ const ProcessCreator: React.FC<ProcessCreatorProps> = React.memo(
p.connections.targets.map((t: { modelUUID: string }) => t.modelUUID)
)
.join(","),
isplaying: false,
isActive: false,
}));
}, [convertedPaths]);