Page 1 of 1
[0.16.36] problem setting orientation on train
Posted: Fri Apr 13, 2018 1:03 am
by sparr
Code: Select all
game.surfaces.nauvis.create_entity{name="straight-rail",position={1,1},force="player"}
game.surfaces.nauvis.create_entity{name="straight-rail",position={1,3},force="player"}
game.surfaces.nauvis.create_entity{name="straight-rail",position={1,5},force="player"}
game.surfaces.nauvis.create_entity{name="straight-rail",position={1,7},force="player"}
game.surfaces.nauvis.create_entity{name="locomotive",position={1,4},orientation=0,force="player"}
Now you have a few rails with a locomotive on them facing north.
Code: Select all
game.surfaces.nauvis.find_entity("locomotive",{1,4}).orientation = 0.5
This should turn the locomotive to face south around. Instead, it moves the rendering position for the locomotive north about 1 tile. If you then add some fuel, get in, and start driving, it teleports back to the original position, still pointed north, before moving.
Re: [0.16.36] problem setting orientation on train
Posted: Fri Apr 13, 2018 1:25 am
by sparr
PS: If you create_entity with orientation 0.5, you get a train with orientation 0, but in the correct spot, not the glitchy one-tile-north spot.
Re: [0.16.36] problem setting orientation on train
Posted: Fri Apr 13, 2018 2:48 am
by sparr
Update!
I can create south-facing trains by passing direction instead of orientation to create_entity. This is weird because trains have false supports_direction once they exist.
After creating a south-facing train, attempting to change its direction has no effect. Attempting to change its orientation leads to the same "jump 1 tile north" behavior described in the original post here.
Re: [0.16.36] problem setting orientation on train
Posted: Sat Apr 14, 2018 4:57 pm
by Rseding91
sparr wrote:Update!
I can create south-facing trains by passing direction instead of orientation to create_entity. This is weird because trains have false supports_direction once they exist.
After creating a south-facing train, attempting to change its direction has no effect. Attempting to change its orientation leads to the same "jump 1 tile north" behavior described in the original post here.
Yes you can't change the direction once it's created but it uses it to determine the initial direction.
Re: [0.16.36] problem setting orientation on train
Posted: Sat Apr 14, 2018 4:59 pm
by Rseding91
Strictly speaking the game doesn't support setting orientation on trains. Doing so "works" as in changes stuff now but it shouldn't because the train is not setup to handle it.
Re: [0.16.36] problem setting orientation on train
Posted: Sun Apr 15, 2018 7:22 am
by sparr
Even if not being able to do it isn't a bug, the graphics glitch where it renders one tile out of place when you try is a bug.