Factorio-Access / FactorioAccess

An accessibility mod for the video game Factorio, making the game accessible to the blind and visually impaired.
Other
20 stars 9 forks source link

Create a cursor.lua module #178

Open LevFendi opened 3 months ago

LevFendi commented 3 months ago

This has been bouncing around in my head for a while, and now others have asked for it as well.

While cursor related functions are very fundamental parts of the code, they ultimately can be packaged up into a module and it would cut out maybe 1000 lines or more from the oversized control.lua.

This of course needs to be done very carefully, while renaming several parts of the code. There may also be circular dependency issues to wade through, but ultimately it certainly will be worth it.

ahicks92 commented 3 months ago

I think that only skipping can go first. Something on the order of 1000 lines is a lot and, looking at it, skipping has few dependencies. 1k lines for cursor stuff seems excessive in the first place so I will be curious to see what all would need to move, but it also doesn't feel to me like it'll be closely related other than "does a thing with cursors". That said it's quite possible that we go on a code deletion extravaganza once factored out A(my guess is 10-20% is either dead or overcomplicated).

I'd suggest pulling getting cursor state to a function rather than reading global directly, and making a @class which describes; my biggest problem isn't so much the module as it is that global is both undocumented and untyped. Looking to see if we can just type global at the, no pun intended, global level is on my list.