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