Jump to content

GameDatabase.Instance.GetConfigNodes("PART") - Configs missing data?


Recommended Posts

I have the following code


print("OnAwake() - Looking through GameDatabase");
foreach (ConfigNode part_node in GameDatabase.Instance.GetConfigNodes("PART"))
{
print(part_node.name);
print(part_node.ToString());
}

But i'm finding that the results that get returned from pretty much every stock part is missing data, important data, like "name"! I'm wanting to iterate through all configs looking for a specific part, but without the name value being in there, I can't match them up :(

Link to comment
Share on other sites

I've found that .name quite often returns something useless ('PART' for a part.name, 'MODULE' for partModule.name)

Does this work using .partName instead?


print("OnAwake() - Looking through GameDatabase");
foreach (ConfigNode part_node in GameDatabase.Instance.GetConfigNodes("PART"))
{
print(part_node.partName); //--- changed your code here.
print(part_node.ToString());
}

Edited by Diazo
Link to comment
Share on other sites

There was a bug prior to 0.24 where all PART confignodes in the gamedatabase were stripped of string values, and really any values other than floats, serialized floats, and enums. I haven't tested it myself but I was in contact with Mu and he tells me that's been changed.

As a practical example here's some abandoned code I was working on, that is no longer needed in 0.24

https://github.com/Greys0/Virgin-Kalactic/blob/master/Source/Virgin_Kalactic/NodeFix/NodeFix.cs

GameDatabase is supposed to be the original confignodes as defined in the cfg file, plus default values where they're not overridden

PartLoader.Instance.parts is the pool of 'protoparts' that get cloned when you click on stuff in the VAB/SPH, changing things here will change them for the remainder of the runtime and apply to all newly grabbed parts in the editor.

It shouldn't impact existing parts/existing vessels; but there's some indication that certain values are not actually stored on the vessel and get reloaded every time.

Edited by Greys
Link to comment
Share on other sites

Well, I'm not sure what he changed, but now, when my modules attempt to use OnLoad to get at their MODULE{} confignode and parse it, they get different results between Editor and Flight scenes, and the results in both cases are useless.

Might be the GameDatabase still contains useful data though, but meh...

Link to comment
Share on other sites

There was a bug prior to 0.24 where all PART confignodes in the gamedatabase were stripped of string values, and really any values other than floats, serialized floats, and enums. I haven't tested it myself but I was in contact with Mu and he tells me that's been changed.

As a practical example here's some abandoned code I was working on, that is no longer needed in 0.24

https://github.com/Greys0/Virgin-Kalactic/blob/master/Source/Virgin_Kalactic/NodeFix/NodeFix.cs

GameDatabase is supposed to be the original confignodes as defined in the cfg file, plus default values where they're not overridden

PartLoader.Instance.parts is the pool of 'protoparts' that get cloned when you click on stuff in the VAB/SPH, changing things here will change them for the remainder of the runtime and apply to all newly grabbed parts in the editor.

It shouldn't impact existing parts/existing vessels; but there's some indication that certain values are not actually stored on the vessel and get reloaded every time.

Well that's interesting since I am running this on 0.24. Not all strings are stripped, though looking again most certainly are. Some are still there, like "model".

Anyway I have a working work around for now, but that tidbit about PartLoader could prove to be very useful to me so thanks!

Link to comment
Share on other sites

node.name is the name of the node (the thing that starts the node) like PART.

node.GetValue("name") is the actual value of the key "name" that is inside the node, i.e. liquidEngine1-1

Yeah the code I pasted here was wrong, but I had it right in my actual code. The key "name" was not in any of the nodes returned by GameDatabase.

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...