예제 #1
0
        public bool OnCycle()
        {
            if (SetItems.Count == 0 || !Requested)
            {
                return(false);
            }

            long Now = PlusEnvironment.Now();

            if (_next < Now)
            {
                foreach (Item Item in SetItems.Values.ToList())
                {
                    if (Item == null)
                    {
                        continue;
                    }

                    if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        Item n = null;
                        SetItems.TryRemove(Item.Id, out n);
                        continue;
                    }

                    Item.Interactor.OnWiredTrigger(Item);
                }

                Requested = false;

                _next     = 0;
                TickCount = Delay;
            }
            return(true);
        }
예제 #2
0
        public bool Execute(params object[] Params)
        {
            if (_next == 0 || _next < PlusEnvironment.Now())
            {
                _next = PlusEnvironment.Now() + Delay;
            }


            Requested = true;
            TickCount = Delay;
            return(true);
        }
예제 #3
0
        public bool Execute(params object[] Params)
        {
            if (this._next == 0 || this._next < PlusEnvironment.Now())
            {
                this._next = PlusEnvironment.Now() + this.Delay;
            }


            this.Requested = true;
            this.TickCount = Delay;
            return(true);
        }
        public bool Execute(params object[] Params)
        {
            if (this.SetItems.Count == 0)
            {
                return(false);
            }

            if (this._next == 0 || this._next < PlusEnvironment.Now())
            {
                this._next = PlusEnvironment.Now() + this.Delay;
            }

            if (!Requested)
            {
                this.TickCount = this.Delay;
                this.Requested = true;
            }
            return(true);
        }
예제 #5
0
        public bool Execute(params object[] Params)
        {
            if (SetItems.Count == 0)
            {
                return(false);
            }

            if (_next == 0 || _next < PlusEnvironment.Now())
            {
                _next = PlusEnvironment.Now() + Delay;
            }

            if (!Requested)
            {
                TickCount = Delay;
                Requested = true;
            }
            return(true);
        }
        public bool OnCycle()
        {
            if (Instance == null || !Requested || _next == 0)
            {
                return(false);
            }

            long Now = PlusEnvironment.Now();

            if (_next < Now)
            {
                foreach (Item Item in this.SetItems.Values.ToList())
                {
                    if (Item == null)
                    {
                        continue;
                    }

                    if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        continue;
                    }

                    Item toRemove = null;

                    if (Instance.GetWired().OtherBoxHasItem(this, Item.Id))
                    {
                        this.SetItems.TryRemove(Item.Id, out toRemove);
                    }

                    Point Point = Instance.GetGameMap().GetChaseMovement(Item);

                    Instance.GetWired().onUserFurniCollision(Instance, Item);

                    if (!Instance.GetGameMap().ItemCanMove(Item, Point))
                    {
                        continue;
                    }

                    if (Instance.GetGameMap().CanRollItemHere(Point.X, Point.Y) && !Instance.GetGameMap().SquareHasUsers(Point.X, Point.Y))
                    {
                        Double  NewZ        = Item.GetZ;
                        Boolean CanBePlaced = true;

                        List <Item> Items = Instance.GetGameMap().GetCoordinatedItems(Point);
                        foreach (Item IItem in Items.ToList())
                        {
                            if (IItem == null || IItem.Id == Item.Id)
                            {
                                continue;
                            }

                            if (!IItem.GetBaseItem().Walkable)
                            {
                                _next       = 0;
                                CanBePlaced = false;
                                break;
                            }

                            if (IItem.TotalHeight > NewZ)
                            {
                                NewZ = IItem.TotalHeight;
                            }

                            if (CanBePlaced == true && !IItem.GetBaseItem().Stackable)
                            {
                                CanBePlaced = false;
                            }
                        }

                        if (CanBePlaced && Point != Item.Coordinate)
                        {
                            Instance.SendMessage(new SlideObjectBundleComposer(Item.GetX, Item.GetY, Item.GetZ, Point.X,
                                                                               Point.Y, NewZ, 0, 0, Item.Id));
                            Instance.GetRoomItemHandler().SetFloorItem(Item, Point.X, Point.Y, NewZ);
                        }
                    }
                }

                _next = 0;
                return(true);
            }
            return(false);
        }
예제 #7
0
        public bool OnCycle()
        {
            if (Instance == null || !Requested || _next == 0)
            {
                return(false);
            }

            long Now = PlusEnvironment.Now();

            if (_next < Now)
            {
                foreach (Item Item in SetItems.Values.ToList())
                {
                    if (Item == null)
                    {
                        continue;
                    }

                    if (!Instance.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        continue;
                    }

                    Item toRemove = null;

                    if (Instance.GetWired().OtherBoxHasItem(this, Item.Id))
                    {
                        SetItems.TryRemove(Item.Id, out toRemove);
                    }


                    Point Point  = HandleMovement(Convert.ToInt32(StringData.Split(';')[0]), new Point(Item.GetX, Item.GetY));
                    int   newRot = HandleRotation(Convert.ToInt32(StringData.Split(';')[1]), Item.Rotation);

                    Instance.GetWired().OnUserFurniCollision(Instance, Item);

                    if (!Instance.GetGameMap().ItemCanMove(Item, Point))
                    {
                        continue;
                    }

                    if (Instance.GetGameMap().CanRollItemHere(Point.X, Point.Y) && !Instance.GetGameMap().SquareHasUsers(Point.X, Point.Y))
                    {
                        double NewZ        = Instance.GetGameMap().GetHeightForSquareFromData(Point);
                        bool   CanBePlaced = true;

                        List <Item> Items = Instance.GetGameMap().GetCoordinatedItems(Point);
                        foreach (Item IItem in Items.ToList())
                        {
                            if (IItem == null || IItem.Id == Item.Id)
                            {
                                continue;
                            }

                            if (!IItem.GetBaseItem().Walkable)
                            {
                                _next       = 0;
                                CanBePlaced = false;
                                break;
                            }

                            if (IItem.TotalHeight > NewZ)
                            {
                                NewZ = IItem.TotalHeight;
                            }

                            if (CanBePlaced == true && !IItem.GetBaseItem().Stackable)
                            {
                                CanBePlaced = false;
                            }
                        }

                        if (newRot != Item.Rotation)
                        {
                            Item.Rotation = newRot;
                            Item.UpdateState(false, true);
                        }

                        if (CanBePlaced && Point != Item.Coordinate)
                        {
                            Instance.SendPacket(new SlideObjectBundleComposer(Item.GetX, Item.GetY, Item.GetZ, Point.X,
                                                                              Point.Y, NewZ, 0, 0, Item.Id));
                            Instance.GetRoomItemHandler().SetFloorItem(Item, Point.X, Point.Y, NewZ);
                        }
                    }
                }

                _next = 0;
                return(true);
            }
            return(false);
        }