4 ms·
I'm low vision / blind and the other day I sat down to try to make Factorio self-speaking. I wanted to be able to hover over items in the inventory and have the
by tarboreus 6y ago
I'm low vision / blind and the other day I sat down to try to make Factorio self-speaking. I wanted to be able to hover over items in the inventory and have the game speak what they were, as a start. Though I like the docs pretty well and I got as far as having the game read chat messages aloud (you can dump to a file and I wrote a little speech server to check the file for updates and read its contents if it changed on disc), the names and descriptions of items aren't available to the API, which seems like a pretty basic oversight. I could likely have implemented a reading of structures clicked on in the game world, but not of items in the inventory.
- cdaringe 6y agothe descriptions is no surprise, but the names is. player.get_inventory Id think would have enough to get going. https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.get_inventory https://lua-api.factorio.com/latest/LuaControl.html#LuaContr... did you hit a dead end there?
- tarboreus 6y agoGetting the inventory doesn't really do anything. What I need is the inventory item under the cursor. Some more context: https://forums.factorio.com/viewtopic.php?f=25&t=93690 https://forums.factorio.com/viewtopic.php?f=25&t=93690
- rcxdude 6y agoIt's not an oversight (there has been much discussion about this limitation on the forums), more a consequence of some of the design decisions of how mods work: factorio runs a lockstep simulation model, so all the clients need to operate deterministically and consistently across for all players. This includes the mods, so the modding API is deliberately restricted to only information which is in common between all players. Due to internationalisation, the names and descriptions can be different between players, and this could easily introduce desyncs between players. Now, there's a bunch of possible solutions to this problem (I think the best approach is to have the concept of a UI mod which can affect the interface but not the game world. As an added benefit you could allow users to have different sets of UI mods installed and not depend on the server using it), but the engineering effort involved is not so simple as just adding another part to the API (and factorio developers are generally going to try to do something well if they do it).