private void OnAttemptOpen(EntityUid uid, CrematoriumComponent component, StorageOpenAttemptEvent args) { if (component.Cooking) { args.Cancel(); } }
private void OnStorageOpenAttempt(EntityUid uid, LockComponent component, StorageOpenAttemptEvent args) { if (component.Locked) { if (!args.Silent) { _sharedPopupSystem.PopupEntity(Loc.GetString("entity-storage-component-locked-message"), uid, Filter.Pvs(uid)); } args.Cancel(); } }
public bool CanOpen(EntityUid user, EntityUid target, bool silent = false, EntityStorageComponent?component = null) { if (!Resolve(target, ref component)) { return(false); } if (!HasComp <SharedHandsComponent>(user)) { return(false); } if (component.IsWeldedShut) { if (!silent && !component.Contents.Contains(user)) { _popupSystem.PopupEntity(Loc.GetString("entity-storage-component-welded-shut-message"), target, Filter.Pvs(target)); } return(false); } //Checks to see if the opening position, if offset, is inside of a wall. if (component.EnteringOffset != (0, 0)) //if the entering position is offset { var targetXform = Transform(target); var newCoords = new EntityCoordinates(target, component.EnteringOffset); if (!_interactionSystem.InRangeUnobstructed(target, newCoords, collisionMask: component.EnteringOffsetCollisionFlags)) { if (!silent) { _popupSystem.PopupEntity(Loc.GetString("entity-storage-component-cannot-open-no-space"), target, Filter.Pvs(target)); } return(false); } } var ev = new StorageOpenAttemptEvent(silent); RaiseLocalEvent(target, ev, true); return(!ev.Cancelled); }
private void OnFoldableOpenAttempt(EntityUid uid, FoldableComponent component, StorageOpenAttemptEvent args) { if (component.IsFolded) { args.Cancel(); } }