-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdependency.lic
More file actions
68 lines (57 loc) · 1.57 KB
/
dependency.lic
File metadata and controls
68 lines (57 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## Originally build for Dragonrealms
## Copied over for Gemstone from: https://github.com/rpherbig/dr-scripts
## They weclome suggestions and contributions
require 'yaml'
require 'ostruct'
class SetupFiles
def initialize(debug)
@debug = debug
@load = true
@latest = false
@settings = {}
@extras = []
end
def request_settings(options)
@load = true
@extras = options
end
def loaded?
!@load
end
def run_queue
load_settings if @load
end
attr_reader :settings
## File edited for hunting variables only.
def load_settings
profile = "./scripts/profiles/creature-data.yaml"
if File.exist?(profile)
settings = YAML.load_file('./scripts/profiles/base.yaml')
settings.merge!(YAML.load_file(profile))
@extras.each do |subfile|
filepath = "./scripts/profiles/#{checkname}-#{subfile}.yaml"
basepath = "./scripts/profiles/base-#{subfile}.yaml"
if File.exist?(filepath)
settings.merge!(YAML.load_file(filepath))
elsif File.exist?(basepath)
settings.merge!(YAML.load_file(basepath))
else
echo("Tried to request setting file that doesn't exist #{subfile}")
end
end
end
@settings = OpenStruct.new(settings)
@load = false
end
end
$setupfiles = SetupFiles.new(debug)
def get_settings(options = [])
$setupfiles.request_settings(options)
pause 0.1 until $setupfiles.loaded?
$setupfiles.settings
end
loop do
$setupfiles.run_queue
pause 0.1
end
## End setup files