LuaEntity.remembered_direction and orientation for assembler

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
sparr
Smart Inserter
Smart Inserter
Posts: 1557
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

LuaEntity.remembered_direction and orientation for assembler

Post 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.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post by darkfrei »

You can set off_when_no_fluid_recipe = false and all assemblers must have right orientation.
sparr
Smart Inserter
Smart Inserter
Posts: 1557
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4879
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post by boskid »

This feature already exists under `LuaEntity::direction` read.
sparr
Smart Inserter
Smart Inserter
Posts: 1557
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post by sparr »

Thanks, the behavior must have changed in the intervening time. I'll go confirm!

EDIT: Confirmed!
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4879
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post 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.
sparr
Smart Inserter
Smart Inserter
Posts: 1557
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post 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
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4879
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post 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.
sparr
Smart Inserter
Smart Inserter
Posts: 1557
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: LuaEntity.remembered_direction and orientation for assembler

Post by sparr »

I posted viewtopic.php?t=59570 requesting a way to identify which entities don't have orientation and would behave this way.
Post Reply

Return to “Modding interface requests”