Currently there's no way for a mod to know what a surface represents, with the exception of Nauvis.
For example, there are mods out there that have factory surfaces, underground surfaces, even surfaces inside trains or in the sky. It's likely we'll get other planet surfaces at some point, as well as asteroids, and probably all kinds of other crazy stuff in the coming years.
Would it be possible to add a surface.type :: string (R) to help describe or categorise surfaces in an open-ended manner?
Initial surface types could be:
* 'terrain' (eg. a planet surface, like Nauvis, or an asteroid surface)
* 'building' (eg. factorissimo)
* 'underground' (eg. for caves, etc)
Mods that implement surfaces could choose from a list of recommended types, but could also add their own if substantially different.
This would allow other mods to determine if a surface is applicable home to entities they define, or swap placed entities to more applicable entities for the kind of surface. For example, some entities might only work outdoors (terrain surfaces); or if placed indoors (building surfaces) may require a different entity graphics, etc.
This would make it much easier for other mods to get some idea about the nature of a surface. The only other option is to try and keep track of all the mods that implement custom surfaces and find a way to categorise them based on surface names or some other aspect of a surface.
[closed] surface.type
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
[closed] surface.type
Last edited by aubergine18 on Tue Aug 30, 2016 12:31 pm, edited 3 times in total.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: surface.type
That's what the surface name property is for.
Other than that, it's up to the mod author to determine how they want to treat surfaces. If you want to have mod compatibility with other mods then you need to talk to the other mods and decide on some system for yourselves about how you want to treat each others mod created surfaces.
Other than that, it's up to the mod author to determine how they want to treat surfaces. If you want to have mod compatibility with other mods then you need to talk to the other mods and decide on some system for yourselves about how you want to treat each others mod created surfaces.
If you want to get ahold of me I'm almost always on Discord.
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: surface.type
But each surface has to have a unique name does it not? Which would result in needing to do something like a 'string.startsWith()' (custom function) to get the consistent part of a name, and even then it will need hard-coded dictionary to map those name portions to surface types. I'm really just thinking of a macroscopic way to categorise surfaces that all mods could use. :/
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: surface.type
The real problem is a surface is just that "a surface" and since we can have a virtually unlimited number of surface "types" there would be no way to reliably code this in because here is what would happenaubergine18 wrote:But each surface has to have a unique name does it not? Which would result in needing to do something like a 'string.startsWith()' (custom function) to get the consistent part of a name, and even then it will need hard-coded dictionary to map those name portions to surface types. I'm really just thinking of a macroscopic way to categorise surfaces that all mods could use. :/
[mod interface request] -> please add surface.type moon for me! (replace moon with whatever type we want.
P.S add your support here viewtopic.php?f=28&t=31869&p=200857#p200857