Fix mechanism events not being called properly, add test (#2279)
* Add mechanism events when added/removed to/from body/parts * Change old usages * Add TODO * Remove BodyExtensions and IHasBody * Remove unnecessary extensions and fix wrong event call in mechanism behavior component * Complete test and fix event calls
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components.Fluids;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Content.Shared.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
@@ -151,7 +152,8 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target.TryGetMechanismBehaviors<StomachBehaviorComponent>(out var stomachs))
|
||||
if (!target.TryGetComponent(out IBody body) ||
|
||||
!body.TryGetMechanismBehaviors<StomachBehaviorComponent>(out var stomachs))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user