All pastes #205591 Raw Edit

Someone

public text v1 · immutable
#205591 ·published 2006-10-16 22:40 UTC
rendered paste body
	method PlotBox(float cX, float cY, float cZ)
	{
		variable float X1 = ${cX}
		variable float X2 = ${cX}
		variable float Y1 = ${cY}
		variable float Y2 = ${cY}
		variable float Z1 = ${cZ}
		variable float Z2 = ${cZ}
		variable string PointName


		Z1:Set[${Math.Calc[${cZ} + 0.2]}]
		Z2:Set[${Math.Calc[${cZ} + 0.4]}]

		do
		{
			X1:Dec
			X2:Inc
			Y1:Dec
			Y2:Inc
		}
		while !${This.CollisionCheck[${X1},${Y1},${Z1},${X2},${Y2},${Z2}]} && ${Math.Distance[${cX},${X1}]} < GROW_LIMIT

		echo "${cX}, ${cY}, ${cZ} :: ${Math.Distance[${X1},${X2}]} : ${Math.Distance[${Y1},${Y2}]} : ${Z1}, ${Z2}"
		PointName:Set["P${Time.Timestamp}${This.ZoneRegion.ChildCount}"]
		
		This.ZoneRegion:AddChild[box, ${PointName}, -unique, ${X1}, ${X2}, ${Y1}, ${Y2}, ${Math.Calc[${cZ} - 3]}, ${Math.Calc[${cZ} + 3]}]
		if ${This.PreviousRegion.FQN(exists)}
		{
			This.PreviousRegion:Connect[${PointName}]
			LNavRegion[${PointName}]:Connect[${This.PreviousRegion.FQN}]
		}
	}
	
	member CollisionCheck(float X1, float Y1, float Z1, float X2, float Y2, float Z2)
	{
		variable float X = ${X1}
		variable float Y = ${Y1}
		variable float Z = ${Z1}
		
		for (X:Set[${X1}]; ${X} < ${X2}; X:Inc)
		{
			if (${This.CollisionTest[${X},${Y1},${Z1},${X},${Y2},${Z2}]})
			{
				return TRUE
			}
		}
		
		for (Y:Set[${Y1}]; ${Y} < ${Y2}; Y:Inc)
		{
			if (${This.CollisionTest[${X},${Y1},${Z1},${X},${Y2},${Z2}]})
			{
				return TRUE
			}
		}
		
		return FALSE
	}
	
	member CollisionTest(float X1, float Y1, float Z1, float X2, float Y2, float Z2)
	{
		if (!${ISXWoW.CollisionTest[${X1},${Y1},${Z1},${X2},${Y2},${Z2}](exists)})
		{
			return FALSE
		}
		
		return TRUE
	}