1. member ShouldConnect(string RegionA, string RegionB)
  2. {
  3. variable lnavregionref RegionRefA
  4. variable lnavregionref RegionRefB
  5.  
  6. if !${RegionA(exists)} || !${RegionB(exists)}
  7. {
  8. return FALSE
  9. }
  10.  
  11. ; If they are the same Region.. Dont connect them
  12. if ${RegionA.Equal[${RegionB}]}
  13. {
  14. return FALSE
  15. }
  16.  
  17. RegionRefA:SetRegion[${RegionA}]
  18. RegionRefB:SetRegion[${RegionB}]
  19.  
  20. if !${This.RegionsIntersect[${RegionA},${RegionB}]}
  21. {
  22. return FALSE
  23. }
  24.  
  25. if ${This.MapPathway}
  26. {
  27. if (${Math.Calc[${RegionRefA.CenterPoint.X} - ${RegionRefB.CenterPoint.X}]} == 0) && (${Math.Calc[${RegionRefA.CenterPoint.Y} - ${RegionRefB.CenterPoint.Y}]} == 0)
  28. {
  29. echo "Pathway, Moving vertically -- Go Go Map it !"
  30. return TRUE
  31. }
  32. if !${This.CollisionTest[${RegionRefA.CenterPoint.X}, ${RegionRefA.CenterPoint.Y}, ${RegionRefA.CenterPoint.Z}, ${RegionRefB.CenterPoint.X}, ${RegionRefB.CenterPoint.Y}, ${RegionRefB.CenterPoint.Z}]}
  33. {
  34. echo "Pathway (smooth way) -- Go Go Map it !"
  35. return TRUE
  36. }
  37. 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]}]}
  38. {
  39. echo "Pathway (rough way) -- Go Go Map it !"
  40. return TRUE
  41. }
  42. }
  43.  
  44. if !{me.Swimming} && ${This.CollisionTest[${RegionRefA.CenterPoint.X}, ${RegionRefA.CenterPoint.Y}, ${RegionRefA.CenterPoint.Z}, ${RegionRefB.CenterPoint.X}, ${RegionRefB.CenterPoint.Y}, ${RegionRefB.CenterPoint.Z}]}
  45. {
  46. echo "Something in da way ! -- Not Connected"
  47. return FALSE
  48. }
  49.  
  50. if !{me.Swimming} && ${Topography.IsSteep[${RegionRefA.CenterPoint.X}, ${RegionRefA.CenterPoint.Y}, ${RegionRefA.CenterPoint.Z}, ${RegionRefB.CenterPoint.X}, ${RegionRefB.CenterPoint.Y}, ${RegionRefB.CenterPoint.Z}]}
  51. {
  52. echo "Too Fucking Steep! -- Not Connected"
  53. return FALSE
  54. }
  55. return TRUE
  56. }
  57.  
  58. member CollisionTest(float FromX, float FromY, float FromZ, float ToX, float ToY, float ToZ)
  59. {
  60. return ${Me.IsPathObstructed[${FromX},${FromY},${FromZ},20,${ToX},${ToY},${ToZ}]}
  61. }
  62.  
  63. member RegionsIntersect(string RegionA, string RegionB)
  64. {
  65. variable lnavregionref RA
  66. variable lnavregionref RB
  67.  
  68. RA:SetRegion[${RegionA}]
  69. RB:SetRegion[${RegionB}]
  70.  
  71. if ${RA.Type.NotEqual["Box"]} || ${RB.Type.NotEqual["Box"]}
  72. {
  73. return FALSE
  74. }
  75.  
  76. ; Check Distance between if > 10 then it shouldnt connect
  77. if ${Math.Distance[${RA.CenterPoint.X}, ${RA.CenterPoint.Y}, ${RB.CenterPoint.X}, ${RB.CenterPoint.Y}]}>10
  78. {
  79. return FALSE
  80. }
  81. return TRUE
  82. }