/// <summary> /// Pry open a door. This does not check if the user is holding the required tool. /// </summary> private bool TryPryDoor(EntityUid target, EntityUid tool, EntityUid user, DoorComponent door) { if (door.State == DoorState.Welded) { return(false); } var canEv = new BeforeDoorPryEvent(user); RaiseLocalEvent(target, canEv, false); if (canEv.Cancelled) { // mark handled, as airlock component will cancel after generating a pop-up & you don't want to pry a tile // under a windoor. return(true); } var modEv = new DoorGetPryTimeModifierEvent(); RaiseLocalEvent(target, modEv, false); _toolSystem.UseTool(tool, user, target, 0f, modEv.PryTimeModifier * door.PryTime, door.PryingQuality, new PryFinishedEvent(), new PryCancelledEvent(), target); return(true); // we might not actually succeeded, but a do-after has started }
private void OnDoorPry(EntityUid uid, AirlockComponent component, BeforeDoorPryEvent args) { if (component.IsBolted()) { component.Owner.PopupMessage(args.Args.User, Loc.GetString("airlock-component-cannot-pry-is-bolted-message")); args.Cancel(); } if (component.IsPowered()) { component.Owner.PopupMessage(args.Args.User, Loc.GetString("airlock-component-cannot-pry-is-powered-message")); args.Cancel(); } }
private void OnBeforeDoorPry(EntityUid uid, FirelockComponent component, BeforeDoorPryEvent args) { if (!TryComp <DoorComponent>(uid, out var door) || door.State != DoorState.Closed) { return; } if (component.IsHoldingPressure()) { component.Owner.PopupMessage(args.User, Loc.GetString("firelock-component-is-holding-pressure-message")); } else if (component.IsHoldingFire()) { component.Owner.PopupMessage(args.User, Loc.GetString("firelock-component-is-holding-fire-message")); } }
private void OnBeforeDoorPry(EntityUid uid, FirelockComponent component, BeforeDoorPryEvent args) { if (component.DoorComponent == null || component.DoorComponent.State != SharedDoorComponent.DoorState.Closed) { return; } if (component.IsHoldingPressure()) { component.Owner.PopupMessage(args.Args.User, Loc.GetString("firelock-component-is-holding-pressure-message")); } else if (component.IsHoldingFire()) { component.Owner.PopupMessage(args.Args.User, Loc.GetString("firelock-component-is-holding-fire-message")); } }