use minetest.line_of_sight

This commit is contained in:
cale 2016-07-24 10:23:44 +02:00
parent 79fdf42617
commit 2c2077543f
2 changed files with 13 additions and 3 deletions

View File

@ -356,6 +356,13 @@ minetest.register_node("default:wooden_planks_2_jungle", {
-- log
minetest.register_node("default:log", {
description = "Log",
tiles = {"default_log_top.png","default_log_top.png","default_log.png"},
groups = {choppy = 3},
sounds = default.sounds.wood(),
})
minetest.register_node("default:log_1", {
description = "Log (thick)",
tiles = {"default_log_top.png","default_log_top.png","default_log.png"},

View File

@ -66,9 +66,12 @@ function mobs.register_mob(name, def)
end
self.object:setyaw(yaw)
found = true
obj:punch(self.object, 10, def.dmg, nil)
break
if minetest.line_of_sight(self.object:getpos(), obj:getpos(), 1) then
obj:punch(self.object, 10, def.dmg, nil)
found = true
break
end
end
end