private bool CanWeld(EntityUid uid, EntityUid tool, EntityUid user, WeldableComponent?component = null) { if (!Resolve(uid, ref component)) { return(false); } // Basic checks if (!component.Weldable || component.BeingWelded) { return(false); } if (!_toolSystem.HasQuality(tool, component.WeldingQuality)) { return(false); } // Other component systems var attempt = new WeldableAttemptEvent(user, tool); RaiseLocalEvent(uid, attempt, true); if (attempt.Cancelled) { return(false); } return(true); }
private void OnWeldAttempt(EntityUid uid, DoorComponent component, WeldableAttemptEvent args) { if (component.CurrentlyCrushing.Count > 0) { args.Cancel(); return; } if (component.State != DoorState.Closed && component.State != DoorState.Welded) { args.Cancel(); } }
private void OnWeldableAttempt(EntityUid uid, EntityStorageComponent component, WeldableAttemptEvent args) { if (component.Open) { args.Cancel(); return; } if (component.Contents.Contains(args.User)) { var msg = Loc.GetString("entity-storage-component-already-contains-user-message"); _popupSystem.PopupEntity(msg, args.User, Filter.Entities(args.User)); args.Cancel(); } }