forked from mtcontrib/maidroid
		
	Merge pull request #103 from tacigar/tacigar/direction_when_added
Fix maidroid's direction when spawned
This commit is contained in:
		@@ -314,7 +314,12 @@ function maidroid.register_egg(egg_name, def)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		on_use = function(itemstack, user, pointed_thing)
 | 
							on_use = function(itemstack, user, pointed_thing)
 | 
				
			||||||
			if pointed_thing.above ~= nil and def.product_name ~= nil then
 | 
								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()
 | 
									itemstack:take_item()
 | 
				
			||||||
				return itemstack
 | 
									return itemstack
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user