[2.0.6] LuaPlayer::pipette_entity() does not put ghost in cursor

robot256
Smart Inserter
Smart Inserter
Posts: 1201
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[2.0.6] LuaPlayer::pipette_entity() does not put ghost in cursor

Post by robot256 »

The description of LuaPlayer::pipette_entity(entity) is "Invokes the "smart pipette" action on the player as if the user pressed it."

When the setting "Select ghost when no item is available" enabled, pipetting an unavailable item with the Q key will select a ghost. However, pipette_entity() on the same entity fails (with the "X" sound). This is not the same behavior as if the player used the pipette tool and is very inconvenient for mods trying to replicate the same behavior (for example, pipetting a placeable entity when the player selects a non-placeable component).

Reproduction:
  1. Create a new save in 2.0.6 vanilla.
  2. Enable the setting "Pick ghost if no item is available".
  3. Place the starting stone furnace, so that no more stone furnaces are in the character inventory.
  4. Select the stone furnace entity and press Q, observe that the cursor_ghost is now stone-furnace.
  5. Clear the cursor by pressing Q again.
  6. With the cursor still selecting the stone furnace, run "/c game.player.pipette_entity(game.player.selected)" and observe that the cursor remains empty.
(This is a duplicate of my F10 report for visibility -robot256)
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3941
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.6] LuaPlayer::pipette_entity() does not put ghost in cursor

Post by boskid »

For 2.0.7 i added second parameter "allow_ghost". Unfortunately the value of "pick ghost if no item is available" is not part of game state so it cannot be used (in that sense doc was slightly misleading).
Post Reply

Return to “Implemented mod requests”