Module: Factorix::CLI::Commands::RequiresGameStopped

Defined in:
lib/factorix/cli/commands/requires_game_stopped.rb

Overview

Mixin for commands that require the game to be stopped

This module provides automatic validation that the game is not running before executing commands that modify MOD installation state or mod-list.json/mod-settings.dat files.

Prepend this module in commands that should not run while the game is active (e.g., install, uninstall, enable, disable)

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ void

This method returns an undefined value.

Wrapper for command call that checks game state

Parameters:

  • options (Hash)

    command options passed to the original call method



18
19
20
21
22
23
24
25
26
# File 'lib/factorix/cli/commands/requires_game_stopped.rb', line 18

def call(**options)
  # Set @quiet before check_game_stopped because this module is prepended
  # after CommandWrapper (which normally sets @quiet), making it outer in
  # the call chain. If the game is running, the exception escapes before
  # CommandWrapper's rescue block is ever entered.
  @quiet = options[:quiet]
  check_game_stopped
  super
end