Inheritance: PhysicsTask
示例#1
0
        private bool CanGrow(int height) //no shadows and enough space
        {
            for (int z = _z + 1; z < _map.Height; ++z)
            {
                if (GrassTask.CastsShadow(_map.GetBlock(_x, _y, z)))
                {
                    return(false);
                }
            }

            for (int x = _x - 5; x < _x + 5; ++x)
            {
                for (int y = _y - 5; y < _y + 5; ++y)
                {
                    for (int z = _z + 1; z < _z + height; ++z)
                    {
                        Block b = _map.GetBlock(x, y, z);
                        if (Block.Air != b && Block.Leaves != b)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
示例#2
0
 public void DisablePlantPhysics(Player player, bool announce)
 {
     if (null == _plantTask)
     {
         player.Message("&WAlready disabled on this world");
         return;
     }
     _plantTask.Deleted = true;
     _plantTask = null;
     CheckIfToStopPhysics();
     plantPhysics = false;
     if (announce)
     Server.Message("{0}&S disabled Plant Physics on {1}", player.ClassyName, ClassyName);
 }
示例#3
0
        public void EnablePlantPhysics(Player player, bool announce)
        {
            if (null != _plantTask)
            {
                player.Message("&WAlready enabled on this world");
                return;
            }
            plantPhysics = true;
            CheckIfPhysicsStarted();
            _plantTask = new GrassTask(this);
			AddPhysicsTask(_plantTask, 0);
            if(announce)
            Server.Message("{0}&S enabled Plant Physics on {1}", player.ClassyName, ClassyName);
        }
示例#4
0
 public void EnablePlantPhysics(Player player, bool announce)
 {
     if (null != _plantTask)
     {
         player.Message("&WAlready enabled on this world");
         return;
     }
     plantPhysics = true;
     CheckIfPhysicsStarted();
     _plantTask = new GrassTask(this);
     AddPhysicsTask(_plantTask, 0);
     if(announce)
     Server.Message("{0}&S enabled Plant Physics on {1}", player.ClassyName, ClassyName);
 }
示例#5
0
 public void DisablePlantPhysics(Player player, bool announce)
 {
     if (null == _plantTask)
     {
         player.Message("&WAlready disabled on this world");
         return;
     }
     _plantTask.Deleted = true;
     _plantTask = null;
     CheckIfToStopPhysics();
     plantPhysics = false;
     if (announce)
     Server.Message("{0}&S disabled Plant Physics on {1}", player.ClassyName, ClassyName);
 }
示例#6
0
文件: World.cs 项目: 727021/800craft
 public void EnablePlantPhysics(Player player, bool announce)
 {
     try
     {
         if (null != _plantTask)
         {
             player.Message("&WAlready enabled on this world");
             return;
         }
         plantPhysics = true;
         CheckIfPhysicsStarted();
         _plantTask = new GrassTask(this);
         AddPhysicsTask(_plantTask, 0);
         if (announce)
             Server.Message("{0}&S enabled Plant Physics on {1}", player.ClassyName, ClassyName);
     }
     catch (Exception e)
     {
         Logger.Log(LogType.Error, "PhyStartGrassPhysics: " + e);
     }
 }
示例#7
0
文件: World.cs 项目: 727021/800craft
 public void DisablePlantPhysics(Player player, bool announce)
 {
     try
     {
         if (null == _plantTask)
         {
             player.Message("&WAlready disabled on this world");
             return;
         }
         _plantTask.Deleted = true;
         _plantTask = null;
         CheckIfToStopPhysics();
         plantPhysics = false;
         if (announce)
             Server.Message("{0}&S disabled Plant Physics on {1}", player.ClassyName, ClassyName);
     }
     catch (Exception e)
     {
         Logger.Log(LogType.Error, "PhyStopGrassPhysics: " + e);
     }
 }