[0.13.20] manual_control_stop is never triggered

Bugs that are actually features.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

[0.13.20] manual_control_stop is never triggered

Post by ssilk »

I found out, that the train_state is not triggered correctly.

The train state manual_control_stop is never triggered. Instead the manual_control is always triggered, when the train runs on manual.

Code example:

Code: Select all

script.on_event(defines.events.on_train_changed_state, function(event)
      log(convertState(event.train))
end

function convertState(train)
       local state = train.state
       if state == defines.train_state.manual_control and train.speed == 0 then
            return defines.train_state.manual_control_stop
       end
      return state
end
Without the if the output is always "9" when the train runs on manual. With the if it is either 8 or 9. Maybe it's already working in 0.14 but I didn't found a bug report about this.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Rseding91
Factorio Staff
Factorio Staff
Posts: 15913
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.20] manual_control_stop is never triggered

Post by Rseding91 »

Manual control stop is triggered when the train is driving and you click the "manual" button at which point the train stops.

And yes, it is triggered correctly: http://imgur.com/a/lxA3h
If you want to get ahold of me I'm almost always on Discord.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [0.13.20] manual_control_stop is never triggered

Post by ssilk »

Rseding91 wrote:Manual control stop is triggered when the train is driving and you click the "manual" button at which point the train stops.
You mean it was in automatic mode and driving and then you changed to manual mode and wait until the train stops?
Hm. That could make also sense, but for a modder I don't see the use-case. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Rseding91
Factorio Staff
Factorio Staff
Posts: 15913
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.20] manual_control_stop is never triggered

Post by Rseding91 »

ssilk wrote:
Rseding91 wrote:Manual control stop is triggered when the train is driving and you click the "manual" button at which point the train stops.
You mean it was in automatic mode and driving and then you changed to manual mode and wait until the train stops?
Hm. That could make also sense, but for a modder I don't see the use-case. :)
The states existed before the event and have nothing to do with mods. I simply added the event so you could listen to it and do things when the train enters the different states instead of having to constantly listen on_tick.
If you want to get ahold of me I'm almost always on Discord.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [0.13.20] manual_control_stop is never triggered

Post by ssilk »

Sorry, I did't mean, that the event-functionality isn't useful (something like that would be useful for all kinds of vehicles (just driving forward, backward, stop would be enough)).
It just lacks documentation that the use-cases for the train.state is limited and different of what you would expect.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Post Reply

Return to “Not a bug”