How do I get the building descriptor of a building that's not unlocked yet?

First, I used a Recipe Manager to get all recipes. I grouped them by "Get Produced In" which gives me a set of ~8 buildables (FGBuildable Class Reference). I then used the Recipe Manager's "Find Building Descriptor by Class", but it only returns Building Descriptors (FGBuildingDescriptor Class Reference) for constructor and assembler because those are the only buildings I can actually build in the game (things like the Manufacturer are not unlocked yet). However, in my mod I would like to show icons of all available machines even if they're not unlocked yet. Do you have any idea how to achieve that?
No description
No description
Solution:
Use FindNativeClassesByType of class FGRecipe, it returns all recipes, unlocked or not. Note that there are still a few broken recipes in game (and possibly included with some mods), so you'll want to do IsValid checks on all recipes and descriptors before calling functions on them because they might be null or have have null data in them.
Jump to solution
3 Replies
Solution
D4rk
D4rk4w ago
Use FindNativeClassesByType of class FGRecipe, it returns all recipes, unlocked or not. Note that there are still a few broken recipes in game (and possibly included with some mods), so you'll want to do IsValid checks on all recipes and descriptors before calling functions on them because they might be null or have have null data in them.
Robb
Robb2w ago
what D4rk said is the general case. since buildings descriptors are item descriptors, you could also use SML's Get All Obtainable Items, or the game's Cheat Get All Descriptors, and filter the results down from there
Steffen
SteffenOP4d ago
I've got it to work by using FindNativeClassesByType. Thanks for the help, D4rk!
No description
Want results from more Discord servers?
Add your server