/// <summary>
        ///     Calls Dropped on all components that implement the IDropped interface
        ///     on an entity that has been dropped.
        /// </summary>
        public void DroppedInteraction(IEntity user, IEntity item, bool intentional)
        {
            var dropMsg = new DroppedEvent(user, item, intentional);

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

            item.Transform.LocalRotation = intentional ? Angle.Zero : (_random.Next(0, 100) / 100f) * MathHelper.TwoPi;

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

            // Call Land on all components that implement the interface
            foreach (var comp in comps)
            {
                comp.Dropped(new DroppedEventArgs(user, intentional));
            }
        }
Exemple #2
0
        /// <summary>
        ///     Calls Dropped on all components that implement the IDropped interface
        ///     on an entity that has been dropped.
        /// </summary>
        public void DroppedInteraction(EntityUid user, EntityUid item)
        {
            var dropMsg = new DroppedEvent(user, item);

            RaiseLocalEvent(item, dropMsg);
            if (dropMsg.Handled)
            {
                _adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{user} dropped {item}");
                return;
            }

            EntityManager.GetComponent <TransformComponent>(item).LocalRotation = Angle.Zero;

            var comps = EntityManager.GetComponents <IDropped>(item).ToList();

            // Call Land on all components that implement the interface
            foreach (var comp in comps)
            {
                comp.Dropped(new DroppedEventArgs(user));
            }
            _adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{user} dropped {item}");
        }