use minetest.line_of_sight
This commit is contained in:
parent
79fdf42617
commit
2c2077543f
@ -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"},
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user