Page 1 of 1

Make locomotive orientation consistent with create_entity

Posted: Tue Feb 28, 2017 12:32 am
by NiftyManiac
Locomotives don't support direction, but have an orientation. Though orientation is listed as RW, it's not actually writable for locomotives, so you can't turn them around. However, create_entity will take a direction and correctly place a locomotive in that direction if possible.

So if I need to copy a locomotive, I need to take the orientation of the source locomotive, convert that to a direction, and create the new one with that direction. Not a huge problem, just kinda clumsy.

This was just a bit confusing to me, so it might help others if the api or the documentation clarified. Having create_entity take an optional orientation seems the cleanest solution. Alternatively, it'd be helpful to just specify that it will set direction even for entities that don't support reading it, and that locomotives' orientation is read-only.

Re: Make locomotive orientation consistent with create_entity

Posted: Tue Feb 28, 2017 2:02 am
by Rseding91
There are a ton of properties that work on some entities and not others. Documenting them all would be a waste of time because they wouldn't be tied to the actual things and as we changed/added them it would just get outdated again.

It's like die(), damage(), and teleport() - they work on some things and not others.

Re: Make locomotive orientation consistent with create_entity

Posted: Tue Feb 28, 2017 3:10 am
by NiftyManiac
Ok. I think adding orientation to create_entity would be very helpful, though.

I'm actually quite confused with how direction turns into orientation: if I'm trying to place a locomotive on a curved rail, with orientation=0.335, the directions east, southeast, west, and northwest all give me the correct direction, while the four other ones give me the wrong one. All I've gathered so far is that rotating the direction 90 degrees will correspond to the locomotive switching direction, but it seems to be unrelated to the actual named direction given to create_entity. Could you explain how this works?

Re: Make locomotive orientation consistent with create_entity

Posted: Sun Apr 02, 2017 3:21 pm
by Rseding91
Everything defaults to facing north (up). You adjust the direction to east and it will be facing east. Adjust it to south and it will face south.

What's not to understand about that?

Re: Make locomotive orientation consistent with create_entity

Posted: Sun Apr 02, 2017 4:26 pm
by Klonan
Rseding91 wrote:Everything defaults to facing north (up). You adjust the direction to east and it will be facing east. Adjust it to south and it will face south.

What's not to understand about that?
It doesn't actually work like that in practice

Re: Make locomotive orientation consistent with create_entity

Posted: Sun Apr 02, 2017 4:37 pm
by Rseding91
Klonan wrote:
Rseding91 wrote:Everything defaults to facing north (up). You adjust the direction to east and it will be facing east. Adjust it to south and it will face south.

What's not to understand about that?
It doesn't actually work like that in practice
Yes it does, I tested it in 0.14.22 before writing the reply.

Re: Make locomotive orientation consistent with create_entity

Posted: Sun Apr 02, 2017 4:47 pm
by Klonan
Rseding91 wrote:
Klonan wrote:
Rseding91 wrote:Everything defaults to facing north (up). You adjust the direction to east and it will be facing east. Adjust it to south and it will face south.

What's not to understand about that?
It doesn't actually work like that in practice
Yes it does, I tested it in 0.14.22 before writing the reply.
Not for locomotives

Re: Make locomotive orientation consistent with create_entity

Posted: Sun Apr 02, 2017 5:26 pm
by Rseding91
Ah, I was testing north/east. It does behave weirdly for the other directions. Fixed for 0.15.