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();
|
||||
|
||||
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 (handsComponent.CanPutInHand(itemComponent))
|
||||
|
||||
Reference in New Issue
Block a user