private static void HandleOngoing(SituationController situation) { var emptySlot = SituSlotController.GetFirstEmptyRecipeSlot(situation); if (emptySlot != null) { PopulateSlotWithNearbyStacks(situation, emptySlot); } }
private static void HandleUnstarted(SituationController situation) { // Do nothing if we are paused if (Registry.Retrieve <TabletopManager>().GetPausedState()) { return; } // Do nothing until at least a second has passed since last completion for smoother UX situationLastCompletionTimes.TryGetValue(situation, out DateTime lastCompletionTime); if ((lastCompletionTime != null) && ((DateTime.Now - lastCompletionTime).TotalSeconds < 1.2)) { return; } var emptySlot = SituSlotController.GetFirstEmptyRecipeSlot(situation); // If no more slots can be filled we can try to activate the recipe if (emptySlot == null) { situation.AttemptActivateRecipe(); return; } // Try to fill the slot and return if successful if (PopulateSlotWithNearbyStacks(situation, emptySlot)) { return; } // We have slots to fill but nothing to fill them with. Possibly we already filled our primary slot // and just cannot find any "extra" cards. If that's the case we can activate the recipe with partially filled slots. var primarySlot = (situation.situationWindow as SituationWindow).GetPrimarySlot(); if (primarySlot != null && primarySlot.GetElementStackInSlot() != null) { situation.AttemptActivateRecipe(); } }