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);
|
base.ExposeData(serializer);
|
||||||
serializer.DataField(ref _useSound, "useSound", "/Audio/items/eatfood.ogg");
|
serializer.DataField(ref _useSound, "useSound", "/Audio/items/eatfood.ogg");
|
||||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5));
|
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5));
|
||||||
serializer.DataField(ref _trashPrototype, "trash", "TrashPlate");
|
serializer.DataField(ref _trashPrototype, "trash", null);
|
||||||
|
|
||||||
if (serializer.Reading)
|
if (serializer.Reading)
|
||||||
{
|
{
|
||||||
@@ -171,6 +171,12 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(_trashPrototype))
|
||||||
|
{
|
||||||
|
Owner.Delete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//We're empty. Become trash.
|
//We're empty. Become trash.
|
||||||
var position = Owner.Transform.GridPosition;
|
var position = Owner.Transform.GridPosition;
|
||||||
var finisher = Owner.EntityManager.SpawnEntity(_trashPrototype, position);
|
var finisher = Owner.EntityManager.SpawnEntity(_trashPrototype, position);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
id: FoodBase
|
id: FoodBase
|
||||||
abstract: true
|
abstract: true
|
||||||
components:
|
components:
|
||||||
|
- type: Food
|
||||||
- type: LoopingSound
|
- type: LoopingSound
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: icon
|
state: icon
|
||||||
|
|||||||
Reference in New Issue
Block a user