From 8e23f8fd409d8fce754ffbbfda5e12595aaf66d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Sun, 21 Jun 2020 23:02:58 +0200 Subject: [PATCH] Food trash is optional by default. Fix FoodBase not having a FoodComponent. --- .../GameObjects/Components/Nutrition/FoodComponent.cs | 8 +++++++- Resources/Prototypes/Entities/Items/Consumables/food.yml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs index 7cdaa14916..ef13d79fb9 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Nutrition base.ExposeData(serializer); serializer.DataField(ref _useSound, "useSound", "/Audio/items/eatfood.ogg"); serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5)); - serializer.DataField(ref _trashPrototype, "trash", "TrashPlate"); + serializer.DataField(ref _trashPrototype, "trash", null); if (serializer.Reading) { @@ -171,6 +171,12 @@ namespace Content.Server.GameObjects.Components.Nutrition return true; } + if (string.IsNullOrEmpty(_trashPrototype)) + { + Owner.Delete(); + return true; + } + //We're empty. Become trash. var position = Owner.Transform.GridPosition; var finisher = Owner.EntityManager.SpawnEntity(_trashPrototype, position); diff --git a/Resources/Prototypes/Entities/Items/Consumables/food.yml b/Resources/Prototypes/Entities/Items/Consumables/food.yml index c4c909698e..a76f1400ce 100644 --- a/Resources/Prototypes/Entities/Items/Consumables/food.yml +++ b/Resources/Prototypes/Entities/Items/Consumables/food.yml @@ -3,6 +3,7 @@ id: FoodBase abstract: true components: + - type: Food - type: LoopingSound - type: Sprite state: icon