forked from VoxeLibre/VoxeLibre
Clean up
This commit is contained in:
parent
1749712318
commit
969a08b7be
|
@ -85,25 +85,17 @@ local function raycast_line_of_sight (origin, target)
|
||||||
for hitpoint in raycast do
|
for hitpoint in raycast do
|
||||||
if hitpoint.type == "node" then
|
if hitpoint.type == "node" then
|
||||||
--TODO type object could block vision, for example chests
|
--TODO type object could block vision, for example chests
|
||||||
--minetest.log(dump(hitpoint.type))
|
|
||||||
|
|
||||||
local node = minetest.get_node(minetest.get_pointed_thing_position(hitpoint))
|
local node = minetest.get_node(minetest.get_pointed_thing_position(hitpoint))
|
||||||
|
|
||||||
--minetest.log("ray node:" .. node.name)
|
|
||||||
|
|
||||||
if node.name ~= "air" then
|
if node.name ~= "air" then
|
||||||
local nodef = minetest.registered_nodes[node.name]
|
local nodef = minetest.registered_nodes[node.name]
|
||||||
if nodef and nodef.walkable then
|
if nodef and nodef.walkable then
|
||||||
--minetest.log("walkable:" .. tostring(nodef.walkable))
|
|
||||||
los_blocked = true
|
los_blocked = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--minetest.log("los_blocked: " .. tostring(los_blocked))
|
|
||||||
--minetest.log("visible: " .. tostring(not los_blocked))
|
|
||||||
|
|
||||||
return not los_blocked
|
return not los_blocked
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -130,12 +122,6 @@ function mob_class:target_visible(origin)
|
||||||
targ_feet_height = vector.offset(target_pos, 0, self.collisionbox[2], 0)
|
targ_feet_height = vector.offset(target_pos, 0, self.collisionbox[2], 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
--local target_line_of_sight = self:line_of_sight(origin_eye_pos, targ_head_height, 2)
|
|
||||||
--local target_line_of_sight_feet = self:line_of_sight(origin_eye_pos, targ_feet_height, 2)
|
|
||||||
|
|
||||||
--minetest.log("target_line_of_sight: " .. tostring(target_line_of_sight))
|
|
||||||
--minetest.log("target_line_of_sight_feet: " .. tostring(target_line_of_sight_feet))
|
|
||||||
|
|
||||||
--minetest.log("start targ_head_height: " .. dump(targ_head_height))
|
--minetest.log("start targ_head_height: " .. dump(targ_head_height))
|
||||||
if raycast_line_of_sight (origin_eye_pos, targ_head_height) then
|
if raycast_line_of_sight (origin_eye_pos, targ_head_height) then
|
||||||
return true
|
return true
|
||||||
|
@ -148,7 +134,6 @@ function mob_class:target_visible(origin)
|
||||||
|
|
||||||
-- TODO mid way between feet and head
|
-- TODO mid way between feet and head
|
||||||
|
|
||||||
--minetest.log("target is not visible so return false")
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue