Page 1 of 1

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

Posted: Fri Oct 18, 2024 7:36 pm
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)

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

Posted: Fri Oct 18, 2024 8:32 pm
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).

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

Posted: Fri Oct 18, 2024 10:38 pm
by robot256
Thank you!