/// <summary> /// Players can check the remaining microwave time or insert something into the microwave. /// </summary> public void ServerPerformInteraction(HandApply interaction) { if (interaction.HandObject != null) { // Check if the player is holding food that can be ground up ItemAttributesV2 attr = interaction.HandObject.GetComponent <ItemAttributesV2>(); Ingredient ingredient = new Ingredient(attr.ArticleName); Chemistry.Reagent meal = CraftingManager.Grind.FindReagentRecipe(new List <Ingredient> { ingredient }); int count = CraftingManager.Grind.FindReagentAmount(new List <Ingredient> { ingredient }); if (meal) { grinder.SetServerStackAmount(count); grinder.ServerSetOutputMeal(meal.name); Despawn.ServerSingle(interaction.HandObject); Chat.AddExamineMsgFromServer(interaction.Performer, $"You grind the {attr.ArticleName}."); GetComponent <AIOGrinder>().GrindFood(); } else { Chat.AddExamineMsgFromServer(interaction.Performer, $"Your {attr.ArticleName} can not be ground up."); } } else { if (!grinderStorage.IsEmpty) { if (grinderStorage.ReagentMixTotal == grinderStorage.AmountOfReagent(grinderStorage.MajorMixReagent)) { Chat.AddExamineMsgFromServer(interaction.Performer, $"The grinder currently contains {grinderStorage.ReagentMixTotal} " + $"of {grinderStorage.MajorMixReagent}."); } else if (grinderStorage.ReagentMixTotal != grinderStorage.AmountOfReagent(grinderStorage.MajorMixReagent)) { Chat.AddExamineMsgFromServer(interaction.Performer, $"The grinder currently contains {grinderStorage.AmountOfReagent(grinderStorage.MajorMixReagent)} " + $"of {grinderStorage.MajorMixReagent}, as well as " + $"{grinderStorage.ReagentMixTotal - grinderStorage.AmountOfReagent(grinderStorage.MajorMixReagent)} of various other things."); } } else { Chat.AddExamineMsgFromServer(interaction.Performer, "The grinder is empty."); } } }
/// <summary> /// Set NutritionLevel to be equal to nuriment amount /// </summary> private void SetupEdible() { edible.NutritionLevel = Mathf.FloorToInt(reagentContainer.AmountOfReagent("nutriment")); }