diff --git a/Content.Server/GameObjects/Components/AnchorableComponent.cs b/Content.Server/GameObjects/Components/AnchorableComponent.cs
index 368f6f1cce..e529354283 100644
--- a/Content.Server/GameObjects/Components/AnchorableComponent.cs
+++ b/Content.Server/GameObjects/Components/AnchorableComponent.cs
@@ -83,6 +83,13 @@ namespace Content.Server.GameObjects.Components
if (_physicsComponent == null)
return false;
+ var attempt = new AnchorAttemptMessage();
+
+ Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, attempt, false);
+
+ if (attempt.Cancelled)
+ return false;
+
_physicsComponent.BodyType = BodyType.Static;
// Snap rotation to cardinal (multiple of 90)
@@ -100,6 +107,8 @@ namespace Content.Server.GameObjects.Components
if (Snap)
Owner.SnapToGrid(SnapGridOffset.Center, Owner.EntityManager);
+ Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new AnchoredMessage(), false);
+
return true;
}
@@ -120,8 +129,17 @@ namespace Content.Server.GameObjects.Components
if (_physicsComponent == null)
return false;
+ var attempt = new UnanchorAttemptMessage();
+
+ Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, attempt, false);
+
+ if (attempt.Cancelled)
+ return false;
+
_physicsComponent.BodyType = BodyType.Dynamic;
+ Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new UnanchoredMessage(), false);
+
return true;
}
@@ -147,4 +165,10 @@ namespace Content.Server.GameObjects.Components
return await TryToggleAnchor(eventArgs.User, eventArgs.Using);
}
}
+
+ public class AnchorAttemptMessage : CancellableEntityEventArgs { }
+ public class UnanchorAttemptMessage : CancellableEntityEventArgs { }
+
+ public class AnchoredMessage : EntityEventArgs {}
+ public class UnanchoredMessage : EntityEventArgs {}
}
diff --git a/SpaceStation14.sln.DotSettings b/SpaceStation14.sln.DotSettings
index 171ae04e43..d67a3f3f24 100644
--- a/SpaceStation14.sln.DotSettings
+++ b/SpaceStation14.sln.DotSettings
@@ -165,6 +165,9 @@
True
True
True
+ True
+ True
+ True
True
True
True