[Klonan] [1.1.35] LuaPlayer::build_from_cursor with underground belts flipped

This subforum contains all the issues which we already resolved.
Post Reply
sushi_eater
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Feb 13, 2020 2:22 pm
Contact:

[Klonan] [1.1.35] LuaPlayer::build_from_cursor with underground belts flipped

Post by sushi_eater »

Setting LuaEntity.direction doesn't work on underground belts. It did work fine with Factorio 1.0. This breaks the Picker Extended ghost revival.

https://mods.factorio.com/mod/PickerExt ... 1f55147e34

Ghost revival is working around the strange 'build_from_cursor' behavior, which modifies the direction parameter based on whether the first or second underground is placed:

https://github.com/Nexela/PickerExtende ... eviver.lua

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1527
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.35] Setting direction on underground belts doesn't work

Post by boskid »

As for LuaEntity::direction not working for underground belts, this was an intended change because there were desync possibilities and even more corner cases around changing underground belt direction, so i am not considering this to qualify for a bug. Intended way of changing underground belt direction on existing entity is by using LuaEntity::rotate() which is unable to cause those weird corner cases where an underground belt would be rotated by only 90deg.

For the second part i am not sure what is being complained here.

sushi_eater
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Feb 13, 2020 2:22 pm
Contact:

Re: [1.1.35] Setting direction on underground belts doesn't work

Post by sushi_eater »

LuaEntity::rotate() doesn't rotate the underground. It toggles the underground between input and output. The chute orientation remains the same. As far as I can tell, there is currently no way to change the underground orientation.
boskid wrote:
Thu Jul 01, 2021 3:37 pm
For the second part i am not sure what is being complained here.
Place two undergrounds with 'build_from_cursor', both facing west (effectively half undergrounds). The first one will use the direction set in 'build_from_cursor'. The second one will be 180 degrees rotated relative to the direction set in the 'build_from_cursor' call. As far as I can tell, there is no API to determine the UI state, if it's set to build the first underground (which respects the direction) or if it's in build second underground state, which builds the 180 degrees rotated version.

sushi_eater
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Feb 13, 2020 2:22 pm
Contact:

Re: [1.1.35] Setting direction on underground belts doesn't work

Post by sushi_eater »

BTW, I can certainly understand that you may not want to support direction/orientation changes on underground belts. But 'build_from_cursor' should support placing them in a predictable manner that doesn't depend on hidden UI/player state.

Honktown
Filter Inserter
Filter Inserter
Posts: 798
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [1.1.35] Setting direction on underground belts doesn't work

Post by Honktown »

Tested a work-around:
hand_and_cursor_stuff.lua
(970 Bytes) Downloaded 107 times
Even with clearing the cursor and putting the item back, the "hidden state" of "is this underground the other side and should be rotated on build_from_cursor" persists. Rotating doesn't change the "should the build_from_cursor direction be reversed" either, it only makes the directions the same or opposite (from cursor to build_from_cursor direction). There's also no ...reset or inconsistency when the belts are off-axis (building north/south but in cursor east/west).

An underground can be re-created with desired properties (direction, I/O + surface, force, player index / last user, e.g.) . It is worth mentioning if a belt I/O is rotated, the direction changes, even though one might think that since the "cover" and belt side are still in the same absolute locations, they wouldn't.
I have mods! I guess!
Link

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 4893
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.1.35] Setting direction on underground belts doesn't work

Post by Klonan »

sushi_eater wrote:
Fri Jul 02, 2021 11:40 am
But 'build_from_cursor' should support placing them in a predictable manner that doesn't depend on hidden UI/player state.
Thanks for the report,
Its fixed for the next release
(It will just force the internal underground flip state to 'false' when using build_from_cursor)

Post Reply

Return to “Resolved Problems and Bugs”