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
|
end
|
||||||
|
|
||||||
if Keybind:checkPressed(Keybind.debug.reposition) then
|
if Keybind:checkPressed(Keybind.debug.reposition) then
|
||||||
|
restartGame()
|
||||||
end
|
end
|
||||||
|
|
||||||
if Keybind:checkPressed(Keybind.debug.reload) then
|
if Keybind:checkPressed(Keybind.debug.reload) then
|
||||||
|
@ -72,13 +72,19 @@ function promptSpawnArchetype()
|
|||||||
input = spawn.archetype.type,
|
input = spawn.archetype.type,
|
||||||
spawn = spawn,
|
spawn = spawn,
|
||||||
func = function(prompt)
|
func = function(prompt)
|
||||||
local arch = spawn.archetype
|
|
||||||
print("return "..prompt.input)
|
print("return "..prompt.input)
|
||||||
local f = loadstring("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
|
spawn.archetype = arch
|
||||||
else
|
|
||||||
spawn.archetype = f()
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user