Fuel that increase acceleration
Fuel that increase acceleration
Any idea if there is a way to make fuel that will increase acceleration of trains/cars/tank and perhaps increase max speed?
Re: Fuel that increase acceleration
Are you looking for something like the "Back to the Future" Presto-Logs perhaps?
http://vignette3.wikia.nocookie.net/btt ... 1005034604
http://vignette1.wikia.nocookie.net/btt ... 0211084131
http://vignette3.wikia.nocookie.net/btt ... 1005034604
http://vignette1.wikia.nocookie.net/btt ... 0211084131
Re: Fuel that increase acceleration
More like nitrous oxide and hydrazine. I have everything prepared, items, recipes and tech. Now i need help how to make them work with trains and cars to give them better acceleration/max speed and not being just fuel.
Re: Fuel that increase acceleration
You can use the following Lua/Entity variables to influence speed / fuel consumption:
effectivity_modifier
consumption_modifier
friction_modifier
So you wan't to consume some item (i.e. nitrous oxide) on a button press of something?
effectivity_modifier
consumption_modifier
friction_modifier
So you wan't to consume some item (i.e. nitrous oxide) on a button press of something?
Re: Fuel that increase acceleration
I would like that but, i absolutely have no idea how to code special fuel slot for trains and cars and bind some buttons to it and work in multiplayer.
Baby steps with just better fuel and then maybe if someone knows how to do it i would, hey maybe someone else would find this useful too then. Thanks for parameter info!
So where do i put this friction_modifier? When I put vehicle_friction_modifier or friction_modifier to my new fuel item it does not seem to do anything.
Baby steps with just better fuel and then maybe if someone knows how to do it i would, hey maybe someone else would find this useful too then. Thanks for parameter info!
So where do i put this friction_modifier? When I put vehicle_friction_modifier or friction_modifier to my new fuel item it does not seem to do anything.
Re: Fuel that increase acceleration
Friction is used to calculate the speed/acceleration (and deceleration?) of a car based on the terrain it's driving on. You can access it for instance by:
Control.lua
The above code will make a car much faster by reducing friction on all terrains.
It should be possible to access the fuel-inventory of a car, but you can't add an additional inventory. What you could do is access the regular inventory of the car and see if it has a stack of "Nitrous boosts" and consume one and temporarily reduce friction in game.on_tick.
You can access the cars inventories through Lua/Entity.get_inventory(index), but I don't know what inventory is on what index, so you'll have to do some digging.
Control.lua
Code: Select all
game.on_event(defines.events.on_built_entity, function(event)
local entity = event.built_entity
if entity.name == "car" then
entity.friction_modifier = 0.5
end
end)
It should be possible to access the fuel-inventory of a car, but you can't add an additional inventory. What you could do is access the regular inventory of the car and see if it has a stack of "Nitrous boosts" and consume one and temporarily reduce friction in game.on_tick.
You can access the cars inventories through Lua/Entity.get_inventory(index), but I don't know what inventory is on what index, so you'll have to do some digging.
Last edited by Xyfi on Fri Jul 31, 2015 10:45 am, edited 1 time in total.
Re: Fuel that increase acceleration
Wouldn't this modify speed at all times no matter what fuel is used? I want cars and trains to go different speeds depending on fuel used.
I need effect based on fuel type, i can modify car speed once, but that is not point of all this.
I need effect based on fuel type, i can modify car speed once, but that is not point of all this.
Re: Fuel that increase acceleration
I moddified the post a bit with some extra information.cpy wrote:Wouldn't this modify speed at all times no matter what fuel is used? I want cars and trains to go different speeds depending on fuel used.
I need effect based on fuel type, i can modify car speed once, but that is not point of all this.
The problem with making the car go a certain speed for a certain fuel is that you can't access what type of fuel the car is using at the moment.
Re: Fuel that increase acceleration
I'll just use old roadworks script for that now. I was hoping there is new mod api for that or something that does not require use of scripts.
Re: Fuel that increase acceleration
Hmm, neven seen that mod before, I'll check out it's code for sure.cpy wrote:I'll just use old roadworks script for that now. I was hoping there is new mod api for that or something that does not require use of scripts.
Update
He pretty much uses what I summed up above, checking the fuel-inventory and adjusting the car's parameters accoringly and rechecking every few ticks. So the speed of the car is based on whatever is in the fuel-inventory rather than the actual fuel it is using.
Last edited by Xyfi on Fri Jul 31, 2015 11:26 am, edited 1 time in total.
Re: Fuel that increase acceleration
Looks like game does not know what is game.find_entities_filtered crap.
When roadworks try to call
local entities = game.find_entities_filtered{area = {{carPosition.x - 0.75, carPosition.y - 0.75}, {carPosition.x + 0.75, carPosition.y + 0.75}}, type="simple-entity"}
When roadworks try to call
local entities = game.find_entities_filtered{area = {{carPosition.x - 0.75, carPosition.y - 0.75}, {carPosition.x + 0.75, carPosition.y + 0.75}}, type="simple-entity"}
Re: Fuel that increase acceleration
It has been changed (assuming you mod for .12.1), you have to call find_entities_filtered now on Lua/Surface. You can get the surface via game.surface[1](.find_entities_filtered).cpy wrote:Looks like game does not know what is game.find_entities_filtered crap.
When roadworks try to call
local entities = game.find_entities_filtered{area = {{carPosition.x - 0.75, carPosition.y - 0.75}, {carPosition.x + 0.75, carPosition.y + 0.75}}, type="simple-entity"}
By the way I posted a modding API request for your perticular needs here, let's hope kovarex picks up on it.
Re: Fuel that increase acceleration
Where did you read all about those surface changes? Anyway i decided to remove that part of script since factorio now handles surfaces internally and it probably is faster way to do it than use custom script now.
Re: Fuel that increase acceleration
I search find_entities_filtered on the wiki and was lead to Lua/Surface.