Make LuaEntity.copy_settings raise events

Things that we aren't going to implement
Post Reply
User avatar
jan1i3
Inserter
Inserter
Posts: 46
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

Make LuaEntity.copy_settings raise events

Post by jan1i3 »

I would like LuaEntity.copy_settings to raise events of some kind for compatability.

I can see on_entity_settings_pasted and on_pre_entity_settings_pasted being modified so that player_index is optional, and an optional arg is added to LuaEntity.copy_settings to provide the player who did the copy pasteing if available.

Or adding a script_raised_pasted event, with source and destination fields just like the others.
This event may get the same player related treatment as mentioned above, though considering the other script_raised events do not have a player_index, it would be weird for this one to have it.


I personally can live with using script.raise_event to raise them myself, however in this case i would appreciate a concise specification of which entities can copy paste to which entities.
I am aware of LuaEntityPrototype.additional_pastable_entities, however you can copy from crafting machines to requester chests for example, which is not included in this property, and i was not able to find a list or something similar which contains all these special cases.
(I can try to find all cases myself with testing and experiance, i'm just worried i would miss some)

I would like to add that i am still against using script.raise_event for anything, so i would appreciate if i (or anybody) would not have to.
Also known as JanSharp. jan1i3 was/is my old name ;)

Rseding91
Factorio Staff
Factorio Staff
Posts: 11877
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Make LuaEntity.copy_settings raise events

Post by Rseding91 »

What's the use-case specifically? There are several ways settings can be changed through the API that aren't triggering any events (and won't be) so why make this one in particular trigger events?
If you want to get ahold of me I'm almost always on Discord.

User avatar
jan1i3
Inserter
Inserter
Posts: 46
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

Re: Make LuaEntity.copy_settings raise events

Post by jan1i3 »

I didn't know there were multiple ways.

My specific usecase would be to have an area paste tool, which is basically just a selection tool, and all selected entities get settings pasted from the current player.copy_source_entity.
I wanted it be behave just like the player pasting on the machines, so that other mods which add additional paste functionality (such as rotation or modules) would also apply their action.
Also known as JanSharp. jan1i3 was/is my old name ;)

User avatar
jan1i3
Inserter
Inserter
Posts: 46
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

Re: Make LuaEntity.copy_settings raise events

Post by jan1i3 »

To be 100% accurate, i know you can paste using blueprints, but it felt like a very hacky way to copy settings when there is a literal copy_settings function, so i scrapped that idea.
However i am still open to using this approach.
Also known as JanSharp. jan1i3 was/is my old name ;)

User avatar
jan1i3
Inserter
Inserter
Posts: 46
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

Re: Make LuaEntity.copy_settings raise events

Post by jan1i3 »

With more experience now I'd like to retract this request.
I also now saw that i misread RSed's response, and i totally agree
(or rather have no reason).

I don't think i can close it myself, but i personally see it as closed.
Also known as JanSharp. jan1i3 was/is my old name ;)

Post Reply

Return to “Won't implement”