javascript/features/playground/playground_commands.js
// own source files, which must be loaded asynchronously.
own source files, which must be loaded asynchronously.
own source files which must be loaded asynchronously .
async loadCommands() {
        const commandFiles = [
            'features/playground/commands/autohello.js',
            'features/playground/commands/boost.js',
            'features/playground/commands/engine.js',
            'features/playground/commands/fancy.js',
            'features/playground/commands/flap.js',
            'features/playground/commands/fly.js',
            'features/playground/commands/indicators.js',
            'features/playground/commands/jetpack.js',
            'features/playground/commands/kickflip.js',
            'features/playground/commands/lagcompmode.js',
            'features/playground/commands/player_settings.js',
            'features/playground/commands/isolate.js',
            'features/playground/commands/rampcar.js',
            'features/playground/commands/skipdamage.js',
            'features/playground/commands/slow.js',
        ];
        for (const commandFile of commandFiles) {
            const CommandImplementation = (await import(commandFile)).default;
            if (!CommandImplementation instanceof Command)
                throw new Error(filename + ' does not contain a command.');
            const command = new CommandImplementation(this.announce_, this.nuwani_);
            this.access_.registerCommand(command.name, command.defaultPlayerLevel);
            command.build(
                server.commandManager.buildCommand(command.name)
                    .restrict(PlaygroundAccessTracker.prototype.canAccessCommand.bind(this.access_,
                                                                                      command.name)));
            this.commands_.set(command.name, command);
        }
    }
async loadCommands ( ) { const commandFiles = [ 'features/playground/commands/autohello.js' , 'features/playground/commands/boost.js' , 'features/playground/commands/engine.js' , 'features/playground/commands/fancy.js' , 'features/playground/commands/flap.js' , 'features/playground/commands/fly.js' , 'features/playground/commands/indicators.js' , 'features/playground/commands/jetpack.js' , 'features/playground/commands/kickflip.js' , 'features/playground/commands/lagcompmode.js' , 'features/playground/commands/player_settings.js' , 'features/playground/commands/isolate.js' , 'features/playground/commands/rampcar.js' , 'features/playground/commands/skipdamage.js' , 'features/playground/commands/slow.js' , ] ; for ( const commandFile of commandFiles ) { const CommandImplementation = ( await import ( commandFile ) ) . default ; if ( ! CommandImplementation instanceof Command ) throw new Error ( filename + ' does not contain a command.' ) ; const command = new CommandImplementation ( this . announce_ , this . nuwani_ ) ; this . access_ . registerCommand ( command . name , command . defaultPlayerLevel ) ; command . build ( server . commandManager . buildCommand ( command . name ) . restrict ( PlaygroundAccessTracker . prototype . canAccessCommand . bind ( this . access_ , command . name ) ) ) ; this . commands_ . set ( command . name , command ) ; } }
own source files, which must be loaded asynchronously.
own source files which must be loaded asynchronously .
// Register the command with the access manager, and then pass on the server-global // command manager to its build() method so that it can be properly exposed. // Store the |command| in the |commands_| dictionary.