made the check for archetype better, fixed reposition into restart game
This commit is contained in:
parent
dbfae2f74e
commit
6dd970c1d4
@ -44,6 +44,7 @@ function stepGame()
|
||||
end
|
||||
|
||||
if Keybind:checkPressed(Keybind.debug.reposition) then
|
||||
restartGame()
|
||||
end
|
||||
|
||||
if Keybind:checkPressed(Keybind.debug.reload) then
|
||||
|
@ -72,13 +72,19 @@ function promptSpawnArchetype()
|
||||
input = spawn.archetype.type,
|
||||
spawn = spawn,
|
||||
func = function(prompt)
|
||||
local arch = spawn.archetype
|
||||
print("return "..prompt.input)
|
||||
local f = loadstring("return "..prompt.input)
|
||||
if f == nil then
|
||||
if f ~= nil then
|
||||
local succ, arch = pcall(f)
|
||||
print(succ, arch)
|
||||
if not succ
|
||||
or type(arch) ~= "table"
|
||||
or type(arch.type) ~= "string"
|
||||
then
|
||||
arch = spawn.archetype
|
||||
end
|
||||
print(succ, arch)
|
||||
spawn.archetype = arch
|
||||
else
|
||||
spawn.archetype = f()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user