public void ServerPerformInteraction(HandApply interaction) { var slot = interaction.HandSlot; //If hand slot contains mutagen, use 5 mutagen mutate plant if (HasPlant) { if (plantData.MutatesInToGameObject.Count > 0) { var objectContainer = slot?.Item?.GetComponent <ReagentContainer>(); if (objectContainer != null) { objectContainer.MoveReagentsTo(5, reagentContainer); Chat.AddActionMsgToChat(interaction.Performer, $"You add reagents to the {gameObject.ExpensiveName()}.", $"{interaction.Performer.name} adds reagents to the {gameObject.ExpensiveName()}."); if (reagentContainer[mutagen] >= 5) { reagentContainer.Subtract(new ReagentMix(mutagen, 5)); plantData.Mutation(); return; } } } } var objectItemAttributes = slot?.Item?.GetComponent <ItemAttributesV2>(); if (objectItemAttributes != null) { //If hand slot contains Cultivator remove weeds if (objectItemAttributes.HasTrait(CommonTraits.Instance.Cultivator)) { if (weedLevel > 0) { Chat.AddActionMsgToChat(interaction.Performer, $"You remove the weeds from the {gameObject.ExpensiveName()}.", $"{interaction.Performer.name} uproots the weeds."); } weedNotifier.PushClear(); weedLevel = 0; return; } //If hand slot contains Bucket water plants if (objectItemAttributes.HasTrait(CommonTraits.Instance.Bucket)) { Chat.AddActionMsgToChat(interaction.Performer, $"You water the {gameObject.ExpensiveName()}.", $"{interaction.Performer.name} waters the {gameObject.ExpensiveName()}."); reagentContainer.Add(new ReagentMix(water, 100)); return; } //If hand slot contains Trowel remove plants if (objectItemAttributes.HasTrait(CommonTraits.Instance.Trowel)) { if (HasPlant) { Chat.AddActionMsgToChat(interaction.Performer, $"You dig out all of the {gameObject.ExpensiveName()}'s plants!", $"{interaction.Performer.name} digs out the plants in the {gameObject.ExpensiveName()}!"); CropDeath(); } UpdatePlantStage(plantCurrentStage, PlantSpriteStage.None); return; } } //If hand slot contains grown food, plant the food //This temporarily replaces the seed machine until it is implemented, see commented code for original compost behavior var foodObject = slot?.Item?.GetComponent <GrownFood>(); if (foodObject != null) { if (HasPlant) { Chat.AddActionMsgToChat(interaction.Performer, $"You compost the {foodObject.name} in the {gameObject.ExpensiveName()}.", $"{interaction.Performer.name} composts {foodObject.name} in the {gameObject.ExpensiveName()}."); reagentContainer.Add(new ReagentMix(nutriment, foodObject.GetPlantData().Potency)); Despawn.ServerSingle(interaction.HandObject); return; } else { PlantData _plantData = foodObject.GetPlantData(); plantData = PlantData.CreateNewPlant(_plantData); UpdatePlantGrowthStage(0, 0); UpdatePlantStage(PlantSpriteStage.None, PlantSpriteStage.Growing); UpdateHarvestFlag(showHarvestFlag, false); Inventory.ServerVanish(slot); Chat.AddActionMsgToChat(interaction.Performer, $"You plant the {foodObject.name} in the {gameObject.ExpensiveName()}.", $"{interaction.Performer.name} plants the {foodObject.name} in the {gameObject.ExpensiveName()}."); } } //If hand slot contains seeds, plant the seeds var Object = slot?.Item?.GetComponent <SeedPacket>(); if (Object != null) { plantData = PlantData.CreateNewPlant(slot.Item.GetComponent <SeedPacket>().plantData); UpdatePlantGrowthStage(0, 0); UpdatePlantStage(PlantSpriteStage.None, PlantSpriteStage.Growing); UpdateHarvestFlag(showHarvestFlag, false); Inventory.ServerVanish(slot); Chat.AddActionMsgToChat(interaction.Performer, $"You plant the {Object.name} in the {gameObject.ExpensiveName()}.", $"{interaction.Performer.name} plants the {Object.name} in the {gameObject.ExpensiveName()}."); return; } //If plant is ready to harvest then make produce visible and update plant state if (plantData != null && ReadyToHarvest) { for (int i = 0; i < readyProduce.Count; i++) { CustomNetTransform netTransform = readyProduce[i].GetComponent <CustomNetTransform>(); netTransform.AppearAtPosition(registerTile.WorldPositionServer); netTransform.AppearAtPositionServer(registerTile.WorldPositionServer); } readyProduce.Clear(); //If plant is Perennial then reset growth to the start of growing stage if (plantData.PlantTrays.Contains(PlantTrays.Perennial_Growth)) { plantData.NextGrowthStageProgress = 0; UpdatePlantGrowthStage(growingPlantStage, 0); UpdatePlantStage(plantCurrentStage, PlantSpriteStage.Growing); UpdateHarvestFlag(harvestNotifier, false); } //Else remove plant from tray else { plantData = null; UpdatePlantStage(plantCurrentStage, PlantSpriteStage.None); UpdateHarvestFlag(harvestNotifier, false); } } //Commenting unless this causes issues /*else * { * UpdatePlantStage(plantCurrentStage, PlantSpriteStage.None); * }*/ }