Class: Factorix::CLI::Commands::Launch
- Defined in:
- lib/factorix/cli/commands/launch.rb
Overview
Launch Factorio game
This command launches the Factorio game executable with optional arguments. By default, the game is launched asynchronously (in the background), but certain options like –help and –dump-* are automatically detected and run synchronously.
Instance Method Summary collapse
-
#call(wait: false, args: []) ⇒ void
Execute the launch command.
Methods inherited from Base
backup_support!, confirmable!, inherited, require_game_stopped!
Instance Method Details
#call(wait: false, args: []) ⇒ void
This method returns an undefined value.
Execute the launch command
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/factorix/cli/commands/launch.rb', line 48 def call(wait: false, args: [], **) logger.info("Launching Factorio", args:) async = args.none? {|arg| SYNCHRONOUS_OPTIONS.include?(arg) } runtime.launch(*args, async:) logger.info("Factorio launched successfully", async:) return unless async && wait logger.debug("Waiting for game to start") wait_while { !runtime.running? } logger.debug("Game started, waiting for termination") wait_while { runtime.running? } logger.info("Game terminated") end |