Train 'riding state'

Things that we aren't going to implement
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Train 'riding state'

Post by d3x0r »

It would be super useful (to me) if trains could have their acceleration state similar to riding_state. Especially when it thinks its decelerating.

Code: Select all

riding_state [Read-Write]
    Current riding state of this car or the vehicle this player is riding in.

    It is a table with two fields:

        acceleration :: defines.riding.acceleration
        direction :: defines.riding.direction

Code: Select all

riding
    acceleration
       defines.riding.acceleration.nothing	
       defines.riding.acceleration.accelerating	
       defines.riding.acceleration.braking	
       defines.riding.acceleration.reversing	
    direction
       defines.riding.direction.left	
       defines.riding.direction.straight	
       defines.riding.direction.right
Rseding91
Factorio Staff
Factorio Staff
Posts: 14339
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Train 'riding state'

Post by Rseding91 »

I'm not sure what you're asking for. The locomotive already supports riding state?
If you want to get ahold of me I'm almost always on Discord.
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Train 'riding state'

Post by d3x0r »

Rseding91 wrote:I'm not sure what you're asking for. The locomotive already supports riding state?
ya but not without a player...
the train itself accelerates/decelerates without player input.
(hmm maybe I was looking at the wrong thing and I need to look at the movers)
going back; I was looking at movers since it shoudl be a LuaEntity property(?)
error2.png
error2.png (67.86 KiB) Viewed 1834 times

Code: Select all

	local frontLoco = train.locomotives.front_movers[1];
	if not frontLoco then
		frontLoco = train.locomotives.back_movers[1];
	end
-- either of these lines as 408 results in the above error.
	log( "riding  State:".. tostring(frontLoco.riding_state )); 
	log( "riding  State:".. tostring(train.riding_state )); 
Rseding91
Factorio Staff
Factorio Staff
Posts: 14339
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Train 'riding state'

Post by Rseding91 »

There is no riding state when there isn't a player in the train. The train accelerates and decelerates as it deems necessary but doesn't change any state while it does it. It's always "on-the-path" - driving to it's destination and so on.

You can listen to the train state events to tell when they change.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Won't implement”