Skip to content

Commit 18333ed

Browse files
committed
Remove conditional logic from dfhack
1 parent e6e8bc7 commit 18333ed

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

dist/library/hack/dfhack.lua

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,7 @@ COLOR_DARKGRAY = COLOR_DARKGREY
5151

5252
-- Events
5353

54-
if dfhack.is_core_context then
55-
SC_WORLD_LOADED = 0
56-
SC_WORLD_UNLOADED = 1
57-
SC_MAP_LOADED = 2
58-
SC_MAP_UNLOADED = 3
59-
SC_VIEWSCREEN_CHANGED = 4
60-
SC_CORE_INITIALIZED = 5
61-
SC_PAUSED = 7
62-
SC_UNPAUSED = 8
63-
end
54+
6455

6556
-- User-changeable options
6657

@@ -494,8 +485,7 @@ function dfhack.run_command(...) end
494485

495486
function dfhack.getSavePath() end
496487

497-
if dfhack.is_core_context then
498-
488+
499489

500490
-- Feed the table back to the require() mechanism.
501491
return dfhack

lib/generate.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ def parse_lua_files(files)
178178
# Remove `_ENV` as it is problematic.
179179
file.gsub!(/^.*_ENV.*$/, '')
180180

181+
# Remove all if statements, conditional logic is hard (for now).
182+
file.gsub!(/^if[\s\S]+?(^end)/, '')
183+
181184
# Remove local functions entirely, they are not needed.
182185
file.gsub!(/(?:local\s+function\s+)(.*\([^)]*\))[\s\S]+?(?:^end)/, '')
183186

0 commit comments

Comments
 (0)