Debug markers not pointable

This commit is contained in:
WillConker 2024-06-09 09:39:26 +01:00
parent a8d5831bf7
commit cebf6b13da
2 changed files with 14 additions and 19 deletions

View File

@ -161,11 +161,9 @@ local function get_corner_level(x, z, cur_liquid, neighbors)
for dx=0,1 do
local neighbor_data = neighbors[z + dz][x + dx]
if neighbor_data.top_is_same_liquid then
minetest.debug("Full liquid at corner:", x + dx - 2, z + dz - 2)
return 0.5 --- REPLACE returns
end
if neighbor_data.content == cur_liquid.c_source then
minetest.debug("Full liquid at corner:", x + dx - 2, z + dz - 2)
return 0.5
end
if neighbor_data.content == cur_liquid.c_flowing then
@ -202,13 +200,11 @@ local function get_liquid_corner_heights(pos)
cur_liquid.content = node.name
cur_liquid.c_flowing = ndef.liquid_alternative_flowing
cur_liquid.c_source = ndef.liquid_alternative_source
minetest.debug("liquid forms", cur_liquid.c_flowing, cur_liquid.c_source)
cur_liquid.top_is_same_liquid = (node_above.name == cur_liquid.c_flowing or node_above.name == cur_liquid.c_source)
-- cur_liquid.draw_bottom and lighting skipped
-- END prepareLiquidNodeDrawing
local c_flowing_ndef = registered_nodes[cur_liquid.c_flowing]
minetest.debug("c_flowing_ndef", c_flowing_ndef)
--BEGIN getLiquidNeighborhood
local range = math.max(1, math.min(c_flowing_ndef.liquid_range, 8))
@ -261,18 +257,18 @@ local function get_liquid_corner_heights(pos)
--BEGIN drawLiquidTop
local corner_resolve = {{0, 1}, {1, 1}, {1, 0}, {0, 0}}
local vertices = {
{x=-5, y=0, z= 5},
{x= 5, y=0, z= 5},
{x= 5, y=0, z=-5},
{x=-5, y=0, z=-5},
{x=-0.5, y=0, z= 0.5},
{x= 0.5, y=0, z= 0.5},
{x= 0.5, y=0, z=-0.5},
{x=-0.5, y=0, z=-0.5},
}
for i=1,4 do
local u = corner_resolve[i][1]
local w = corner_resolve[i][2]
if cur_liquid.top_is_same_liquid then
vertices[i].y = 0.5 * 10
vertices[i].y = 0.5
else
vertices[i].y = vertices[i].y + cur_liquid.corner_levels[w+1][u+1] * 10
vertices[i].y = vertices[i].y + cur_liquid.corner_levels[w+1][u+1]
end
end

View File

@ -61,7 +61,12 @@ local function get_player_nodes(player)
infotable.node_stand = node_ok(part_pos).name
part_pos = get_playerpart_pos("head", player_pos, collisionbox, eye_height)
infotable.node_head = node_ok(part_pos).name
part_pos = get_playerpart_pos("head_top", player_pos, collisionbox, eye_height)
infotable.node_head_top = node_ok(part_pos).name
part_pos = get_playerpart_pos("feet", player_pos, collisionbox, eye_height)
local lch = flowlib.get_liquid_corner_heights(part_pos)
--infotable.debug_markers = mcl_playerinfo[player:get_player_name()].debug_markers
@ -69,7 +74,7 @@ local function get_player_nodes(player)
if lch then
minetest.debug("current liquid corner heights: ", "-+", lch[1].y , "++", lch[2].y , "+-", lch[3].y , "--", lch[4].y)
end
for i,v in ipairs(minetest.get_objects_inside_radius(player_pos, 2)) do
for i,v in ipairs(minetest.get_objects_inside_radius(player_pos, 5)) do
if (v:get_luaentity() or {}).name == "mcl_playerinfo:debug_marker" then
v:remove()
end
@ -77,16 +82,10 @@ local function get_player_nodes(player)
for i=1,4 do
--if infotable.debug_markers[i] ~= nil then infotable.debug_markers[i]:remove() end
if lch then
minetest.add_entity(vector.add(vector.round(part_pos), vector.divide(lch[i], 10)), "mcl_playerinfo:debug_marker")
minetest.add_entity(vector.add(vector.round(part_pos), vector.divide(lch[i], 1)), "mcl_playerinfo:debug_marker")
end
end
infotable.node_head = node_ok(part_pos).name
part_pos = get_playerpart_pos("head_top", player_pos, collisionbox, eye_height)
infotable.node_head_top = node_ok(part_pos).name
part_pos = get_playerpart_pos("feet", player_pos, collisionbox, eye_height)
infotable.node_feet = node_ok(part_pos).name
part_pos = get_playerpart_pos("stand_below", player_pos, collisionbox, eye_height)
@ -98,7 +97,7 @@ end
minetest.register_entity("mcl_playerinfo:debug_marker", { initial_properties = {
visual = "sprite",
textures = {"mcl_crimson_warped_fence_top.png"},
pointable = true,
pointable = false,
visual_size = {x = 0.1, y = 0.1, z = 0.1},
}})