more test commands
This commit is contained in:
parent
5b2b89c778
commit
1f11290635
@ -1,5 +1,5 @@
|
|||||||
<container size='400' color='#00000080' size-func="unpack(gui.get_viewport())">
|
<container size='400' size-func="unpack(gui.get_viewport())">
|
||||||
<textbox id='log' margin='0' multiline='true' size-func="gui.get_viewport()[1],gui.get_viewport()[2]-40">
|
<textbox id='log' margin='0' editable='false' multiline='true' size-func="gui.get_viewport()[1],gui.get_viewport()[2]-40">
|
||||||
</textbox>
|
</textbox>
|
||||||
<textbox id='prompt' consumer='submit' margin='0' gravity='bottom-left' size-func="gui.get_viewport()[1],40"></textbox>
|
<textbox id='prompt' consumer='submit' margin='0' gravity='bottom-left' size-func="gui.get_viewport()[1],40"></textbox>
|
||||||
</container>
|
</container>
|
||||||
|
|||||||
@ -8,6 +8,8 @@ function submit(text)
|
|||||||
document.log.text = document.log.text..tostring(result)..'\n'
|
document.log.text = document.log.text..tostring(result)..'\n'
|
||||||
end
|
end
|
||||||
document.prompt.text = ""
|
document.prompt.text = ""
|
||||||
|
document.prompt.focused = true
|
||||||
|
print(document.log.pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_open()
|
function on_open()
|
||||||
|
|||||||
@ -291,6 +291,33 @@ console.add_command(
|
|||||||
player.set_pos(unpack(args))
|
player.set_pos(unpack(args))
|
||||||
end
|
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
|
-- Deprecated functions
|
||||||
block_index = block.index
|
block_index = block.index
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void TextBox::drawBackground(const DrawContext* pctx, Assets*) {
|
|||||||
batch->texture(nullptr);
|
batch->texture(nullptr);
|
||||||
|
|
||||||
auto subctx = pctx->sub();
|
auto subctx = pctx->sub();
|
||||||
subctx.setScissors(glm::vec4(pos.x, pos.y, size.x, size.y));
|
subctx.setScissors(glm::vec4(pos.x, pos.y-0.5, size.x, size.y+1));
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (isFocused() && !multiline) {
|
if (isFocused() && !multiline) {
|
||||||
@ -334,10 +334,10 @@ void TextBox::performEditingKeyboardEvents(keycode key) {
|
|||||||
if (multiline) {
|
if (multiline) {
|
||||||
paste(L"\n");
|
paste(L"\n");
|
||||||
} else {
|
} else {
|
||||||
|
defocus();
|
||||||
if (validate() && consumer) {
|
if (validate() && consumer) {
|
||||||
consumer(label->getText());
|
consumer(label->getText());
|
||||||
}
|
}
|
||||||
defocus();
|
|
||||||
}
|
}
|
||||||
} else if (key == keycode::TAB) {
|
} else if (key == keycode::TAB) {
|
||||||
paste(L" ");
|
paste(L" ");
|
||||||
|
|||||||
@ -64,6 +64,9 @@ int l_set_block(lua_State* L) {
|
|||||||
if (id < 0 || size_t(id) >= scripting::indices->countBlockDefs()) {
|
if (id < 0 || size_t(id) >= scripting::indices->countBlockDefs()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!scripting::level->chunks->get(x, y, z)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
scripting::level->chunks->set(x, y, z, id, states);
|
scripting::level->chunks->set(x, y, z, id, states);
|
||||||
scripting::level->lighting->onBlockSet(x,y,z, id);
|
scripting::level->lighting->onBlockSet(x,y,z, id);
|
||||||
if (!noupdate)
|
if (!noupdate)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user