Page 1 of 1

[SOLVED] Train cruise control

Posted: Mon Aug 29, 2016 9:33 am
by pandapurpletail
I tryed to find any usefull information to how make it correct using .acceleration etc. But can't understood how it works.
So I want to make the train with player inside going by itself on cruise speed, which can be add by button "W" to max and "S" to min. Any ideas or suggestions please. Thanks. Or simply how to set the train.acceleration.whatever

P.S. Yeah, thanks guys for a huge help and useful tips! (NO). So i figuered it out by myself. If someone or somehow will need it for future here is a tip. This makes train automatically goes on certain level of speed in a set direction (1 is for none forward direction)

Code: Select all

script.on_event(defines.events.on_tick, function(event) 
for _, player in pairs(game.players) do
-- do it every tick (i mean how often.. aka speed)
if game.tick % 10 == 0 then
player.riding_state = {direction=1, acceleration=1};
end
end
end)

Re: Train cruise control

Posted: Mon Aug 29, 2016 9:38 am
by Nexela
take a look at how farl does it in farl.lua (search for cruise to get all the relevant stuff)

Re: Train cruise control

Posted: Mon Aug 29, 2016 9:40 am
by pandapurpletail
Nexela wrote:take a look at how farl does it in farl.lua (search for cruise to get all the relevant stuff)
I did! But can't understand that, too complicated. I thought maybe i can make it easier, from some simple event, not going crazy-hard-coding way

Re: Train cruise control

Posted: Mon Aug 29, 2016 10:40 am
by LuziferSenpai
pandapurpletail wrote:
Nexela wrote:take a look at how farl does it in farl.lua (search for cruise to get all the relevant stuff)
I did! But can't understand that, too complicated. I thought maybe i can make it easier, from some simple event, not going crazy-hard-coding way
Choumiko makes the easyer ways ;)

If its too complicated for you, than first learn more about functions, and Lua than look in to that ;)

Re: Train cruise control

Posted: Mon Aug 29, 2016 10:53 am
by pandapurpletail
If its too complicated for you, than first learn more about functions, and Lua than look in to that ;)
Yeah.. I guess... I dont know how other people scripting, but factorio lua wiki has some outdated articles.

Re: [SOLVED] Train cruise control

Posted: Tue Aug 30, 2016 12:50 pm
by pandapurpletail
Thanks guys, problem sovled!