// Add a slot to fill to the queue of animations to perform public static void FillSlotEventually(TokenAndSlot tokenAndSlot, ElementStackToken elementStackToken) { SlotToFill slotToFill = new SlotToFill { TokenAndSlot = tokenAndSlot, ElementStackToken = elementStackToken }; if (Validator.Available(slotToFill) && !AlreadyHandlingSlotToFill(slotToFill)) { SlotsToFill.Add(slotToFill); } }
public static bool PopulateSlotWithNearbyStacks(SituationController situation, RecipeSlot slotToFill) { // Trying to fill all the slots var candidateStacks = Positions.GetAdjacentStacks(situation, Mod.AutomationDistance); foreach (var stack in candidateStacks) { if (SituSlotController.StackMatchesSlot(stack, slotToFill)) { var tokenAndSlot = new TokenAndSlot { RecipeSlot = slotToFill, Token = situation.situationToken as SituationToken }; SituSlotController.FillSlotEventually(tokenAndSlot, stack as ElementStackToken); return(true); // Successfully found a token for this slot } } return(false); // Failed to find a token for this slot }
public static bool Available(TokenAndSlot tokenAndSlot) { return(tokenAndSlot != null && Available(tokenAndSlot.Token) && Available(tokenAndSlot.RecipeSlot)); }