protected void checkAttachedSlots() { List <IHangarMechanic> hangars = this.hangarMgr.getAllHangar(); foreach (var hangar in hangars) { HangarLiftSlot liftSlotMech = hangar.getLiftSlotMech(); liftSlotMech.runActionQueue(); if (liftSlotMech.hasStopped()) { // still attached to lift, set command to return back hangar.setReturn(); liftSlotMech.reset(); return; } if (liftSlotMech.hasActions()) { return; } } this.checkAttached = true; }
public void run() { if (!checkAttached) { this.checkAttachedSlots(); return; } List <IHangarMechanic> hangars = this.hangarMgr.getAllHangar(); if (!retractingPistons) { foreach (var hangar in hangars) { HangarLiftSlot liftSlotMech = hangar.getLiftSlotMech(); liftSlotMech.reset(); liftSlotMech.queueAction("setupRetract"); // liftSlotMech.queueAction("mergeOn"); } this.retractingPistons = true; return; } foreach (var hangar in hangars) { HangarLiftSlot liftSlotMech = hangar.getLiftSlotMech(); liftSlotMech.runActionQueue(); if (liftSlotMech.hasStopped()) { throw new Exception("Hangar lift slot in error state."); } if (liftSlotMech.hasActions()) { return; } } this.inReadyState = true; }