1
0
Fork 0

Endermen: Check if block was actually placed

This commit is contained in:
Wuzzy 2017-08-23 04:53:36 +02:00
parent e2b57327fe
commit b902738ed0
1 changed files with 10 additions and 8 deletions

View File

@ -250,7 +250,8 @@ mobs:register_mob("mobs_mc:enderman", {
local place_pos = vector.subtract(pos, minetest.facedir_to_dir(minetest.dir_to_facedir(minetest.yaw_to_dir(yaw))))
if minetest.get_node(place_pos).name == "air" then
-- ... but only if there's a free space
minetest.place_node(place_pos, {name = self._taken_node})
local success = minetest.place_node(place_pos, {name = self._taken_node})
if success then
local def = minetest.registered_nodes[self._taken_node]
-- Update animation accordingly (removes visible block)
self.animation = select_enderman_animation("normal")
@ -261,6 +262,7 @@ mobs:register_mob("mobs_mc:enderman", {
self._taken_node = ""
end
end
end
end,
-- TODO: Teleport enderman on damage, etc.
_do_teleport = function(self)