mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 09:29:44 +00:00
Merge pull request #1058 from MihailRis/patch-0.32.7
Some checks are pending
x86-64 AppImage / build-appimage (ubuntu-22.04) (push) Waiting to run
Build / Build (push) Waiting to run
Macos Build / build-dmg (push) Waiting to run
Windows Build (CLang) / build-windows (clang, windows-latest) (push) Waiting to run
MSVC Build / build-windows (windows-2022) (push) Waiting to run
Some checks are pending
x86-64 AppImage / build-appimage (ubuntu-22.04) (push) Waiting to run
Build / Build (push) Waiting to run
Macos Build / build-dmg (push) Waiting to run
Windows Build (CLang) / build-windows (clang, windows-latest) (push) Waiting to run
MSVC Build / build-windows (windows-2022) (push) Waiting to run
fix world.raycast
This commit is contained in:
commit
24ba0ff2dc
2 changed files with 8 additions and 8 deletions
|
|
@ -682,7 +682,7 @@ static int l_get_field(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
auto lx = x - cx * CHUNK_W;
|
||||
auto lz = z - cz * CHUNK_W;
|
||||
auto lz = z - cz * CHUNK_D;
|
||||
size_t voxelIndex = vox_index(lx, y, lz);
|
||||
|
||||
const auto& vox = chunk->voxels[voxelIndex];
|
||||
|
|
@ -751,7 +751,7 @@ static int l_set_field(lua::State* L) {
|
|||
auto cx = floordiv(x, CHUNK_W);
|
||||
auto cz = floordiv(z, CHUNK_D);
|
||||
auto lx = x - cx * CHUNK_W;
|
||||
auto lz = z - cz * CHUNK_W;
|
||||
auto lz = z - cz * CHUNK_D;
|
||||
auto chunk = blocks_agent::get_chunk(*level.chunks, cx, cz);
|
||||
if (chunk == nullptr || y < 0 || y >= CHUNK_H) {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ static int l_push_ray(
|
|||
lua::pushvec3(L, ray ? ray->normal : normal);
|
||||
lua::setfield(L, "normal");
|
||||
|
||||
lua::pushnumber(L, glm::distance(start, end));
|
||||
lua::pushnumber(L, ray ? ray->distance : glm::distance(start, end));
|
||||
lua::setfield(L, "length");
|
||||
|
||||
lua::pushvec3(L, iend);
|
||||
|
|
@ -306,12 +306,12 @@ static int l_world_raycast(lua::State* L) {
|
|||
entityRaycast.ignoredUid = lua::tointeger(L, -1);
|
||||
lua::pop(L);
|
||||
}
|
||||
if (lua::getfield(L, "filter_entities")) {
|
||||
if (lua::getfield(L, "filter_entities", 1)) {
|
||||
load_entities_filter(L, -1, filteredEntities);
|
||||
blocksRaycast.filter = &filteredEntities;
|
||||
entityRaycast.entitiesFilter = &filteredEntities;
|
||||
lua::pop(L);
|
||||
}
|
||||
if (lua::getfield(L, "entities_exclusion")) {
|
||||
if (lua::getfield(L, "entities_exclusion", 1)) {
|
||||
entityRaycast.entityFilterExcludeMode = lua::toboolean(L, -1);
|
||||
lua::pop(L);
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ static int l_world_raycast(lua::State* L) {
|
|||
blocksRaycast.filter = &filteredBlocks;
|
||||
lua::pop(L);
|
||||
}
|
||||
if (lua::getfield(L, "blocks_exclusion")) {
|
||||
if (lua::getfield(L, "blocks_exclusion", 1)) {
|
||||
blocksRaycast.blocksFilterExcludeMode = lua::toboolean(L, -1);
|
||||
lua::pop(L);
|
||||
}
|
||||
|
|
@ -357,7 +357,7 @@ static int l_raycast(lua::State* L) {
|
|||
}
|
||||
}
|
||||
if (luaStackSize >= 7) {
|
||||
blocksRaycast.includeNonSelectable = lua::toboolean(L, 6);
|
||||
blocksRaycast.includeNonSelectable = lua::toboolean(L, 7);
|
||||
}
|
||||
return l_raycast(
|
||||
L, start, dir, maxDistance, blocksRaycast, entityRaycast, true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue