Direction information of the player cursor

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Gweneph
Inserter
Inserter
Posts: 27
Joined: Thu Nov 14, 2019 11:51 pm
Contact:

Direction information of the player cursor

Post by Gweneph »

I'm trying to read and/or write the direction of the cursor (for building an entity) but I haven't found any api to do so.

I thought I might have a clever workaround by pipetting an entity that has the desired orientation with LuaPlayer.pipette_entity, but unfortunately, the direction is not taken from the pipetted entity despite that happening when a player does so with q. This does seem like a bit of bug as the API says
Invokes the "smart pipette" action on the player as if the user pressed it.
Then I figured I might be able to keep track of the rotation by tracking when the player rotates, shift rotates, with something rotatable in their cursor, or pipettes something, but unfortunately the on_player_pipette event only includes the LuaItemProtoype, which doesn't contain any direction information.

So then I checked out the tips and tricks simulations, because they have to rotate the build cursor programmatically, and it turns out they use game.camera_player_cursor_direction but this property only seems to be available in simulations not in the main game.

So I would like some way to read or write the direction of the player cursor? If not, could one be added?

As for justification, it's for a mod that's working to allow players with limited to no vision to play by speaking the required information. We already have building and rotation working with accessible speech, but we're working around the system and, as a result, the gui preview doesn't match what happens. This would make playing with low vision or with sighted assist confusing, and make multiplayer with sighted folks untenable.

Anfilt
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Oct 02, 2022 8:02 pm
Contact:

Re: Direction information of the player cursor

Post by Anfilt »

I would also like to add this would be quite helpful to have. For something I am working on this would be quite handy as well. Trying to figure out some way to work around the cursor being such a black box right now. Other than the cursor stack.

Post Reply

Return to “Modding interface requests”