Food trash is optional by default. Fix FoodBase not having a FoodComponent.
This commit is contained in:
parent
b6966a9b7f
commit
8e23f8fd40
2 changed files with 8 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
id: FoodBase
|
||||
abstract: true
|
||||
components:
|
||||
- type: Food
|
||||
- type: LoopingSound
|
||||
- type: Sprite
|
||||
state: icon
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue