I cannot get this anywhere. Lua entity, lua entity prototype, burner, burner prototype, nothing gives me ability to get information about what's vehicle acceleration power. I'm already looking for it for 4 hours, is it even possible? I'm losing my mind on how hard is to find such information, so I decided to ask isntead.
*thing* that I mean is Vehicle->Acceleration power in game UI, or data.raw['locomotive']['locomotive'].max_power in.. data.lua .
How do I get that information in control.lua? I cannot reach it.
I only know " game.entity_prototypes[locomotive.name] " this way of getting 'any' information about locomotive, but from my knowledge entity doesn't have anything that matches what I need.
I can't find any game.vehicle_prototypes[](?) or anything simmilar.
game.print(game.entity_prototypes[locomotive.type].max_energy_usage) returns 10'000, no matter what "type" of locomotive I enter. It doesn't have any sense, different locomotives should give different values, so it's for sure not value, that I was looking for.
I see this thing : https://wiki.factorio.com/Prototype/Locomotive in API, but I don't know how to access it from LuaTrain.get_something, or from LuaGameScript.get_something(name)
I found out that locomotive inherits from rolling stock, inheriting from vehicle, inheriting from entity with health inheriting from entity. So now I know a bit more.. Looking in "entity" was absolutely counter productive.
Ahh, I think it might be impossible, I will wait for answers and stop banging my head against wall, trying to find solution that might not exist.
How to access Vehicle acceleration power?
Re: How to access Vehicle acceleration power?
Code: Select all
/c locomotive = game.player.selected
power = locomotive.prototype.max_energy_usage
bonus = locomotive.burner.currently_burning and locomotive.burner.currently_burning.fuel_acceleration_multiplier or 1
game.print("Acceleration power: " .. util.format_number(60 * power * bonus))
Re: How to access Vehicle acceleration power?
LuaEntity.max_energy_usage [/code]. I already tried it, and it didn't worked really. It returned 10'000 for every locomotive type. Doesn't matter what it's power was, but I will try to look in error in my code, if you're sure it should work correctly.
It actually... Just works... For junk train it in fact returns less. So I slipped through that answer yesterday x_x and believed that it doesn't work.
Thanks you a lot!