Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Things that we aren't going to implement
Post Reply
User avatar
Raiguard
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by Raiguard » Wed Aug 21, 2019 4:54 pm

Hello. Some of the cheats in my Infinity Mode mod are instant blueprint/deconstruction/upgrade. I went and implemented these in LUA because vanilla's built-in logic is unavailable outside of the editor. However, my logic is simply too slow for me to be happy with it. I would like to request that the instant blueprint/deconstruction/upgrade logic in vanilla be made available to a player through script, probably by doing something like player.instant_blueprint == true.

I would also like to re-request that instant deconstruction in vanilla should raise events. The fact that it doesn't breaks many compound entities and there is absolutely no way to work around it.

Thanks!
Don't forget, you're here forever.

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

Re: Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by Rseding91 » Wed Aug 21, 2019 6:32 pm

The "editor" logic is just doing the same thing the Lua API does so there's nothing to expose there.

As for not raising events: that's by design and I have no plans on changing it. Any mods that use compound entities have to deal with that because it's just how it works in Factorio modding: you can never trust your entities to be valid unless you check .valid. Events are simply a nicer way to handle things but are not absolute.
If you want to get ahold of me I'm almost always on Discord.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 2994
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by DaveMcW » Wed Aug 21, 2019 6:46 pm

Events are the ONLY way to handle things.

If mods can't clean up dead entities after instant deconstuction in script_raise_destroy, they are forced to do it in on_tick.

User avatar
Raiguard
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by Raiguard » Wed Aug 21, 2019 9:12 pm

Yes, as DaveMCW said, the only other way is to check each one in on_tick, which is a completely unacceptable workaround. I guess it doesn't matter though, since I'll just have to keep using LUA anyway.

Thanks anyway.
Don't forget, you're here forever.

User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 688
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by Oktokolo » Wed Aug 21, 2019 10:02 pm

Rseding91 wrote:
Wed Aug 21, 2019 6:32 pm
As for not raising events: that's by design and I have no plans on changing it.
Is that because there then could be thousands of events raised in a single tick?
If yes, maybe having a special new event wich just signals, that mods should check for broken compounds wouldfix that. We would still have to check each of our compount entities by script. But we would at least know when to do it.

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

Re: Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by Rseding91 » Wed Aug 21, 2019 11:44 pm

You seem to have missed my point: even if I added these events it doesn't cover 100% of the cases when an entity can be invalidated and a given mod gets no notification that it happens.

There will never be a 100% way to detect that some entity has been invalidated except to directly check ".valid" on it. That's a fact and if you want your mod to work correctly you have to account for it. If you don't care about that, you can just tell people that it doesn't work in all cases and they can decide if they want to use the mod or not.

Compound entities have been and most likely always will be a hack that doesn't work nicely in the game.
If you want to get ahold of me I'm almost always on Discord.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 2994
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by DaveMcW » Thu Aug 22, 2019 12:18 am

We don't want 100% coverage of invalid entities.

We want map editor instant deconstruction to work with mods. It is embarrassing for a modder to see their entity partially destroyed by the map editor. And if I was the author of the map editor, I would be embarrassed too.

User avatar
Raiguard
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Allow access to built-in instant blueprint/deconstruction/upgrade logic outside of the editor

Post by Raiguard » Thu Aug 22, 2019 1:21 am

I wouldn't have put it that way, but I essentially agree. I don't see any reason why instant deconstruction shouldn't raise events. Even if it's for performance reasons, I think the performance degredation would be a necessary cost to keep things consistent.

The main thing that baffles me is that instant blueprint raises events while instant deconstruction does not.
Don't forget, you're here forever.

Post Reply

Return to “Won't implement”

Who is online

Users browsing this forum: No registered users