Rotate TileMapPattern in code?

Godot Version

4.3.stable

Question

I want to spawn my patterns at runtime which I figured out how to do with the set_pattern function but I cant find a way to rotate and flip them how I can in the editor. Is there a way to do this in code?

image

I think theres no built-in method to rotate, but you could write it yourself

do you know how I would be able to do that? I dont have a problem with making it myself but not sure how I could do it

well you can get patterns from the tileset with get_pattern. About the rotation you would need some kind of algorithm that rotates the given tiles at a specific point