Class: Modsvaskr::Xedit

Inherits:
Object
  • Object
show all
Includes:
RunCmd
Defined in:
lib/modsvaskr/xedit.rb

Overview

Helper to use an instance of xEdit

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RunCmd

#run_cmd

Constructor Details

#initialize(install_path, game_path) ⇒ Xedit

Constructor

Parameters
  • install_path (String): Installation path of xEdit

  • game_path (String): Installation path of the game to use xEdit on



18
19
20
21
22
23
# File 'lib/modsvaskr/xedit.rb', line 18

def initialize(install_path, game_path)
  @install_path = install_path
  @game_path = game_path
  # Set of scripts that have been run
  @runs = {}
end

Instance Attribute Details

#install_pathObject (readonly)

String: Installation path



11
12
13
# File 'lib/modsvaskr/xedit.rb', line 11

def install_path
  @install_path
end

Instance Method Details

#run_script(script, only_once: false) ⇒ Object

Run an xEdit script

Parameters
  • script (String): Script name, as defined in xedit_scripts (without the Modsvaskr_ prefix and .pas suffix)

  • only_once (Boolean): If true, then make sure this script is run only once by instance [default: false]



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/modsvaskr/xedit.rb', line 30

def run_script(script, only_once: false)
  if false
  # if !only_once || [email protected]?(script)
    FileUtils.cp "#{__dir__}/../../xedit_scripts/Modsvaskr_#{script}.pas", "#{@install_path}/Edit Scripts/Modsvaskr_#{script}.pas"
    run_cmd(
      {
        dir: @install_path,
        exe: 'SSEEdit.exe'
      },
      args: %W[
        -IKnowWhatImDoing
        -AllowMasterFilesEdit
        -SSE
        -autoload
        -script:"Modsvaskr_#{script}.pas"
      ]
    )
    @runs[script] = nil
  end
end