Blueprint Sandboxes


Temporary Editor-lite permissions in Lab-like environments for designing and experimenting.

Content
30 days ago
1.1 - 2.0
70.7K
Blueprints

i Please document how and if other mods can support Blueprint Sandboxes

20 days ago
(updated 20 days ago)

I wasn't able to find any documentation on how to make other mods compatible with Blueprint Sandboxes. Specifically, I was unable to find and understand the mechanisms intended to be used when wanting to ensure that certain entities, buildings, or surfaces cannot be exploited for escaping the sandbox.

From the illusion.lua file, it appears that the list is currently hardcoded. I'm not too familiar with Factorio modding, but would it be possible to add a small API for mods to register their items and buildings for replacement inside the sandbox? Maybe with 2-3 lines of code to also illustrate how to call this API?

As I anticipate the suggestion of incorporating support into the lab mod itself, l would like to add two reasons why I don't think that's a proper long-term solution.

  1. I'm playing a forked version of Exotic Industries that's compatible with Factorio 2.0. There have been some crashes and issues and while the mod is currently playable, I would not consider this a stable release. So adding official support to the lab mod is a bit difficult if the mod isn't even officially updated.

  2. But more importantly, there are many mods that change often and without regard to whatever someone might have added to the illusion list. I don't think it is the lab mods job to maintain and watch for breaking updates. The author of a mod is much more likely to properly address sandbox escapes and poor implementations should not fall back on the maintainers of the lab mod.

19 days ago

Internal Illusions

While I agree that the centralized location within this mod is not ideal for me (since I have to find, fix, and release) or you (since you have to understand it first then do it yourself, or at least notify me), as it stands I don't know of a good way around that with the current implementation and restrictions. As you could probably tell, it was built specifically for Space Exploration, since they were not really interested in putting any work on their side that wasn't simply "blocking" their own entities from being placed at all outside of their known locations. And before 2.0, the majority of encountered issues were with abandoned mods that would not never be fixed.

The illusions solve a more specific problem, though: users want to build literally anything in the Sandboxes, and when they cannot for whatever reason, they want to feel like they still can, even if that thing doesn't do anything. So, problematic entities are replaced with the illusions, which are basically cardboard cutouts of the same thing, and usually when copying/blueprinting they are swapped for the real things.

To do that, notice that Illusions must be known in the prototype stage. I assume by your phrasing that by "API" that can be "called" you meant using Remote Calls, but that is only available in the control stage, so it's not possible to do that. Right now, I cannot imagine any viable solution within the control stage, as it's perhaps the worst of all stages to do it in.

Alternatives

As for the proper long-term solution that, according to you, is not a poor implementation, there are possibilities but whether the right answer is among them is not clear.

External Illusions

It may be possible, but I have not seen it done, for this mod to provide functions that would generate the illusory prototypes such that other mods could depend on this and include them in their own prototypes. I can see how this would increase the save startup time since I'd need a new strategy to know about all illusions and their real counterparts, but it's the most direct way to expose the current functionality. If the dependency is necessary, it has load order implications, and all of this is ultimately harder to verify as working.

Surface Conditions

New to Factorio 2.0, Surface Conditions allow restricting things like building placement and recipe selections based on values known for each surface. If all you care about is prevention, then Illusions are overkill, and the implementation is essentially adding a "placeable only when sandbox is false" condition on the relevant prototypes. The only drawback is that Factorio recently added an "ignore all surface conditions" flag that users now have available, and I'd probably remove that functionality because it conflicts with consistency goals.

17 days ago

Thank you very much for this very elaborate reply. I see that this is not as simple as it may seem, and there is no way to do remote calls in the prototype stage. The surface conditions appear to be a good compromise for now. I had hoped for something as simple as listing all entities that require illusions, but yeah, doesn't appear to be as simple as that.

New response