private void Eat(PlayerScript eater, PlayerScript feeder, bool FeedNutrients) { //SoundManager.PlayNetworkedAtPos(sound, eater.WorldPos, sourceObj: eater.gameObject); if (FeedNutrients) { var Stomachs = eater.playerHealth.GetStomachs(); if (Stomachs.Count == 0) { //No stomachs?! return; } FoodContents.Divide(Stomachs.Count); foreach (var Stomach in Stomachs) { Stomach.StomachContents.Add(FoodContents.CurrentReagentMix.Clone()); } } var feederSlot = feeder.ItemStorage.GetActiveHandSlot(); Inventory.ServerDespawn(gameObject); if (leavings != null) { var leavingsInstance = Spawn.ServerPrefab(leavings).GameObject; var pickupable = leavingsInstance.GetComponent <Pickupable>(); bool added = Inventory.ServerAdd(pickupable, feederSlot); if (!added) { //If stackable has leavings and they couldn't go in the same slot, they should be dropped pickupable.CustomNetTransform.SetPosition(feeder.WorldPos); } } }
public override void Eat(PlayerScript eater, PlayerScript feeder) { // TODO: missing sound? //SoundManager.PlayNetworkedAtPos(sound, eater.WorldPos, sourceObj: eater.gameObject); var stomachs = eater.playerHealth.GetStomachs(); if (stomachs.Count == 0) { //No stomachs?! return; } FoodContents.Divide(stomachs.Count); foreach (var stomach in stomachs) { stomach.StomachContents.Add(FoodContents.CurrentReagentMix.Clone()); } _ = Pregnancy(eater.playerHealth); var feederSlot = feeder.ItemStorage.GetActiveHandSlot(); Inventory.ServerDespawn(feederSlot); }