API access to player's current speed with all modifiers
API access to player's current speed with all modifiers
Title pretty much sums it up. Currently there is no way (as far as I can tell) to read the actual speed of the player after all modifiers from both in-game and mods have been applied--i.e. the actual velocity the player will literally move on screen after all calculations have been done. There is already player.character.prototype.running_speed but that's just the base run speed before any modifiers. As far as I can tell, the only way to currently get this value is to manually take the base running_speed, iterate over the equipment and check for exoskeletons, calculate the total bonus from them and add to base, check what tile you're standing on and what it's speed modifier is and calculate that in, try to check for any mods that might be adjusting the speed as well, and then finally apply my own mod's speed calculations. And this would need to be recalculated with every tick (or at least every few ticks to save performance) because the player may have crossed from, say, concrete onto grass, and now their speed is totally different.
Re: API access to player's current speed with all modifiers
Does LuaControl::character_running_speed not do the job?
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.