Skip to content

Commit d327f46

Browse files
committed
fix: custon enemy loading tweaks, ipairs migrations
1 parent 07e81a7 commit d327f46

File tree

3 files changed

+221
-244
lines changed

3 files changed

+221
-244
lines changed

enemies.lua

+6-8
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,10 @@ function loadenemy(filename)
156156
end
157157
else
158158
--Put enemy for later loading because base hasn't been loaded yet
159-
if not success then
160-
if not loaddelayed[base] then
161-
loaddelayed[base] = {}
162-
end
163-
table.insert(loaddelayed[base], filename)
159+
if not loaddelayed[base] then
160+
loaddelayed[base] = {}
164161
end
162+
table.insert(loaddelayed[base], filename)
165163
--print("DON'T HAVE BASE " .. base .. " FOR " .. s)
166164
if editormode then
167165
--notice.new("don't have base " .. base .. " for " .. s)
@@ -302,10 +300,10 @@ function loadenemy(filename)
302300

303301

304302
if loaddelayed[s] and #loaddelayed[s] > 0 then
305-
for j = #loaddelayed[s], 1, -1 do
306-
loadenemy(loaddelayed[s][j]) --RECURSIVE PROGRAMMING AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH
307-
table.remove(loaddelayed, j)
303+
for ji, jv in ipairs(loaddelayed[s]) do
304+
loadenemy(jv)
308305
end
306+
loaddelayed[s] = nil
309307
end
310308
else
311309
--Bad.

0 commit comments

Comments
 (0)