Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This MR makes the script compatible with Godot 4. Be warned, in addition to the changes genuinely required, such as syntax changes, I ended up changing the tile indexing a bit. This is because I ran into weird problems, which I believe were caused by replacing
map_to_world
/world_to_map
withmap_to_local
andlocal_to_map
. The "world" versions are not available in Godot 4 and apparently the "local" versions don't behave exactly the same from the point of view of this script. I was able to get everything working again by removing some offsets and converting positions to grid coordinates before converting them to point IDs. It's probable that a smaller set of changes would have worked if I properly understood the difference between these function families and their usage here, but this works, and gives smaller id:s which I prefer anyways. Nonetheless, this MR may serve better as a reference if someone wishes to implement Godot 4 compatibility cleanly, than something to necessarily merge as-is.