mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
add signal & fix
This commit is contained in:
parent
970ae6dab5
commit
b2735d8068
2 changed files with 51 additions and 12 deletions
|
|
@ -146,8 +146,8 @@ int l_set_block_custom_state(lua_State* L) {
|
|||
int x = lua_tointeger(L, 1),
|
||||
y = lua_tointeger(L, 2),
|
||||
z = lua_tointeger(L, 3),
|
||||
i = lua_tointeger(L, 4),
|
||||
s = lua_tointeger(L, 5);
|
||||
i = lua_tointeger(L, 4);
|
||||
bool s = lua_toboolean(L, 5);
|
||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||
vox->setCustomState(i, s);
|
||||
return 0;
|
||||
|
|
@ -157,20 +157,39 @@ int l_get_block_custom_value(lua_State* L) {
|
|||
y = lua_tointeger(L, 2),
|
||||
z = lua_tointeger(L, 3);
|
||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||
bool state = vox->getCustomValue();
|
||||
lua_pushboolean(L, state);
|
||||
int state = vox->getCustomValue();
|
||||
lua_pushinteger(L, state);
|
||||
return 1;
|
||||
}
|
||||
int l_set_block_custom_value(lua_State* L) {
|
||||
int x = lua_tointeger(L, 1),
|
||||
y = lua_tointeger(L, 2),
|
||||
z = lua_tointeger(L, 3),
|
||||
v = lua_tointeger(L, 5);
|
||||
v = lua_tointeger(L, 4);
|
||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||
vox->setCustomValue(v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l_get_block_sig(lua_State* L) {
|
||||
int x = lua_tointeger(L, 1),
|
||||
y = lua_tointeger(L, 2),
|
||||
z = lua_tointeger(L, 3);
|
||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||
bool sig = vox->getSig();
|
||||
lua_pushboolean(L, sig);
|
||||
return 1;
|
||||
}
|
||||
int l_set_block_sig(lua_State* L) {
|
||||
int x = lua_tointeger(L, 1),
|
||||
y = lua_tointeger(L, 2),
|
||||
z = lua_tointeger(L, 3);
|
||||
bool s = lua_toboolean(L, 4);
|
||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||
vox->setSig(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define lua_addfunc(L, FUNC, NAME) (lua_pushcfunction(L, FUNC),\
|
||||
lua_setglobal(L, NAME))
|
||||
|
|
@ -195,4 +214,6 @@ void apilua::create_funcs(lua_State* L) {
|
|||
lua_addfunc(L, l_set_block_custom_state, "set_block_custom_state");
|
||||
lua_addfunc(L, l_get_block_custom_value, "get_block_custom_value");
|
||||
lua_addfunc(L, l_set_block_custom_value, "set_block_custom_value");
|
||||
lua_addfunc(L, l_get_block_sig, "get_block_sig");
|
||||
lua_addfunc(L, l_set_block_sig, "set_block_sig");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue