fCraft.World.EnablePlantPhysics C# (CSharp) Method

EnablePlantPhysics() public method

public EnablePlantPhysics ( Player player, bool announce ) : void
player Player
announce bool
return void
        public void EnablePlantPhysics( Player player, bool announce )
        {
            try {
                if ( null != _plantTask ) {
                    player.Message( "&WAlready enabled on this world" );
                    return;
                }
                plantPhysics = true;
                CheckIfPhysicsStarted();
                bool NotLoaded = false;
                if ( !this.IsLoaded ) { this.LoadMap(); NotLoaded = true; }
                _plantTask = new GrassTask( this );
                AddPhysicsTask( _plantTask, 0 );
                if ( announce )
                    Server.Message( "{0}&S enabled Plant Physics on {1}", player.ClassyName, ClassyName );
                if ( NotLoaded ) { this.UnloadMap( true ); }
            } catch ( Exception e ) {
                Logger.Log( LogType.Error, "PhyStartGrassPhysics: " + e );
            }
        }

Usage Example

Example #1
0
        public static void LoadSettings(XElement el, World world)
        {
            XAttribute temp;

            if ((temp = el.Attribute("plantPhysics")) != null)
            {
                bool isPhy;
                if (bool.TryParse(temp.Value, out isPhy))
                {
                    world.EnablePlantPhysics(Player.Console, false);
                }
            }
            if ((temp = el.Attribute("tntPhysics")) != null)
            {
                bool isPhy;
                if (bool.TryParse(temp.Value, out isPhy))
                {
                    world.EnableTNTPhysics(Player.Console, false);
                }
            }
            if ((temp = el.Attribute("waterPhysics")) != null)
            {
                bool isPhy;
                if (bool.TryParse(temp.Value, out isPhy))
                {
                    world.EnableWaterPhysics(Player.Console, false);
                }
            }
        }
All Usage Examples Of fCraft.World::EnablePlantPhysics