Jump to content

Part information missing from GameDatabase.Instance.GetConfigNodes("PART")


Recommended Posts

I'm developing a plugin for a part I'm making, and part of that scans all the parts to see if they contain a node. That part of it works fine, however on the actual ConfigNode given by GameDatabase.Instance.GetConfigNodes("PART") there's several things missing. The missing values are: name/author/TechRequired/entryCost/cost/category/title/manufacturer/description/bulkheadProfiles

I specifically need the 'name' value to populate a dictionary of parts that have my custom node, for later use with the plugin. Am I doing something wrong?

[edit] Discovered that I should be using PartLoader.LoadedPartsList instead of directly fetching the part config nodes.

Edited by Hexicube
Link to comment
Share on other sites

I have no idea why you're missing data from the PART nodes (I've had no issues retrieving data through the same method), but you can reverse the idea fairly easily

1) Have a partmodule corresponding to your node. It doesn't need to do anything (empty class inheriting from partmodule)

2) Search Partloader for parts containing that module

List<AvailablePart> partsWithModule = PartLoader.Instance.parts.Select(p => p.Modules.Contains("MyModule"));

Why are you loading data this way anyway? It's fairly unusual to need somehing like this

Edited by Crzyrndm
Link to comment
Share on other sites

I have no idea why you're missing data from the PART nodes (I've had no issues retrieving data through the same method), but you can reverse the idea fairly easily

1) Have a partmodule corresponding to your node. It doesn't need to do anything (empty class inheriting from partmodule)

2) Search Partloader for parts containing that module

List<AvailablePart> partsWithModule = PartLoader.Instance.parts.Select(p => p.Modules.Contains("MyModule"));

Why are you loading data this way anyway? It's fairly unusual to need somehing like this

I explicitly needed the raw name of the part so I knew the type of part loaded, adding a module wouldn't suffice for this. It's possible those values were missing due to the fact I scanned for the data way after the game had loaded, I wanted to be 100% sure that my code was ran after all parts were loaded in (and after ModuleManager fiddled with any values).

It is a bit unusual, yeah. I'm creating my own version of OSE-Workshop as the dev told me they were currently uninterested in having parts broke down into multiple sub-components as it would be a lot of work to implement such a thing. I'm building a dictionary by raw part name containing the raw components of that part, along with the time it takes, the electric charge cost, and a generated icon from KIS (as I already will be using that for inventories).

Link to comment
Share on other sites

Yep, the PartLoader strips various things from the node on load. It's annoying.
It's not annoying, you just have to find the correct way according to squad's programming. What it is, though, is weird. Can't imagine why it would be needed.

I suppose iterating over the AvailablePart list is faster in the end, too.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...