0 votes

Hey there!

I'm trying to create a tool which would make setting cells various layers in a Tilemap quicker.
In order to do this im looking for something like a signal which is emitted by a tilemap when a cell is set in editor which a tool script can connect to .

Anyone know how I could approach this?
Currently using Godot 4 alphas

Cheers!

Godot version Godot 4 alpha 15
in Engine by (16 points)

I didn't test it, but You can override set_cell method of tilemap. In theory You could do something like this inside a custom script extending from tilemap script :

func set_cell ( int x, int y, int tile, bool flip_x=false, bool flip_y=false, bool transpose=false, Vector2 autotile_coord=Vector2( 0, 0 ) ) :
       .set_cell ( int x, int y, int tile, bool flip_x=false, bool flip_y=false, bool transpose=false, Vector2 autotile_coord=Vector2( 0, 0 ) )
        emit_signal("yoursignal",yourargument)

Did a bit more digging and it looks like you cannot override certain native functions.
See this github issue https://github.com/godotengine/godot/issues/55024
Might have to look for another solution

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.