romlok / godot-gdhexgrid

A GDScript hexagonal grid implementation for Godot.
MIT License
199 stars 24 forks source link

Godot 3.1 compatibility #1

Closed skiz closed 5 years ago

skiz commented 5 years ago

I was unable to run either demo scene after directly importing the project in to a freshly compiled 3.1.alpha (master) today. I will attempt to verify with the latest 3.0.x stable release to verify.

The error encountered is a collision with the existing Resource which defines get_path

Parser Error: Function signature doesn't match the parent. Parent signature is: 'String get_path()'.

I can confirm these demos work after changing the HexGrid's get_path to find_path, which may be a suitable solution going forward.

skiz commented 5 years ago

On second thought, HexGrid should probably just extend Object as it doesn't seem to use any of the Resource functionality as far as I can tell, and the API would remain the same.

romlok commented 5 years ago

Thanks for looking into this. I haven't got round to checking out 3.1 yet.

The reason I extended Resource was so that the objects would be reference-counted and automatically freed. However, it appears one can extend Reference and get that same functionality without any extra overhead, so that might be the way to go.

That said, it's probably a good idea to change that function name to find_path anyway, since get_path has a specific and different use across most of Godot's API.

romlok commented 5 years ago

Thanks to #2 gdhexgrid now works with Godot 3.1. I'll still leave this issue open though, since the find_path rename is a good idea, type hints would be really nice to add, and there currently appears to be a bunch of errors and warnings output by the demo scenes which should be looked at.

romlok commented 5 years ago

I've just pushed up some commits which fix the warnings and errors, as well as deprecating the get_path function in favour of find_path. That said, get_path will still work for the foreseeable future, but it now also outputs a deprecation warning in the debugger.

Thanks for the report!