From 2cb15edb24ba681b1ba07c364620f2f53801c578 Mon Sep 17 00:00:00 2001 From: tacigar Date: Fri, 23 Dec 2016 12:37:51 +0900 Subject: [PATCH] Fix maidroid's direction when spawned --- maidroid/api.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/maidroid/api.lua b/maidroid/api.lua index e9f5eee..11bac18 100644 --- a/maidroid/api.lua +++ b/maidroid/api.lua @@ -314,7 +314,12 @@ function maidroid.register_egg(egg_name, def) on_use = function(itemstack, user, pointed_thing) if pointed_thing.above ~= nil and def.product_name ~= nil then - minetest.add_entity(pointed_thing.above, def.product_name) + -- set maidroid's direction. + local new_maidroid = minetest.add_entity(pointed_thing.above, def.product_name) + new_maidroid:get_luaentity():set_yaw_by_direction( + vector.subtract(user:getpos(), new_maidroid:getpos()) + ) + itemstack:take_item() return itemstack end