private void OnUseInHand(EntityUid uid, HandLabelerComponent handLabeler, UseInHandEvent args) { if (!args.User.TryGetComponent(out ActorComponent? actor)) { return; } handLabeler.Owner.GetUIOrNull(HandLabelerUiKey.Key)?.Open(actor.PlayerSession); args.Handled = true; }
private void OnHandLabelerLabelChanged(EntityUid uid, HandLabelerComponent handLabeler, HandLabelerLabelChangedMessage args) { if (!CheckInteract(args.Session)) { return; } handLabeler.AssignedLabel = args.Label.Trim().Substring(0, Math.Min(handLabeler.MaxLabelChars, args.Label.Length)); DirtyUI(uid, handLabeler); }
private void OnActivate(EntityUid uid, HandLabelerComponent handLabeler, ActivateInWorldEvent args) { if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) { return; } handLabeler.Owner.GetUIOrNull(HandLabelerUiKey.Key)?.Open(actor.PlayerSession); args.Handled = true; }
private void AfterInteractOn(EntityUid uid, HandLabelerComponent handLabeler, AfterInteractEvent args) { if (args.Target == null || !handLabeler.Whitelist.IsValid(args.Target)) { return; } AddLabelTo(uid, handLabeler, args.Target, out string?result); if (result != null) { handLabeler.Owner.PopupMessage(args.User, result); } }
private void OnHandLabelerLabelChanged(EntityUid uid, HandLabelerComponent handLabeler, HandLabelerLabelChangedMessage args) { handLabeler.AssignedLabel = args.Label.Trim().Substring(0, Math.Min(handLabeler.MaxLabelChars, args.Label.Length)); DirtyUI(uid, handLabeler); }