module(..., package.seeall)


function spawn_entry(ai, entry)

	if (ai.physics_model) then
		ai.physics_model.collisions_disable()
	end

	local path= ai.path_get()
	if (path) then
		path.clear_path()
		
		local marker= entry.marker_get("path_target");
		local path_target= marker.world_position_get(entry);
		--path.add_step_raw(path_target.x, path_target.y);
		
		local arena= world_get().arena
		path.move_to_point(arena, path_target.x, path_target.y)
		
	end
	
	-- finally mask him
	
	local mask_marker= ai.marker_get("path_line")
	if (mask_marker) then
		local mask= object_place("mask")
		if (mask) then
			object_attach_no_inherit(ai, mask_marker, mask)
			mask.set_as_mask(true)
		end
	end
end