private void Milk(GameObject performer, ReagentContainer container) { if (currentMilkAmount < milkAmount) { onMilkedEmpty?.Invoke(performer, gameObject); mood.UpdateLevel(moodPenalty * -1); Chat.AddActionMsgToChat( performer, string.Format(noMilkMessage, performer.ExpensiveName(), mobAI.mobName.Capitalize()), "" ); return; } Chat.AddActionMsgToChat( performer, string.Format(milkMessageYou, mobAI.mobName.Capitalize()), string.Format(milkMessageOthers, mobAI.mobName.Capitalize(), performer.ExpensiveName()) ); currentMilkAmount -= milkAmount; var milkyMix = new ReagentMix(milkReagent, milkAmount, 40f); container.Add(milkyMix); }
private void CropDeath() { if (plantData.PlantTrays.Contains(PlantTrays.Weed_Adaptation)) { reagentContainer.Add(new ReagentMix(nutriment, plantData.Potency)); } if (plantData.PlantTrays.Contains(PlantTrays.Fungal_Vitality)) { reagentContainer.Add(new ReagentMix(water, plantData.Potency)); } UpdatePlantGrowthStage(growingPlantStage, 0); UpdatePlantStage(plantCurrentStage, PlantSpriteStage.Dead); plantData = null; readyProduce.Clear(); UpdateHarvestFlag(harvestNotifier, false); }
private void CropDeath() { if (plantData.PlantTrays.Contains(PlantTrays.Weed_Adaptation)) { reagentContainer.Add(new ReagentMix(nutriment, plantData.Potency)); } if (plantData.PlantTrays.Contains(PlantTrays.Fungal_Vitality)) { reagentContainer.Add(new ReagentMix(water, plantData.Potency)); } growingPlantStage = 0; plantCurrentStage = PlantSpriteStage.Dead; UpdateSprite(); plantData = null; readyProduce.Clear(); UpdateHarvestFlag(showHarvestFlag, false); }
/// <summary> /// Grind up the object. /// </summary> public void GrindFood() { if (isServer) { audioSourceGrind.Play(); grinderStorage = GetComponent <ReagentContainer>(); grinderStorage.Add(new ReagentMix(CraftingManager.Grind.FindOutputReagent(grind), outputAmount)); } grind = null; }
public void UpdateMe() { for (int i = storedFermentables.Count - 1; i >= 0; i--) { var slot = storedFermentables.Keys.ElementAt(i); var fermentable = storedFermentables[slot]; if (slot.IsEmpty == true) { continue; } if (fermentable == null) { Inventory.ServerDrop(slot); continue; } if (fermentable.AddFermentingTime(Time.deltaTime) == false) { continue; } var grownItem = slot.ItemObject.GetComponent <GrownFood>(); if (grownItem == null) { foreach (var reagent in fermentable.FermentedReagents) { container.Add(new ReagentMix(reagent.Key, reagent.Value, 293)); } } else { var amount = grownItem.GetPlantData().Potency / 4; foreach (var reagent in fermentable.FermentedReagents) { container.Add(new ReagentMix(reagent.Key, amount, 293)); } } SoundManager.PlayNetworkedAtPos(fermentedBubble, WorldPosition, sourceObj: gameObject); var item = slot.ItemObject; _ = Despawn.ServerSingle(item); storedFermentables.Remove(slot); } }
private static ReagentContainer GetContainer(int maxCapacity, ReagentMix contents) { GameObject obj = new GameObject(); obj.AddComponent <ReagentContainer>(); ReagentContainer container = obj.GetComponent <ReagentContainer>(); container.ReactionSet = new ReactionSet(); container.maxCapacity = maxCapacity; container.Add(contents); return(container); }
/// <summary> /// Takes initial values and scales them based on potency /// </summary> private void SetupChemicalContents() { ReagentMix CurrentReagentMix = new ReagentMix(); foreach (var reagentAndAmount in plantData.ReagentProduction) { CurrentReagentMix.Add(reagentAndAmount.ChemistryReagent, reagentAndAmount.Amount); } reagentContainer.Add(CurrentReagentMix); reagentContainer.Multiply(plantData.Potency / 100f * 2.5f); //40 Potency = * 1 }
private void Awake() { FoodContents = GetComponent <ReagentContainer>(); item = GetComponent <RegisterItem>(); itemAttributes = GetComponent <ItemAttributesV2>(); stackable = GetComponent <Stackable>(); FoodContents.Add(new ReagentMix(Nutriment, StartingNutrients, TemperatureUtils.ToKelvin(20f, TemeratureUnits.C))); if (itemAttributes != null) { itemAttributes.AddTrait(CommonTraits.Instance.Food); } else { Logger.LogErrorFormat("{0} prefab is missing ItemAttributes", Category.Objects, name); } }
private IEnumerator SpillAtScrubber(Scrubber scrubber, ReagentContainer container) { yield return(WaitFor.Seconds(Random.Range(spawnDelayRange.x, spawnDelayRange.y))); // Check that the scrubber is still fine to reference after this delay. if (scrubber == null || scrubber.registerTile == null) { yield break; } var reagentMix = new ReagentMix(); reagentMix.reagents.m_dict.Add(allReagents.PickRandom(), 75f); reagentMix.reagents.m_dict.Add(dispersionAgents.PickRandom(), 25f); container.Add(reagentMix); container.Spill(scrubber.registerTile.WorldPositionServer, 50f); // TODO: Play noise. }