Exemple #1
0
 public void AirCheckGravity(int x, int y, int z)
 {
     if (Blocks.AffectedByGravity(world.GetTile(x, y + 1, z)) && world.GetTile(x, y + 1, z) != Blocks.air)
     {
         SandGravelFall(x, y + 1, z, world.GetTile(x, y + 1, z));
     }
 }
Exemple #2
0
        public void Update()
        {
            if (updateQueue.Count == 0)
            {
                return;
            }
            lock (queueLock)
            {
                int n = updateQueue.Count;
                for (int i = 0; i < n; i++)
                {
                    PhysicsBlock block = updateQueue.Dequeue();
                    if (((TimeSpan)(DateTime.Now - block.startTime)).TotalMilliseconds >= PhysicsTime(block.type))
                    {
                        switch (block.type)
                        {
                        case Blocks.air:
                            AirCheck(block.x, block.y, block.z);
                            break;

                        case Blocks.water:
                            GenericSpread(block.x, block.y, block.z, block.type, false);
                            CheckWaterLavaCollide(block.x, block.y, block.z, block.type);
                            break;

                        case Blocks.lava:
                            GenericSpread(block.x, block.y, block.z, block.type, false);
                            CheckWaterLavaCollide(block.x, block.y, block.z, block.type);
                            break;

                        case Blocks.unflood:
                            Unflood(block.x, block.y, block.z, block.type);
                            break;

                        case Blocks.sponge:
                            NewSponge(block.x, block.y, block.z);
                            break;

                        case Blocks.staircasestep:
                            Staircase(block);
                            break;

                        default:
                            if (Blocks.AffectedByGravity(block.type))
                            {
                                SandGravelFall(block.x, block.y, block.z, block.type);
                            }
                            break;
                        }
                    }
                    else
                    {
                        updateQueue.Enqueue(block);
                    }
                }
            }
        }