member ShouldConnect(string RegionA, string RegionB)
{
variable lnavregionref RegionRefA
variable lnavregionref RegionRefB
if !${RegionA(exists)} || !${RegionB(exists)}
{
return FALSE
}
; If they are the same Region.. Dont connect them
if ${RegionA.Equal[${RegionB}]}
{
return FALSE
}
RegionRefA:SetRegion[${RegionA}]
RegionRefB:SetRegion[${RegionB}]
if !${This.RegionsIntersect[${RegionA},${RegionB}]}
{
return FALSE
}
if ${This.MapPathway}
{
if (${Math.Calc[${RegionRefA.CenterPoint.X} - ${RegionRefB.CenterPoint.X}]} == 0) && (${Math.Calc[${RegionRefA.CenterPoint.Y} - ${RegionRefB.CenterPoint.Y}]} == 0)
{
echo "Pathway, Moving vertically -- Go Go Map it !"
return TRUE
}
if !${This.CollisionTest[${RegionRefA.CenterPoint.X}, ${RegionRefA.CenterPoint.Y}, ${RegionRefA.CenterPoint.Z}, ${RegionRefB.CenterPoint.X}, ${RegionRefB.CenterPoint.Y}, ${RegionRefB.CenterPoint.Z}]}
{
echo "Pathway (smooth way) -- Go Go Map it !"
return TRUE
}
if !${This.CollisionTest[${RegionRefA.CenterPoint.X}, ${RegionRefA.CenterPoint.Y}, ${Math.Calc[${RegionRefA.CenterPoint.Z}+1.6]}, ${RegionRefB.CenterPoint.X}, ${RegionRefB.CenterPoint.Y}, ${Math.Calc[${RegionRefA.CenterPoint.Z}+1.6]}]}
{
echo "Pathway (rough way) -- Go Go Map it !"
return TRUE
}
}
if !{me.Swimming} && ${This.CollisionTest[${RegionRefA.CenterPoint.X}, ${RegionRefA.CenterPoint.Y}, ${RegionRefA.CenterPoint.Z}, ${RegionRefB.CenterPoint.X}, ${RegionRefB.CenterPoint.Y}, ${RegionRefB.CenterPoint.Z}]}
{
echo "Something in da way ! -- Not Connected"
return FALSE
}
if !{me.Swimming} && ${Topography.IsSteep[${RegionRefA.CenterPoint.X}, ${RegionRefA.CenterPoint.Y}, ${RegionRefA.CenterPoint.Z}, ${RegionRefB.CenterPoint.X}, ${RegionRefB.CenterPoint.Y}, ${RegionRefB.CenterPoint.Z}]}
{
echo "Too Fucking Steep! -- Not Connected"
return FALSE
}
return TRUE
}
member CollisionTest(float FromX, float FromY, float FromZ, float ToX, float ToY, float ToZ)
{
return ${Me.IsPathObstructed[${FromX},${FromY},${FromZ},20,${ToX},${ToY},${ToZ}]}
}
member RegionsIntersect(string RegionA, string RegionB)
{
variable lnavregionref RA
variable lnavregionref RB
RA:SetRegion[${RegionA}]
RB:SetRegion[${RegionB}]
if ${RA.Type.NotEqual["Box"]} || ${RB.Type.NotEqual["Box"]}
{
return FALSE
}
; Check Distance between if > 10 then it shouldnt connect
if ${Math.Distance[${RA.CenterPoint.X}, ${RA.CenterPoint.Y}, ${RB.CenterPoint.X}, ${RB.CenterPoint.Y}]}>10
{
return FALSE
}
return TRUE
}