Refactor robotic arm and conveyor action handlers for improved functionality and performance; add despawn handler and update state management
This commit is contained in:
@@ -20,20 +20,20 @@ type MaterialsStore = {
|
||||
|
||||
setNextLocation: (
|
||||
materialId: string,
|
||||
location?: {
|
||||
location: {
|
||||
modelUuid: string;
|
||||
pointUuid: string;
|
||||
} | null
|
||||
) => MaterialSchema | undefined;
|
||||
|
||||
setMaterial: (materialId: string, materialType: string) => MaterialSchema | undefined;
|
||||
setStartTime: (materialId: string, startTime: string) => MaterialSchema | undefined;
|
||||
setEndTime: (materialId: string, endTime: string) => MaterialSchema | undefined;
|
||||
setStartTime: (materialId: string, startTime: number) => MaterialSchema | undefined;
|
||||
setEndTime: (materialId: string, endTime: number) => MaterialSchema | undefined;
|
||||
setCost: (materialId: string, cost: number) => MaterialSchema | undefined;
|
||||
setWeight: (materialId: string, weight: number) => MaterialSchema | undefined;
|
||||
setIsActive: (materialId: string, isActive: boolean) => MaterialSchema | undefined;
|
||||
setIsVisible: (materialId: string, isVisible: boolean) => MaterialSchema | undefined;
|
||||
setIsPaused: (materialId: string, isPlaying: boolean) => MaterialSchema | undefined;
|
||||
setIsPaused: (materialId: string, isPaused: boolean) => MaterialSchema | undefined;
|
||||
setIsRendered: (materialId: string, isRendered: boolean) => MaterialSchema | undefined;
|
||||
|
||||
getMaterialById: (materialId: string) => MaterialSchema | undefined;
|
||||
@@ -102,7 +102,7 @@ export const useMaterialStore = create<MaterialsStore>()(
|
||||
set((state) => {
|
||||
const material = state.materials.find(m => m.materialId === materialId);
|
||||
if (material) {
|
||||
material.next = location || undefined;
|
||||
material.next = location;
|
||||
updatedMaterial = JSON.parse(JSON.stringify(material));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user