this.GoalType = "ROUTE";
this.Version = 1;
this.DefaultPriority = 0.7;
this.RenderDefaultBounds = false;
this.RenderDefaultGroup = false;
this.RenderDefaultAtCenterBounds = false;
this.MinRadius = 32;

//////////////////////////////////////////////////////////////////////////

this.Schema = Schema();
this.Schema.Radius = Validate.NumRange(this.MinRadius, 999).Default(this.MinRadius);

//////////////////////////////////////////////////////////////////////////

this.InitNewGoal = function()
{
	this.Radius = 125;
	this.Schema.Check(this);
};

//////////////////////////////////////////////////////////////////////////

this.UpgradeVersion = function(Props)
{
	// version 0 is string,string key/values from the old waypoint format
	if(Props.Version==0)
	{
		// Version 1 Schema, upgrade from waypoint format
		Props.Version = 1;
		this.Schema.Check(Props);

		// cs: can't do this since it is unreliable. constructable bridges for example
		//this.SetPosition( GroundPoint(this.GetPosition()) );

		// offset instead
		this.SetPosition(this.GetPosition() + Util.WaypointGoalOffset);

		this.SetBounds(Vec3(-5,-5,0),Vec3(5,5,96));
	}
	else if(Props.Version == this.Version)
	{
		this.Schema.Check(Props);
	}
};

//////////////////////////////////////////////////////////////////////////

this.Render = function()
{
	offset2 = Vector3(0,0,64);

	while(this.RenderGoal == true)
	{
		goalBasePos = this.GetPosition();
		goalPos = goalBasePos + offset2;

		this.RenderDefault();

		if(this.IsDisabled())
		{
			DrawLine(goalPos,goalBasePos,COLOR.RED,2);
		}
		else
		{
			DrawLine(goalPos,goalBasePos,COLOR.GREEN,2);
		}

		sleep(2);
	}
};

//////////////////////////////////////////////////////////////////////////
global CreateGui = function(object, guidef)
{
};
//////////////////////////////////////////////////////////////////////////
this.HudDisplay = function(window)
{
	this.CreateGuiFromSchema(this.Schema);
};
