Example #1
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];
            RoomItem roomItem = (RoomItem)stuff[1];

            int userPosition     = roomUser.X;
            int lastUserPosition = roomUser.CopyX;

            if (!Items.Contains(roomItem) || (roomUser.LastItem != 0 && roomUser.LastItem == roomItem.Id && userPosition == lastUserPosition))
            {
                return(false);
            }

            if (roomItem.GetRoom() == null || roomItem.GetRoom().GetRoomItemHandler() == null || roomItem.GetRoom().GetRoomItemHandler().FloorItems.Values.Any(i => i.X == roomItem.X && i.Y == roomItem.Y && i.Z > roomItem.Z))
            {
                return(false);
            }

            ToWork.Enqueue(roomUser);

            if (Delay == 0)
            {
                OnCycle();
            }
            else
            {
                _mNext = Yupi.Now() + Delay;

                Room.GetWiredHandler().EnqueueCycle(this);
            }

            return(true);
        }
Example #2
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];
            RoomItem roomItem = (RoomItem)stuff[1];

            if (!Items.Contains(roomItem) || roomUser.LastItem != roomItem.Id)
            {
                return(false);
            }

            if (
                roomItem.AffectedTiles.Values.Any(
                    current =>
                    (current.X == roomUser.X && current.Y == roomUser.Y) ||
                    (roomUser.X == roomItem.X && roomUser.Y == roomItem.Y)))
            {
                return(false);
            }

            ToWork.Enqueue(roomUser);

            if (Delay == 0)
            {
                OnCycle();
            }
            else
            {
                _mNext = Yupi.Now() + Delay;

                Room.GetWiredHandler().EnqueueCycle(this);
            }

            return(true);
        }
Example #3
0
        public bool Execute(params object[] stuff)
        {
            var roomUser = (RoomUser)stuff[0];
            var roomItem = (RoomItem)stuff[1];

            if (!Items.Contains(roomItem) || (roomUser.LastItem != 0 && roomUser.LastItem == roomItem.Id))
            {
                return(false);
            }
            ToWork.Enqueue(roomUser);
            if (Delay == 0)
            {
                OnCycle();
            }
            else
            {
                _mNext = (Plus.Now() + (Delay));

                Room.GetWiredHandler().EnqueueCycle(this);
            }
            return(true);
        }