Food trash is optional by default. Fix FoodBase not having a FoodComponent.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user