Fix two crashes relating to food (#600)
* Fix crash when eating bread due to a missing prototype * Fix crash when finishing a food. It tried to get the transform component of a deleted entity.
This commit is contained in:
committed by
GitHub
parent
51c24150d3
commit
6bd818c8ce
@@ -155,11 +155,12 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var position = Owner.Transform.GridPosition;
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
|
|
||||||
if (_finishPrototype != null)
|
if (_finishPrototype != null)
|
||||||
{
|
{
|
||||||
var finisher = Owner.EntityManager.SpawnEntity(_finishPrototype, Owner.Transform.GridPosition);
|
var finisher = Owner.EntityManager.SpawnEntity(_finishPrototype, position);
|
||||||
if (user.TryGetComponent(out HandsComponent handsComponent) && finisher.TryGetComponent(out ItemComponent itemComponent))
|
if (user.TryGetComponent(out HandsComponent handsComponent) && finisher.TryGetComponent(out ItemComponent itemComponent))
|
||||||
{
|
{
|
||||||
if (handsComponent.CanPutInHand(itemComponent))
|
if (handsComponent.CanPutInHand(itemComponent))
|
||||||
|
|||||||
@@ -178,6 +178,23 @@
|
|||||||
- type: Icon
|
- type: Icon
|
||||||
sprite: Objects/Food/baguette.rsi
|
sprite: Objects/Food/baguette.rsi
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
name: Bread (slice)
|
||||||
|
parent: FoodBase
|
||||||
|
id: FoodBreadSlice
|
||||||
|
description:
|
||||||
|
components:
|
||||||
|
- type: Food
|
||||||
|
contents:
|
||||||
|
reagents:
|
||||||
|
- ReagentId: chem.Nutriment
|
||||||
|
Quantity: 8
|
||||||
|
spawn_on_finish: TrashPlate
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Food/breadslice.rsi
|
||||||
|
- type: Icon
|
||||||
|
sprite: Objects/Food/breadslice.rsi
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: Banana bread (slice)
|
name: Banana bread (slice)
|
||||||
parent: FoodBase
|
parent: FoodBase
|
||||||
|
|||||||
Reference in New Issue
Block a user