prompt box style, entity prompts improvement, killing entities and particles improvement
This commit is contained in:
@@ -76,25 +76,35 @@ function promptSpawnArchetype()
|
||||
local f = loadstring("return "..prompt.input)
|
||||
if f ~= nil then
|
||||
local succ, arch = pcall(f)
|
||||
print(succ, arch)
|
||||
print("archetype changed --",succ)
|
||||
print("from: ", spawn.archetype.type)
|
||||
if not succ
|
||||
or type(arch) ~= "table"
|
||||
or type(arch.type) ~= "string"
|
||||
then
|
||||
arch = spawn.archetype
|
||||
end
|
||||
print(succ, arch)
|
||||
print("to: ", arch.type)
|
||||
spawn.archetype = arch
|
||||
else
|
||||
print("invalid input for prompt "..prompt.name)
|
||||
end
|
||||
end,
|
||||
})
|
||||
prompt.pos.x = spawn.args[1] - Camera.pos.x - offset_x
|
||||
prompt.pos.y = spawn.args[2] - Camera.pos.y - offset_y
|
||||
prompt.pos.x = (spawn.args[1]-4)*game.scale - Camera.pos.x - offset_x
|
||||
prompt.pos.y = (spawn.args[2]-20)*game.scale - Camera.pos.y - offset_y
|
||||
|
||||
prompt:activate()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function checkArgsAreInvalid(args)
|
||||
for _, arg in pairs(args) do
|
||||
if arg == nil then return true end
|
||||
end
|
||||
end
|
||||
|
||||
function promptSpawnArgs()
|
||||
if Prompt.active_prompt then
|
||||
Prompt.active_prompt.canceled = true
|
||||
@@ -111,18 +121,25 @@ function promptSpawnArgs()
|
||||
name = "args",
|
||||
input = text,
|
||||
func = function(prompt)
|
||||
|
||||
local f = loadstring("return {"..prompt.input.."}")
|
||||
|
||||
if f == nil then
|
||||
spawn.args = arch
|
||||
if f ~= nil then
|
||||
local succ, args = pcall(f)
|
||||
print("args changed --",succ)
|
||||
print("from: ", unpack(args))
|
||||
if not succ
|
||||
or checkArgsAreInvalid(args)
|
||||
then
|
||||
args = spawn.args
|
||||
end
|
||||
print("to: ", unpack(args))
|
||||
spawn.args = args
|
||||
else
|
||||
spawn.args = f()
|
||||
print("invalid input for prompt "..prompt.name)
|
||||
end
|
||||
end,
|
||||
})
|
||||
prompt.pos.x = spawn.args[1] - Camera.pos.x - offset_x
|
||||
prompt.pos.y = spawn.args[2] - Camera.pos.y - offset_y
|
||||
prompt.pos.x = (spawn.args[1]-4)*game.scale - Camera.pos.x - offset_x
|
||||
prompt.pos.y = (spawn.args[2]-4)*game.scale - Camera.pos.y - offset_y
|
||||
prompt:activate()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user