public virtual void Eat(PlayerScript eater, PlayerScript feeder) { //TODO: Reimplement metabolism. 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()); } var feederSlot = feeder.ItemStorage.GetActiveHandSlot(); //If food has a stack component, decrease amount by one instead of deleting the entire stack. if (stackable != null) { stackable.ServerConsume(1); } else { 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 void LoadSliver(Pickupable toLoad) { Inventory.ServerAdd(toLoad, sliverSlot); }