/// <summary> /// Perform client-only updates while this is added to the cauldron runs after Update, skipped if mostRecentUpdate returned true. /// Executes in order of the oldest ingredient to newest immediately after running Update for this ingredient /// </summary> public virtual void visualUpdate(AlchemyWrapper wrapper) { wrapper.bubbleAnimationTimer += 0.1f; //slightly increase bubbling speed if (timeSinceAdded == 0) { for (int k = 0; k < 10; k++) { Dust.NewDust(wrapper.cauldronRect.TopLeft() + new Vector2(wrapper.cauldronRect.Width / 4, 0), wrapper.cauldronRect.Width / 2, 0, DustID.Water, 0, -6, 0, default, 1f);
/// <summary> /// Runs when player has initiated crafting this recipe with all ingredients added. return true to skip individual ingredient code from running. /// responsible for spawning in items and visuals. /// executes on client and server. return true to stop individual ingredient code from running. /// by default consumes ingredients and spawns output instantly /// </summary> /// <returns></returns> public virtual bool UpdateCrafting(AlchemyWrapper wrapper, List <AlchemyIngredient> currentingredients, CauldronDummyAbstract cauldronDummy) { foreach (Item eachOutputItem in outputItemList) { Item.NewItem(wrapper.cauldronRect, eachOutputItem.type, eachOutputItem.stack * wrapper.currentBatchSize); } foreach (AlchemyIngredient eachIngredient in currentingredients) { Item requiredItem; requiredIngredientsMap.TryGetValue(eachIngredient.storedItem.type, out requiredItem); eachIngredient.storedItem.stack -= requiredItem.stack * wrapper.currentBatchSize; } cauldronDummy.dumpIngredients(); return(false); }
/// <summary> /// runs when this recipe is the only possible remaining recipe but the current set of ingredients is NOT valid for atleast one craft. /// return true to block any individual ingredient code from running. /// executes on client and server. /// by default does not logic and returns false. /// </summary> /// <returns></returns> public virtual bool updateAlmostReady(AlchemyWrapper wrapper) { //TODO: maybe default to some kind of way to indicate to the player they are on the right track but missing quantity / certain items return(false); }
/// <summary> /// Runs when this recipe is the only possible remaining recipe from the current set of ingredients and has enough of each ingredient to be valid. /// return true to block any individual ingredient code from running. /// executes on client and server. /// by default does no logic and returns false. /// </summary> /// <returns></returns> public virtual bool UpdateReady(AlchemyWrapper wrapper) { return(false); }
/// <summary> /// perform logic updates while this is added to the cauldron, executed by both client and server. runs even if mostRecentUpdate returned true. /// runs after the most recent ingredient executes mostRecentUpdate and executes in order of oldest ingredient to newest. also executes for most recent ingredient. /// designed for the idea of "dangerous" ingredients that may damage nearby players or have other tangible effects on the world and players outside of just visuals /// </summary> public virtual void Update(AlchemyWrapper wrapper) { }
/// <summary> /// performs logic and visuals that occur AFTER ALL other ingredient visuals / logic are run while this is the most recent item added to the cauldron /// executes even if mostRecentUpdate returns true /// by default just adds cauldron lighting for the resulting bubble color /// </summary> /// <param name="wrapper"></param> public virtual void mostRecentPostUpdate(AlchemyWrapper wrapper) { Lighting.AddLight(wrapper.cauldronRect.TopLeft() + new Vector2(wrapper.cauldronRect.Width / 2, 0), wrapper.bubbleColor.ToVector3()); }
/// <summary> /// performs logic and visuals while this is the most recent item added to the cauldron. return true if visual updates should be skipped for other ingredents currently in cauldron /// </summary> public virtual bool mostRecentUpdate(AlchemyWrapper wrapper) { return(false); }