--[[
MOVETO.LUA:
INTERFACE
--1) Moves between the points taken from the table below.
--2) Unloads unit when the last point reached

points = {
		{0, 0, 0},
	}

--[[		

check_timeout = 5;
distance = 5;
unload = true;

END
--]]
	
k1 = 0
	  	  
for k,v in pairs(points) do
	unit.AppendWaypoint(GetTerrainPoint(v));
	k1 = k;
end

function CheckPoint()
	--ScreenLog("CheckPoint "..k1);
	if CalcDistance(object.GetPosition(), points[k1]) < distance then
		object.SetGroupVisible(false, utils.AssignFrames("trap_01"));
		object.SetGroupVisible(true, utils.AssignFrames("trap_02"));
		if unload then
			unit.UnloadAll();
		end;
		AIparts:RemovePeriodic("CheckPoint");
	end;
end;

AIparts:AddPeriodic("CheckPoint", check_timeout, CheckPoint);