Jump to content

[1.12.x] Hide Empty Tech Tree Nodes (for modded tech trees) v1.3.2


ev0

Recommended Posts

1 hour ago, hemeac said:

@PocketBrotector, as for your hotfix, could you just add @TechRequired = Unresearchable to your patch?  I'm guessing when those were deprecated, Nertea didn't change the tech so ensure that it wouldn't break people's craft files.

That might work for a quick hotfix. But I noticed that Squad's deprecated(?) stock parts still have the original TechRequired set, the there's probably a different root cause of the issue. I'm using the two parts below as an example reference.

GameData\Squad\Parts\Engine\liquidEngine24-77

GameData\Squad\Parts\Engine\liquidEngine24-77_v2

Link to comment
Share on other sites

1 hour ago, hemeac said:

@PocketBrotector, as for your hotfix, could you just add @TechRequired = Unresearchable to your patch?  I'm guessing when those were deprecated, Nertea didn't change the tech so ensure that it wouldn't break people's craft files.

Yup, this worked!

I don't think a change to the TechRequired value would break craft in flight. Since KSP stores the names of unlocked parts in the SFS file, it probably won't even prevent players from launching new craft using those parts, as long as they're on a savegame that has already unlocked them.

47 minutes ago, ev0 said:

That might work for a quick hotfix. But I noticed that Squad's deprecated(?) stock parts still have the original TechRequired set, the there's probably a different root cause of the issue. I'm using the two parts below as an example reference.

GameData\Squad\Parts\Engine\liquidEngine24-77

GameData\Squad\Parts\Engine\liquidEngine24-77_v2

I think the issue only shows up when a tech node is populated solely by TechHidden parts. Anything that Squad has deprecated likely exists in a node that's still got visible parts in it.

Link to comment
Share on other sites

4 hours ago, PocketBrotector said:

Yup, this worked!

I don't think a change to the TechRequired value would break craft in flight. Since KSP stores the names of unlocked parts in the SFS file, it probably won't even prevent players from launching new craft using those parts, as long as they're on a savegame that has already unlocked them.

I think the issue only shows up when a tech node is populated solely by TechHidden parts. Anything that Squad has deprecated likely exists in a node that's still got visible parts in it.

Cool, I have a one line fix working in my dll. Just needed to check if a part had TechHidden=true when counting parts in a tech node. It was indeed an issue with this mod, however I think the stock part counter also counted these parts when assigning parts to a tech node.

However, I've learned a lot about coding since making this plugin, so I want to try to a bit of an audit of my code before pushing any new changes. But if that takes too long or causes more issues than it's worth, then I'll still go ahead and push your fix and  whatever backlog I have before the weekend.

Cheers!

Link to comment
Share on other sites

37 minutes ago, Mr. Ship Crasher said:

Yeah, since it seems to work in 1.10(tested with CommunityTechTree, Simplex, both with extra part mods and without), you should add 1.10 compatibility.

You're right. I went and bumped the version on the forum page and on SpaceDock. You might have some issues with Mini-AVC if you use it for checking mod versions, but you can ignore any warning that would pop up.

Link to comment
Share on other sites

v1.2.0 - KSP v1.10.1 update

  • Fixed deprecated parts counting in nodes, leading to empty nodes.
  • Fixed version file URL (thx @HebaruSan ) .
  • Added Chinese language support (thx @tinygrox).
  • Reverted min zoom back to stock 60%. Previous modded zoom was 35% (looked wrong on my new 1440p monitor)
  • Updated version file.
Link to comment
Share on other sites

  • 2 weeks later...
3 hours ago, BrunoViking said:

Hi, I installed your mod and it seems not to work with 1.11. Will you update it?

Yep, I plan to. Thanks for checking if it works. I'll take a look soon since it's broken.

Link to comment
Share on other sites

Pre-Release v1.3.0 for KSPv1.11.0

  • Fixed HETTN tech tree node not loading properly in KSPv1.11
  • Fixed Propagate Science option getting stuck in infinite loop @etmoonshade

Here's a GitHub link to a pre-release for the mod for those that want to try it out.  Just download the .zip file there (top file only, ignore the source code downloads) and extract it into your game like normal.  Let me know if it works.

Download

Details

KSP v1.11 now loads all TechTree nodes in .cfg files that are the GameData folder.  Simply specifying the file path to the TechTree node you wanted to load isn't enough anymore.  I had to make sure I cleared the RDNodes from the instanced TechTree nodes, then add the RDNodes from the HETTN tree to that instance.  I'm not sure if that's the best approach, so if anyone who might know better wants to chime in please feel free.

The pre-release has a good chance of not working if there are more than one .cfg files with a TechTree node.  The only tree that I'm aware of that does this is the ETT.  Anything that uses ModuleManager to edit the stock TechTree node, however, should be fine. ETT still works, as long as you don't have the CTT installed at the same time like I did during my tests:rolleyes:

 

Edited by ev0
Link to comment
Share on other sites

22 hours ago, Superfluous J said:

In addition to the above fixes, this also fixed broken tree branches for me in the Kiwi Tech Tree mod, with pretty much only stock parts.

Yep, as long as a mod uses ModuleManager to modify the single stock TechTree node then I think it'll work.

@hemeac If you've noticed any incompatibilities with this mod and Kiwi's Tech Tree Overhaul, let me know and I'll see if I can fix them.

Link to comment
Share on other sites

On 12/21/2020 at 10:48 PM, ev0 said:

The pre-release has a good chance of not working if there are more than one .cfg files with a TechTree node.  The only tree that I'm aware of that does this is the ETT.  Anything that uses ModuleManager to edit the stock TechTree node, however, should be fine.

I'm the only one?  I am feeling a lot of peer pressure now...  Might have to migrate over.  I just like using the Tech Tree Editor.  Maybe that editor is just too antiquated and I need to move to the MM method.

BTW, the ETT is balanced to not hide empty tech tree nodes.  If you use this mod, it will nerf the ETT, but that's the great thing about mods.  You can play YOUR way.

Link to comment
Share on other sites

On 12/22/2020 at 1:48 AM, ev0 said:

Pre-Release v1.3.0 for KSPv1.11.0

  • Fixed HETTN tech tree node not loading properly in KSPv1.11
  • Fixed Propagate Science option getting stuck in infinite loop @etmoonshade

Here's a GitHub link to a pre-release for the mod for those that want to try it out.  Just download the .zip file there (top file only, ignore the source code downloads) and extract it into your game like normal.  Let me know if it works.

Download

Details

KSP v1.11 now loads all TechTree nodes in .cfg files that are the GameData folder.  Simply specifying the file path to the TechTree node you wanted to load isn't enough anymore.  I had to make sure I cleared the RDNodes from the instanced TechTree nodes, then add the RDNodes from the HETTN tree to that instance.  I'm not sure if that's the best approach, so if anyone who might know better wants to chime in please feel free.

The pre-release has a good chance of not working if there are more than one .cfg files with a TechTree node.  The only tree that I'm aware of that does this is the ETT.  Anything that uses ModuleManager to edit the stock TechTree node, however, should be fine.

 

Just want to report that this works excellent for me. I am now using the Kiwi Tech Tree and about three nodes were impossible to unlock since one of the prerequisite techs was missing from the tech tree (though the 'path' where they were supposed to be sitting was there). I installed this new, specific version of 'hide empty' and now it works just fine. Tested and approved if you ask me.

Edited by Daniel Prates
Link to comment
Share on other sites

4 hours ago, Probus said:

I'm the only one?  I am feeling a lot of peer pressure now...  Might have to migrate over.  I just like using the Tech Tree Editor.  Maybe that editor is just too antiquated and I need to move to the MM method.

BTW, the ETT is balanced to not hide empty tech tree nodes.  If you use this mod, it will nerf the ETT, but that's the great thing about mods.  You can play YOUR way.

I'll put my vote in for MM! But I was able to get this mod to work with the ETT as is, so there's no actual pressure to change:wink:.  So now worries.  I accidently had the CTT installed at the same time as the ETT during my tests, and since they're incompatible the tree didn't load correctly.  Too many duplicate nodes, and my plugin's error checks for that were broken, so the plugin errored out.  But if you just have the ETT installed (even with the stock tech tree), then my pre-release seems to work.

Just FYI in case it's useful info for you; this plugin uses the MM generated tech tree, and the reason this plugin works with the ETT is just because MM happens to use the first TechTree node that's loaded via a cfg file.  Since ETT comes before Squad in the GameData folder, I think that means yours is the first TechTree node loaded.  I had to add some special code to my plugin to make sure your Unlocks modules also loaded correctly, though.

And yep, the hope is to give the player options.  I hated empty nodes so much that I made a plugin for it:wink:, but others surely don't mind.

Link to comment
Share on other sites

13 hours ago, Probus said:

I'm the only one?  I am feeling a lot of peer pressure now...  Might have to migrate over.  I just like using the Tech Tree Editor.  Maybe that editor is just too antiquated and I need to move to the MM method.

BTW, the ETT is balanced to not hide empty tech tree nodes.  If you use this mod, it will nerf the ETT, but that's the great thing about mods.  You can play YOUR way.

Let me know if you do

Link to comment
Share on other sites

@ev0, I've been thinking of adding empty nodes at the top and bottom of the tree that denote the tier (see below).  As they are empty, they are getting grabbed by your mod.  Do you have any current method to workaround that?  This isn't mission critical, but let me know if there  is anything that I can do to make your job easier.  They currently have a cost of 0 and have an id that starts with tier

6rqmLZl.png

Link to comment
Share on other sites

2 hours ago, hemeac said:

@ev0, I've been thinking of adding empty nodes at the top and bottom of the tree that denote the tier (see below).  As they are empty, they are getting grabbed by your mod.  Do you have any current method to workaround that?  This isn't mission critical, but let me know if there  is anything that I can do to make your job easier.  They currently have a cost of 0 and have an id that starts with tier

6rqmLZl.png

A look at the source code gives this:

if (node.HasValue("hideEmpty"))
                this.hideIfNoParts = bool.Parse(node.GetValue("hideEmpty"));

I would infer this means any RDNode with hideEmpty = True won’t be hidden.

So just adding hideEmpty = True with MM should be enough.

Link to comment
Share on other sites

1 hour ago, Clamp-o-Tron said:

A look at the source code gives this:



if (node.HasValue("hideEmpty"))
                this.hideIfNoParts = bool.Parse(node.GetValue("hideEmpty"));

I would infer this means any RDNode with hideEmpty = True won’t be hidden.

So just adding hideEmpty = True with MM should be enough.

I had been using a patch that was borrowed from Unkerballed Start which I think originally came from @flart:

//Code adapted from Flart on KSP Forums
@TechTree:NEEDS[HideEmptyTechTreeNodes]:FOR[zKiwiTechTree]
{
	// Hide all empty nodes, initially
	@RDNode,*
	{
		@hideEmpty = True
	}

	@RDNode:HAS[#id[tier*]]
	{
		@hideEmpty = False
	}
}

However, I just realized that there is a setting in the options, "Use RDNode Settings".  Setting that gets everything to show properly.

Edited by hemeac
Link to comment
Share on other sites

2 hours ago, hemeac said:

I had been using a patch that was borrowed from Unkerballed Start which I think originally came from @flart:


//Code adapted from Flart on KSP Forums
@TechTree:NEEDS[HideEmptyTechTreeNodes]:FOR[zKiwiTechTree]
{
	// Hide all empty nodes, initially
	@RDNode,*
	{
		@hideEmpty = True
	}

	@RDNode:HAS[#id[tier*]]
	{
		@hideEmpty = False
	}
}

However, I just realized that there is a setting in the options, "Use RDNode Settings".  Setting that gets everything to show properly.

I wrote the above MM patch.  I guess it made its way to a different post where you were able to grab it.

I want the default behavior of this mod to be to hide empty tech tree nodes (the name of the mod!), so I hardcode all empty nodes to be hidden within the plugin's dll.  Unless that "Use RDNode Settings" option is enabled, in which case it uses whatever is in the "hideEmpty" field directly.  The above patch helps out with that (the default value for "hideEmpty" is usually "false", which I don't want), but the player does need to remember to enable the correct option, too.

Any thoughts on a more hands-off approach for the player to get your empty nodes to show?  I couldn't think of one.  I was afraid of overwriting anyone's MM patches from the many tech trees out there (like if they load out of order), so I've been avoiding relying on any MM patches as part of this mod.

 

Link to comment
Share on other sites

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