Пример #1
0
        public bool OnCycle()
        {
            if (this.SetItems.Count == 0 || !Requested)
            {
                return(false);
            }

            long Now = RavenEnvironment.Now();

            if (_next < Now)
            {
                foreach (Item Item in this.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;

                this._next     = 0;
                this.TickCount = Delay;
            }
            return(true);
        }
Пример #2
0
        public bool OnCycle()
        {
            if (Instance == null || !Requested || _next == 0)
            {
                return(false);
            }

            long Now = RavenEnvironment.Now();

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

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

                    Item.GetZ--;
                    Item.UpdateState();
                }

                _next = 0;
                return(true);
            }
            return(false);
        }
Пример #3
0
        public bool Execute(params object[] Params)
        {
            if (this._next == 0 || this._next < RavenEnvironment.Now())
            {
                this._next = RavenEnvironment.Now() + this.Delay;
            }


            this.Requested = true;
            this.TickCount = Delay;
            return(true);
        }
Пример #4
0
        public bool Execute(params object[] Params)
        {
            if (this.SetItems.Count == 0)
            {
                return(false);
            }

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

            if (!Requested)
            {
                this.TickCount = this.Delay;
                this.Requested = true;
            }
            return(true);
        }
Пример #5
0
        public bool OnCycle()
        {
            if (Instance == null || !Requested || _next == 0)
            {
                return(false);
            }

            long Now = RavenEnvironment.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);
        }
Пример #6
0
        public bool OnCycle()
        {
            if (Instance == null || !Requested || _next == 0)
            {
                return(false);
            }

            long Now = RavenEnvironment.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);
                    }

                    // Prueba de Pusheo para el Salinas, que no le funciona.
                    Point Point  = HandleMovement(Convert.ToInt32(this.StringData.Split(';')[0]), new Point(Item.GetX, Item.GetY));
                    int   newRot = HandleRotation(Convert.ToInt32(this.StringData.Split(';')[1]), Item.Rotation);

                    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);
                        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 (newRot != Item.Rotation)
                        {
                            Item.Rotation = newRot;
                            Item.UpdateState(false, true);
                        }

                        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);
        }