standard command moved to stdcmd.lua
This commit is contained in:
parent
e273829ef5
commit
abf8d4f796
33
res/scripts/stdcmd.lua
Normal file
33
res/scripts/stdcmd.lua
Normal file
@ -0,0 +1,33 @@
|
||||
console.add_command(
|
||||
"tp obj:sel=$obj.id x:num~pos.x y:num~pos.y z:num~pos.z",
|
||||
function (args, kwargs)
|
||||
player.set_pos(unpack(args))
|
||||
end
|
||||
)
|
||||
console.add_command(
|
||||
"echo value:str",
|
||||
function (args, kwargs)
|
||||
return args[1]
|
||||
end
|
||||
)
|
||||
console.add_command(
|
||||
"time.set value:num",
|
||||
function (args, kwargs)
|
||||
return world.set_day_time(args[1])
|
||||
end
|
||||
)
|
||||
console.add_command(
|
||||
"fill id:str x:num~pos.x y:num~pos.y z:num~pos.z w:int h:int d:int",
|
||||
function (args, kwargs)
|
||||
local name, x, y, z, w, h, d = unpack(args)
|
||||
local id = block.index(name)
|
||||
for ly=0,h-1 do
|
||||
for lz=0,d-1 do
|
||||
for lx=0,w-1 do
|
||||
block.set(x+lx, y+ly, z+lz, id)
|
||||
end
|
||||
end
|
||||
end
|
||||
return tostring(w*h*d).." blocks set"
|
||||
end
|
||||
)
|
||||
@ -285,40 +285,6 @@ function file.readlines(path)
|
||||
return lines
|
||||
end
|
||||
|
||||
console.add_command(
|
||||
"tp obj:sel=$obj.id x:num~pos.x y:num~pos.y z:num~pos.z",
|
||||
function (args, kwargs)
|
||||
player.set_pos(unpack(args))
|
||||
end
|
||||
)
|
||||
console.add_command(
|
||||
"echo value:str",
|
||||
function (args, kwargs)
|
||||
return args[1]
|
||||
end
|
||||
)
|
||||
console.add_command(
|
||||
"time.set value:num",
|
||||
function (args, kwargs)
|
||||
return world.set_day_time(args[1])
|
||||
end
|
||||
)
|
||||
console.add_command(
|
||||
"fill id:str x:num~pos.x y:num~pos.y z:num~pos.z w:int h:int d:int",
|
||||
function (args, kwargs)
|
||||
local name, x, y, z, w, h, d = unpack(args)
|
||||
local id = block.index(name)
|
||||
for ly=0,h-1 do
|
||||
for lz=0,d-1 do
|
||||
for lx=0,w-1 do
|
||||
block.set(x+lx, y+ly, z+lz, id)
|
||||
end
|
||||
end
|
||||
end
|
||||
return tostring(w*h*d).." blocks set"
|
||||
end
|
||||
)
|
||||
|
||||
-- Deprecated functions
|
||||
block_index = block.index
|
||||
block_name = block.name
|
||||
|
||||
@ -51,6 +51,7 @@ void scripting::initialize(Engine* engine) {
|
||||
state = new lua::LuaState();
|
||||
|
||||
load_script(fs::path("stdlib.lua"));
|
||||
load_script(fs::path("stdcmd.lua"));
|
||||
}
|
||||
|
||||
scriptenv scripting::get_root_environment() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user