-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple island location from island center. #1659
Conversation
This enables the protection area to move anywhere within the island boundaries
:D Nice... |
// Range cannot be greater than the island distance | ||
range = Math.min(range, plugin.getIWM().getIslandDistance(island.getWorld())); | ||
// Range cannot be greater than the island distance * 2 | ||
range = Math.min(range, 2 * plugin.getIWM().getIslandDistance(island.getWorld())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this is a correct way how to do it.
I would prefer to calculate by offset from the actual island center.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The protection range is now relative to the protection center location, so if the player is to be given the ability to use all of their island area, then their protection range must be able to go up to 2x island distance away from that point.
For example:
Island range = 400
Island center = 0,0
Island location = 399, 0
Island protection range = 800
This last value will enable them to operate anywhere with all of the island space.
I still need to fix the tests, but I don't expect any issue there. |
I didn't review the PR yet, but want to discuss what this implies. Will the island protection zone "bleed" into the "inter-island space" if the island location is located right at the edge of the island range ? Could you please elaborate what the use case would be for this ? How could we make sure this does not get confusing ? I'm already a tad confused by the island center / island location / protection range / island range stuff. Who's who ? 🙂 |
@tastybento Could you please check #1659 (comment) ? |
No. The protection zone is all in the Island class if you want to check it.
In the new game mode you start with a tiny island, ie., a tiny protection area. There is a game mechanic where you can throw an enderpearl to move your island to another location to obtain better resources. A player can move the island anywhere within the island distance multiple times. The protection zone can grow over time so it would be possible for a player to move the location to a spot near the edge of their island maximum. All that is really happening is that we are now able to move the protection area around inside the island space instead of having it locked to the center point.
This is primarily for programmers, but it is logical:
A diagram would make this easier to understand so that could be added to the docs. |
One change to make it clearer could be to use |
@Poslovitch Any thoughts on the above? ^^^ |
The speed option was doing nothing except causing repeated actions on the same chunks.
Conflicts: src/main/java/world/bentobox/bentobox/util/DeleteIslandChunks.java
I agree to that. Please also resolve the conflict 😉 |
And thanks for your explanation. They indeed make the PR easier to understand. It might be worth creating a page on the Wiki for this. We have tons of things to explain about that already, and this new "layer" is surely going to confuse admins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good. Do not forget to rename the placeholders and the commands appropriately, to keep up with the suggested change.
Thanks for your work, and sorry for the time it took me to finally leave a review.
Added logic to expand the deletion area based on moving the island protection location and range instead of just deleting everything. This will keep deletion time to a minimum for BSkyBlock, etc.
Conflicts resolved: src/test/java/world/bentobox/bentobox/listeners/PortalTeleportationListenerTest.java
This PR enables the protection area to move anywhere within the island boundaries. This is required to enable a new game mode I'm working on where the island protection zone starts small and increases based on achievements/challenges. I need a way to move the protection zone anywhere within the island boundaries and not be locked to the center.
I added an admin command to enable manual setting of the island location. I also expanded the info command to show the island location.
In summary, the island location is the center of the protection area. It is usually the center of the island but can be moved. The protection area will not go outside the island range. However, as it is possible for the island location to be right on the edge of the island range, the protection range value can now be up to the diameter of the island, i.e., 2 * island range.