Page 1 of 1
Copy-paste entity settings for EEI
Posted: Tue Aug 03, 2021 4:43 pm
by PFQNiet
I have some custom entities that use the electric-energy-interface as the "base". I'd like to be able to support copy-pasting of entity settings between them, but attempting to copy settings from an EEI doesn't seem to do anything.
Is there any way to enable copy-paste on entities that don't otherwise support it?
If not, I suppose I could always overlay a constant-combinator over the whole thing but then the tooltip will be for that instead of showing the power needs of the entity...
Re: Copy-paste entity settings for EEI
Posted: Tue Aug 03, 2021 5:08 pm
by DaveMcW
electric-energy-interface does support copy/paste. Please describe exactly what you tried to do, and exactly what you want to happen.
Re: Copy-paste entity settings for EEI
Posted: Tue Aug 03, 2021 6:25 pm
by PFQNiet
The EEI has settings associated with it, and I want to be able to copy-paste them with shift-left/right clicking. But, as you mention, EEI doesn't support copy-paste. I wanted to know if there's a way to force it. I know entities can be forced to accept pastes, but allowing copy is another matter...
Re: Copy-paste entity settings for EEI
Posted: Tue Aug 03, 2021 8:17 pm
by NotRexButCaesar
PFQNiet wrote: Tue Aug 03, 2021 6:25 pm
But, as you mention, EEI doesn't support copy-paste.
DaveMcW wrote: Tue Aug 03, 2021 5:08 pm
electric-energy-interface
does support copy/paste.
Emphasis added
DaveMcW wants you to be more specific about what you did.
Re: Copy-paste entity settings for EEI
Posted: Tue Aug 03, 2021 9:46 pm
by PFQNiet
Oh whoops, I misread.
I made an electric-energy-interface prototype with 20MW consumption, placed it in game and tried to copy settings from it with shift-right click. There was no sound and no green highlight box around it.
However I'm realising now... The UI type is none since it's a fixed consumer and not a player-controlled thing. Maybe that's why I can't copy from it?
Re: Copy-paste entity settings for EEI
Posted: Tue Aug 03, 2021 11:16 pm
by DaveMcW
Apparently electric-energy-interface is hard-coded to only support copy-paste if it has a gui. You can get a gui in the map editor, but that does not help normal users.
Maybe you can replace the gui in on_gui_opened so it still exists but the player can't use it.
Re: Copy-paste entity settings for EEI
Posted: Wed Aug 04, 2021 8:57 am
by PFQNiet
Since the setting is a toggle and the building in question cannot be rotated once placed, I went and implemented this as "hit the Rotate key to toggle the mode without having to open the GUI" instead. It's a convenience feature anyway and the control is now in the entity-description text so it's all good.
Thanks for the help, sorry for misreading XD
Re: Copy-paste entity settings for EEI
Posted: Wed Aug 04, 2021 10:52 am
by eradicator
For future readers: You can use the on_entity_settings_pasted event to implement custom behavior.
Re: Copy-paste entity settings for EEI
Posted: Wed Aug 04, 2021 2:04 pm
by DaveMcW
eradicator wrote: Wed Aug 04, 2021 10:52 am
For future readers: You can use the on_entity_settings_pasted event to implement custom behavior.
on_entity_settings_pasted is inconsistent, which is why this thread exists. The event
does not trigger for an electric-energy-interface with no gui.
Re: Copy-paste entity settings for EEI
Posted: Wed Aug 04, 2021 3:56 pm
by eradicator
DaveMcW wrote: Wed Aug 04, 2021 2:04 pm
eradicator wrote: Wed Aug 04, 2021 10:52 am
For future readers: You can use the on_entity_settings_pasted event to implement custom behavior.
on_entity_settings_pasted is inconsistent, which is why this thread exists. The event
does not trigger for an electric-energy-interface with no gui.
Apologies. I thought the thread was about the EEI not supporting "natural" pasting. I don't see anyone mentioning events. In that case one could try to hack their own event using linked game controls 'copy-entity-settings' and 'paste-entity-settings'. And possibly LuaPlayer.entity_copy_source?