Recently I realised it would be useful to be able to have arrays or dictionaries containing "helper" functions for a number of my gameplay features - for example, in one of my robot scripts, I might use the dictionary "animations" to contain functions modifying the goal angles of its servos. However, I can't seem to find an ideal way of doing this. For example, while I can store funcrefs in this dictionary, the functions then have to still be defined in a long, unorganised list somewhere in my script.
I tried making the script extend another one ("rail_bot_animations.gd") and also loading this, so I could call functions from inside the handler, but animations.gd would need direct access to most of the handler's own subroutines and variables, which again would be messy to execute.
Does anyone know what the best alternative way of doing this would be? I really like the way you can organise scenes, nodes and code to create efficient and readable scripts in Godot, so it seems a shame I'd have to do something like this in a much less readable way.