using Content.Shared.Popups; using Content.Shared.Construction.Components; namespace Content.Shared.Gravity; public abstract class SharedGravityGeneratorSystem : EntitySystem { [Dependency] private readonly SharedPopupSystem _popupSystem = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnUnanchorAttempt); } /// /// Prevent unanchoring when gravity is active /// private void OnUnanchorAttempt(Entity ent, ref UnanchorAttemptEvent args) { if (!ent.Comp.GravityActive) return; _popupSystem.PopupClient(Loc.GetString("gravity-generator-unanchoring-failed"), ent.Owner, args.User, PopupType.Medium); args.Cancel(); } }