More precise logic for player names.
Try to detect player traces going through a change in fluid medium such as water/air or water/glass, and block facial recognition through it. Specifically allow air-into-glass transitions, or into any other medium otherwise clear enough to allow sunlight to propagate.
This commit is contained in:
parent
40c239a798
commit
087b8c8f1b
Binary file not shown.
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 147 B |
@ -1,6 +1,6 @@
|
|||||||
-- LUALOCALS < ---------------------------------------------------------
|
-- LUALOCALS < ---------------------------------------------------------
|
||||||
local minetest, nodecore
|
local minetest, nodecore
|
||||||
= minetest, nodecore
|
= minetest, nodecore
|
||||||
-- LUALOCALS > ---------------------------------------------------------
|
-- LUALOCALS > ---------------------------------------------------------
|
||||||
|
|
||||||
minetest.register_on_player_hpchange(function(player, hp)
|
minetest.register_on_player_hpchange(function(player, hp)
|
||||||
|
@ -10,9 +10,6 @@ local modname = minetest.get_current_modname()
|
|||||||
-- Maximum distance at which custom nametags are visible.
|
-- Maximum distance at which custom nametags are visible.
|
||||||
local distance = tonumber(minetest.settings:get(modname .. "_distance")) or 16
|
local distance = tonumber(minetest.settings:get(modname .. "_distance")) or 16
|
||||||
|
|
||||||
-- Precision (number of steps) for line-of-sight check for displaying nametags
|
|
||||||
local precision = tonumber(minetest.settings:get(modname .. "_precision")) or 50
|
|
||||||
|
|
||||||
-- Keep track of active player HUDs.
|
-- Keep track of active player HUDs.
|
||||||
local huds = {}
|
local huds = {}
|
||||||
|
|
||||||
@ -70,14 +67,33 @@ local function canseeface(p1, n1, p2, n2)
|
|||||||
local ld = (ll / 15 * distance)
|
local ld = (ll / 15 * distance)
|
||||||
if dsqr > (ld * ld) then return end
|
if dsqr > (ld * ld) then return end
|
||||||
|
|
||||||
-- Check for line of sight from approximate eye level
|
-- Make sure players' eyes are inside the same fluid.
|
||||||
-- of one player to the other.
|
|
||||||
o1.y = o1.y + e1
|
o1.y = o1.y + e1
|
||||||
o2.y = o2.y + e2
|
o2.y = o2.y + e2
|
||||||
for pt in minetest.raycast(o1, o2) do
|
local f1 = minetest.get_node(o1).name
|
||||||
if pt.type ~= "object"
|
local d1 = minetest.registered_items[f1]
|
||||||
or (pt.ref ~= p2 and pt.ref ~= p1)
|
f1 = d1 and d1.liquid_alterantive_source or f1
|
||||||
then return end
|
local f2 = minetest.get_node(o2).name
|
||||||
|
local d2 = minetest.registered_items[f2]
|
||||||
|
f2 = d2 and d2.liquid_alterantive_source or f2
|
||||||
|
if f1 ~= f2 then return minetest.log(dump({f1, f2}))end
|
||||||
|
|
||||||
|
-- Check for line of sight from approximate eye level
|
||||||
|
-- of one player to the other.
|
||||||
|
for pt in minetest.raycast(o1, o2, true, true) do
|
||||||
|
if pt.type == "node" then
|
||||||
|
local nn = minetest.get_node(pt.under).name
|
||||||
|
local nd = minetest.registered_items[nn]
|
||||||
|
if not nd then return end
|
||||||
|
if not (f1 == "air" and nd.sunlight_propagates) then
|
||||||
|
nn = nd.liquid_alternative_source or nn
|
||||||
|
if nn ~= f1 then return end
|
||||||
|
end
|
||||||
|
elseif pt.type == "object" then
|
||||||
|
if pt.ref ~= p1 and pt.ref ~= p2 then return end
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Players must be facing each other; cannot identify another
|
-- Players must be facing each other; cannot identify another
|
||||||
|
Loading…
x
Reference in New Issue
Block a user