More cautious allow check that also allows water placement
This commit is contained in:
parent
3bc06c5118
commit
23bfae11fd
@ -59,16 +59,35 @@ do
|
||||
end)
|
||||
end
|
||||
|
||||
local lut_airlikes = {}
|
||||
minetest.after(0, function()
|
||||
for k, v in pairs(minetest.registered_nodes) do
|
||||
if v.drawtype == "airlike" then
|
||||
lut_airlikes[k] = true
|
||||
local allow
|
||||
do
|
||||
local allow_drawtypes = {
|
||||
airlike = true,
|
||||
torchlike = true,
|
||||
signlike = true,
|
||||
raillike = true,
|
||||
plantlike = true,
|
||||
firelike = true,
|
||||
liquid = true,
|
||||
flowingliquid = true,
|
||||
glasslike = true,
|
||||
glasslike_framed = true,
|
||||
glasslike_framed_optional = true,
|
||||
allfaces = true,
|
||||
allfaces_optional = true,
|
||||
}
|
||||
local allow_nodes = {}
|
||||
minetest.after(0, function()
|
||||
for k, v in pairs(minetest.registered_nodes) do
|
||||
if allow_drawtypes[v.drawtype]
|
||||
and v.paramtype == "light" then
|
||||
allow_nodes[k] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
local function airlike(pos)
|
||||
return lut_airlikes[minetest.get_node(pos).name]
|
||||
end)
|
||||
allow = function(pos)
|
||||
return allow_nodes[minetest.get_node(pos).name]
|
||||
end
|
||||
end
|
||||
|
||||
local function camdummy(player, data, dtime)
|
||||
@ -76,7 +95,7 @@ local function camdummy(player, data, dtime)
|
||||
if data.dummycam > 0 then
|
||||
local pos = player:get_pos()
|
||||
pos.y = pos.y + player:get_properties().eye_height
|
||||
if airlike(pos) then return end
|
||||
if allow(pos) then return end
|
||||
end
|
||||
|
||||
local theta = math_random() * math_pi * 2
|
||||
@ -87,7 +106,7 @@ local function camdummy(player, data, dtime)
|
||||
}
|
||||
dpos = vector.multiply(dpos, 0.25 + math_random() * 0.75)
|
||||
|
||||
if not airlike(dpos) then return end
|
||||
if not allow(dpos) then return end
|
||||
|
||||
local len = vector.length(dpos)
|
||||
local tpos = vector.multiply(dpos, (len - 16) / len)
|
||||
@ -200,7 +219,7 @@ local function camcheck(player, dtime)
|
||||
return
|
||||
end
|
||||
|
||||
if not airlike(trypos) then return end
|
||||
if not allow(trypos) then return end
|
||||
|
||||
setcamera(player, trypos, tpos)
|
||||
|
||||
@ -208,7 +227,7 @@ local function camcheck(player, dtime)
|
||||
data.locked = 1
|
||||
end
|
||||
|
||||
if not airlike(pos) then return newcam() end
|
||||
if not allow(pos) then return newcam() end
|
||||
|
||||
local tlight = nodecore and nodecore.get_node_light(tpos)
|
||||
or minetest.get_node_light(tpos)
|
||||
|
Loading…
x
Reference in New Issue
Block a user