jca Posted December 11, 2018 Posted December 11, 2018 (edited) Haven’t found a clean solution to check what region my player is in. At the moment using getMap().getBaseX() and getMap().getBaseY() but this varies slightly depending on how my player accessed the position in the region. With a rough calc I’m able to work it out, but as I said it’s a bit dirty. Are there any cleaner solutions? Edited December 11, 2018 by jca
jca Posted December 11, 2018 Author Posted December 11, 2018 7 minutes ago, Eliot said: getMap().getRegion() As far I’m aware that doesn’t give any information that helps you identify the region you’re currently in. It only gives you access to getClippingPlanes() and getTiles()...
Eliot Posted December 12, 2018 Posted December 12, 2018 9 hours ago, jca said: As far I’m aware that doesn’t give any information that helps you identify the region you’re currently in. It only gives you access to getClippingPlanes() and getTiles()... What info are you trying to get about the region?
jca Posted December 12, 2018 Author Posted December 12, 2018 (edited) Identify the region my player is in so I can then perform logic, for example @Eliot if ( isInRegion(region) ){ doA(); } else { doB(); } Edited December 12, 2018 by jca
Eliot Posted December 12, 2018 Posted December 12, 2018 (edited) 1 hour ago, jca said: Identify the region my player is in so I can then perform logic, for example @Eliot if ( isInRegion(region) ){ doA(); } else { doB(); } Why not just use areas? if (area.contains(myPlayer()) { ... } Edited December 12, 2018 by Eliot
jca Posted December 12, 2018 Author Posted December 12, 2018 6 minutes ago, Eliot said: Why not just use areas? if (area.contains(myPlayer()) { ... } Yeah... well that’s one option. The area I need to check is huge (the size of the region, basically 104x104). My logic is if it’s already defined as a region and I could check that then it makes more sense then defining a massive area. But if there’s not really a better way then areas will have to do.
dreameo Posted December 12, 2018 Posted December 12, 2018 5 minutes ago, jca said: Yeah... well that’s one option. The area I need to check is huge (the size of the region, basically 104x104). My logic is if it’s already defined as a region and I could check that then it makes more sense then defining a massive area. But if there’s not really a better way then areas will have to do. You don't need to define the area. Since it's big just get the bottom left and top right coordinates and that's all you need to check and see if you're within an area.
jca Posted December 12, 2018 Author Posted December 12, 2018 3 minutes ago, dreameo said: You don't need to define the area. Since it's big just get the bottom left and top right coordinates and that's all you need to check and see if you're within an area. That’s still defining an area... it’s not an issue. Just if there was an option with regions it feels better to use. But maybe it’s not possible.
dreameo Posted December 12, 2018 Posted December 12, 2018 1 minute ago, jca said: That’s still defining an area... it’s not an issue. Just if there was an option with regions it feels better to use. But maybe it’s not possible. You made it sound like it's an issue when you said the area is large. Which I said, you don't need to actually define an area.. you just need 2 coordinates. You're doing the same with with a region that you would with an area. Idk why you're hard stuck on regions.
jca Posted December 12, 2018 Author Posted December 12, 2018 (edited) 6 minutes ago, dreameo said: You made it sound like it's an issue when you said the area is large. Which I said, you don't need to actually define an area.. you just need 2 coordinates. You're doing the same with with a region that you would with an area. Idk why you're hard stuck on regions. Ah I’m not really, I just wondered if there was a way. Again, theoretically dealing with a large area feels like it should be handled by region checking. But I can stick with areas, thanks for your thoughts and @Eliot Edited December 12, 2018 by jca