Provide a way to clear LuaPlayer::entity_copy_source

User avatar
Shemp
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Jan 19, 2026 6:51 pm
Contact:

Provide a way to clear LuaPlayer::entity_copy_source

Post by Shemp »

entity_copy_source is the entity that the player last used Shift+Right-click on to copy its settings. A function to clear this property (i.e. set it back to nil) would be very nice, if not direct write access.

The motivation for this is my mod Compact Recipe Pins which allows you to create GUI pins of recipes, and then copy/paste those recipes from the pin into the machine.

To do this, I overload the controls for the standard copy/paste to create a control scheme that's obvious to the user, but this ends up conflicting with the standard copy behaviour, and I've had to employ numerous workarounds.

Obviously I could just solve it all by using different controls, but that's not what I'm looking to hear.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16551
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Provide a way to clear LuaPlayer::entity_copy_source

Post by Rseding91 »

Ok, I've added write support for 2.1.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Shemp
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Jan 19, 2026 6:51 pm
Contact:

Re: Provide a way to clear LuaPlayer::entity_copy_source

Post by Shemp »

Thanks very much, I wonder if it will be possible to assign entities which don't normally support Copy/Paste. I guess we'll have to wait and see...

Something you may want to test for is that, when a CustomInput is using linked_game_control like mine is doing, the events run in this order:
  • Mod CustomInput handler (my recipe copy code)
  • on_pre_entity_settings_pasted
  • Native game control (Factorio's standard entity setting paste behaviour)
  • on_entity_settings_pasted
If I mutate entity_copy_source during my mod's event, perhaps assigning an invalid copy target, how is the native behaviour going to react? When it's set to nil, will the native event be cancelled?

Currently in the mod, I've been using the on_entity_settings_pasted event to detect when the vanilla behaviour triggers in order to clean up. Will this still run every time, even if my handler sets the property to nil or an invalid target?
Post Reply

Return to “Implemented mod requests”