Page 1 of 1

LuaEntity.remembered_direction and orientation for assembler

Posted: Thu Apr 12, 2018 9:21 pm
by sparr
An assembler, by default, always has direction/orientation zero. If you give it a fluid recipe then it gains a fluid input and can be rotated, with four possible direction/orientation values. If you then reset the recipe, it goes back to reporting a direction and orientation of zero. However, if you go back to a fluid recipe, it magically snaps back to the direction/orientation you rotated it to earlier.

I want to be able to read that remembered direction and orientation, when it's not in effect.

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Tue Apr 24, 2018 10:30 am
by darkfrei
You can set off_when_no_fluid_recipe = false and all assemblers must have right orientation.

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Wed Sep 16, 2026 8:36 pm
by sparr
darkfrei wrote: Tue Apr 24, 2018 10:30 amYou can set off_when_no_fluid_recipe = false and all assemblers must have right orientation.
This doesn't help with the vanilla assemblers.

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Wed Sep 16, 2026 8:40 pm
by boskid
This feature already exists under `LuaEntity::direction` read.

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Wed Sep 16, 2026 8:41 pm
by sparr
Thanks, the behavior must have changed in the intervening time. I'll go confirm!

EDIT: Confirmed!

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Wed Sep 16, 2026 8:48 pm
by boskid
When i checked 0.16.51 that is from 8 years ago, (2 months after the initial post) LuaEntity::direction read was already working like that.

-- edit:

Just checked 0.15.40, it was also working properly there, well before initial post.

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Thu Sep 17, 2026 5:17 am
by sparr
I'm sorry. I think the original request was unintentionally mistakenly broad.

I can reproduce the problem in 2.1.18 and 0.15.40 with LuaEntity.orientation but not with .direction:

Place assembling machine 2
Set recipe to barreling
Rotate 90 degrees
/c game.player.print(game.player.selected.orientation) -> 0.25
clear recipe
/c game.player.print(game.player.selected.orientation) -> 0
Set recipe to barreling
/c game.player.print(game.player.selected.orientation) -> 0.25

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Thu Sep 17, 2026 5:23 am
by boskid
CraftingMachine has direction but not orientation. Trying to read orientation falls back onto default implementation that converts direction into orientation but only when entity declares usin direction. In this case crafter provides direction while also declaring it does not use direction.

Re: LuaEntity.remembered_direction and orientation for assembler

Posted: Thu Sep 17, 2026 12:57 pm
by sparr
I posted viewtopic.php?t=59570 requesting a way to identify which entities don't have orientation and would behave this way.