fCraft.TNTTask.PerformInternal C# (CSharp) Method

PerformInternal() protected method

protected PerformInternal ( ) : int
return int
        protected override int PerformInternal()
        {
            lock ( _world.SyncRoot ) {
                switch ( _stage ) {
                    case Stage.Waiting:
                        if ( !_gun ) {
                            if ( !_world.tntPhysics )// || _map.GetBlock(_pos) != Block.TNT) //TNT was removed for some reason, forget the xplosion
                                return 0; //remove task
                        }

                        UpdateMap( new BlockUpdate( null, _pos, Block.Air ) );

                        _stage = Stage.Exploding; //switch to expansion stage
                        if ( _particles ) {
                            CreateParticles();
                        }
                        Explosion();
                        return StepDelay;
                    case Stage.Exploding:
                        return Explosion() ? StepDelay : 0;//when done remove task
                    default:
                        throw new Exception( "State machine ist kaputt! tnt panic!" );
                }
            }
        }