I've been looking through the asset files and have not found a way if there's already in game mechanics to see whether an object can check what type of biome/planet it is placed in. So something like Light Sensor wiring but to check the biome. Anyone know something useful?
In order to find that you need to look at the dungeon files. They are the ones that determine premade structures. Once you find a dungeon that has it - you need to look up which dungeons spawn on which planet. Unfortunately the new dungeon systems are made using tiled - which is based on a object ID #. So you will need to download tiled, install it then find out which ID number is light sensor. After that, You can use an advanced Code Editor such as Sublime or Notepad++ to do a text search using ( Control + shift + F ) then type in the ID number, choose the directory and it will search for all references to that number.
Just for clarification's sake, were you trying to figure out a way to make an object that only works if it's in a certain biome/planet?
Sorry, I have difficulties understanding this. What do you mean by "once you find a dungeon that has 'it'" - what is 'it'? Light Sensor? Isn't Light Sensor dependent to day/night cycle, not to dungeons? This might be language barrier (English isn't my mother tongue), but what I meant is something like this... Something like that, but a bit more troublesome, i.e.: If this object is in garden biome, this object will do this else if this object is in desert biome, this object will do that, else if... etc.
Light Sensor is an object http://starbounder.org/Light_Sensor Which means it spawns in a dungeon - not in the biome. All wiring elements require a dungeon to place. Which means you need to find the associated dungeon for that planet. Keep in mind Dungeon in Starbound is Any Prefabricated Set Piece.
That's not at all what they want, though. They want to know whether an object can be made to see what biome it is in.
Yes, thank you for helping to explain it, DraikNova. Light Sensor is just an example (a bad example perhaps). I don't really want to modify Light Sensor. Rather, I want to know if an object can see what biome it is in. Is that possible?
Ah - no. There is no lua function to detect biomes. The only way to cheat the system is to have a specific object spawn in a biome, then check for that specific object.
You can only check the primary biome, using world.type() in object script. primary biome is roughly the kind of planet (magma, barren etc) For more precise info you need to check dungeons definitions and look for specific items in within them. Just as Suit told you.
Well there is one to tell the primary biome of the world, but that doesn't tell you what biome you are in. Sub biomes and all that. world.type() I think you'd do better to look at tiles and tilemods around you - that too is limited as some biomes would share tiles.. Not a convenient thing, no. Possibly look at plants too. I'd do it in init() and store what you find to not hurt performance. The sort of functions you'd want are probably found in the \starbound\doc\lua\world.md documentation. All in all it sounds like a bit of trouble so only you know if it would be worth the effort.
Awesome, the primary biome should suffice! Where can I see the string output from that function? Is it the same in Wiki page? E.g. Garden biome = garden, Decayed biome = decayed, Asteroid field biome = ...asteroid?
Hmm no idea it would best to see for yourself - docs are waek. For check output use this function: Code: sb.logInfo(<output of function>) the paremter of this function will be logged to ~/.../starbound.log under [info] category