feat: Refactor swap handling and enhance delay management in conveyor actions

This commit is contained in:
2025-05-06 12:35:51 +05:30
parent bdba6447f3
commit 815a9a94ca
9 changed files with 138 additions and 48 deletions

View File

@@ -15,13 +15,13 @@ export function useActionHandler() {
const { handleMachineAction, cleanup: cleanupMachine } = useMachineActions();
const { handleStorageAction, cleanup: cleanupStorage } = useStorageActions();
const handleAction = useCallback((action: Action) => {
const handleAction = useCallback((action: Action, materialId?: string) => {
if (!action) return;
try {
switch (action.actionType) {
case 'default': case 'spawn': case 'swap': case 'delay': case 'despawn':
handleConveyorAction(action as ConveyorAction);
handleConveyorAction(action as ConveyorAction, materialId as string);
break;
case 'travel':
handleVehicleAction(action as VehicleAction);