Ejemplo n.º 1
0
 /// <summary>
 ///     If the user is currently forcing someone do drink, this cancels the attempt if they swap hands or
 ///     otherwise loose the item. Prevents force-feeding dual-wielding.
 /// </summary>
 private void OnDrinkDeselected(EntityUid uid, DrinkComponent component, HandDeselectedEvent args)
 {
     if (component.CancelToken != null)
     {
         component.CancelToken.Cancel();
         component.CancelToken = null;
     }
 }
        /// <summary>
        ///     Calls HandDeselected on all components that implement the IHandDeselected interface
        ///     on an item entity on a hand that has just been deselected.
        /// </summary>
        public void HandDeselectedInteraction(IEntity user, IEntity item)
        {
            var handDeselectedMsg = new HandDeselectedEvent(user, item);

            RaiseLocalEvent(item.Uid, handDeselectedMsg);
            if (handDeselectedMsg.Handled)
            {
                return;
            }

            var comps = item.GetAllComponents <IHandDeselected>().ToList();

            // Call Land on all components that implement the interface
            foreach (var comp in comps)
            {
                comp.HandDeselected(new HandDeselectedEventArgs(user));
            }
        }
 private static void OnInjectorDeselected(EntityUid uid, InjectorComponent component, HandDeselectedEvent args)
 {
     component.CancelToken?.Cancel();
     component.CancelToken = null;
 }