I maintain several mods that use the on_player_pipette event to replace non-craftable items with craftable items when the player selects them. (The placeable_by prototype parameter does not seem to work for rolling stock entities, when multiple entities call out the same item.)
Space Exploration also handles on_player_pipette for players in remote-view mode, for the purpose of converting cheat-mode-given items into ghosts of that item. I fixed a bug in my code so that if SE runs before my mod, it correctly identifies that the player is holding a ghost and changes player.cursor_ghost rather than cursor_stack. There is still a conflict, however, when my mod's handler is executed first and changes the item in player.cursor_stack. SE will read event.item and make that the new cursor_ghost, even though the cursor_stack that it deletes is for something else.
I propose a small change to eliminate this unintended behavior. Replace remote-view.lua:136-137 with the following code (or equivalent):
-- Check what item is in cursor now (might have been changed by another mod since the event parameters were saved)
local cursor_name = player.cursor_stack.valid_for_read and player.cursor_stack.name
player.cursor_stack.clear()
player.cursor_ghost = cursor_name or event.item
I maintain several mods that use the
on_player_pipette
event to replace non-craftable items with craftable items when the player selects them. (Theplaceable_by
prototype parameter does not seem to work for rolling stock entities, when multiple entities call out the same item.)Space Exploration also handles
on_player_pipette
for players in remote-view mode, for the purpose of converting cheat-mode-given items into ghosts of that item. I fixed a bug in my code so that if SE runs before my mod, it correctly identifies that the player is holding a ghost and changesplayer.cursor_ghost
rather thancursor_stack
. There is still a conflict, however, when my mod's handler is executed first and changes the item inplayer.cursor_stack
. SE will readevent.item
and make that the newcursor_ghost
, even though thecursor_stack
that it deletes is for something else.I propose a small change to eliminate this unintended behavior. Replace
remote-view.lua:136-137
with the following code (or equivalent):