Blueprint Sandboxes


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

Content
2 months ago
1.1 - 2.0
86.9K
Blueprints

g Help another mod read surface properties of Blueprint sandboxes

5 days ago

Hi. I'm currently trying to resolve this incompatibility with Muluna: https://github.com/nicholasgower/planet-muluna/issues/281

Essentially, I have an entity(telescope) that on being placed has its recipe set to and locked to a particular recipe based on the surface, one recipe per planet. I want to configure my script so that if a telescope is placed in a blueprint sandbox, if the current surface conditions match one of the planets, the recipe for that planet will be assigned to the telescope, as if it were placed on that planet. I would like to know if it is possible to read surface properties of blueprint sandboxes, since I'm not sure if that's possible at the moment. I don't know the inner workings of this mod.

You should be able to do this without knowing anything about this mod or its code, but it's not exactly the same as you may have been doing it before. Based on that stack trace, it seems like you were concatenating your own name with the names of some Planets (therefore their Surfaces?) to find the right recipe. You're on the right track for checking the Surface Properties instead of that.

The harder part is that you mentioned matching properties. Technically, these properties can change at runtime, even though they're initialized from the Prototypes. You can read the current value of any of the properties for a Surface, so by just using the Factorio APIs, you should be able to handle this for any situation - not just for this mod. By now you may have realized the complication with matching: there's multiple properties and each can be adjusted individually, so how will you match? I hope you have only a couple of properties that matter, but it doesn't sound like it if you wanted it to be specific to each Planet.

I don't know of any other mod that I've used that also lets users adjust the properties; this mod does, but I'm betting that users mostly use the preset options that use all the values of a known Planet's Prototype. That means your matching will likely succeed, but you still have to wonder about the cases when it's not a perfect match.

4 days ago

Thank you for pointing me to that property function. I expected the surface_properties field to be a table like it is in data, so I failed to find that function.

New response