blowfish

[1.7.3] B9PartSwitch v2.10.0 (Aug 18) - module switching!!!

Recommended Posts

Hi @blowfish, thank you for your work.

I was thinking of trying to write a config that would combine all Size 1 fuel tanks into a single part with switchable lengths, is that possible with Part Switch? Looking at the wiki I couldn't find a way to do that. If so, could you recommend an example?

Share this post


Link to post
Share on other sites
25 minutes ago, Nightside said:

Hi @blowfish, thank you for your work.

I was thinking of trying to write a config that would combine all Size 1 fuel tanks into a single part with switchable lengths, is that possible with Part Switch? Looking at the wiki I couldn't find a way to do that. If so, could you recommend an example?

It's doable.  Not sure I have an example handy though.  Combining models can be tricky - you can get them all on the same part with the part's MODEL nodes, but then the question is how do you reference them in order to switch.  Some models do have uniquely named transforms you can reference, but others don't, in which case you need to figure out what name KSP uses when inserting the model into the hierarchy.  I think it's something like "/Path/To/Model (clone)".  I'd recommend sarbian's DebugStuff plugin for figuring out the transform names.

Couple of other things worth noting:

  • Nodes can't currently be moved, only turned on/off.  This means that when you switch the subtype in the editor, any attached parts will stay where they are until you pick them up and move them.
  • I haven't tested extensively with any switching that changes a part's size significantly.  I think it works, but there may be scenarios I don't know about.  Colliders and drag cubes are fine, I'm more concerned about things like Unity's moment of inertia calculations.

Share this post


Link to post
Share on other sites
11 hours ago, blowfish said:

It's doable.  Not sure I have an example handy though.  Combining models can be tricky - you can get them all on the same part with the part's MODEL nodes, but then the question is how do you reference them in order to switch.  Some models do have uniquely named transforms you can reference, but others don't, in which case you need to figure out what name KSP uses when inserting the model into the hierarchy.  I think it's something like "/Path/To/Model (clone)".  I'd recommend sarbian's DebugStuff plugin for figuring out the transform names.

Couple of other things worth noting:

  • Nodes can't currently be moved, only turned on/off.  This means that when you switch the subtype in the editor, any attached parts will stay where they are until you pick them up and move them.
  • I haven't tested extensively with any switching that changes a part's size significantly.  I think it works, but there may be scenarios I don't know about.  Colliders and drag cubes are fine, I'm more concerned about things like Unity's moment of inertia calculations.

Thanks for the help @blowfish. I had partial success.

The node switching stuff all works and getting the fuel stuff should be easy enough once I figure out how to get models to switch. But when the part loads in the editor only the first model in the list to show up. When I switch through the options in the editor the part is blank (Though I can still click on it and it still has attach nodes) for the rest of the models.

Spoiler

PART
{
	name = RockomaxB9
	module = Part
	author = yes	
	MODEL
	{
		model =Squad/Parts/FuelTank/RockomaxTanks/Rockomax16
		model =Squad/Parts/FuelTank/RockomaxTanks/Rockomax32
		model =Squad/Parts/FuelTank/RockomaxTanks/Rockomax64
		model =Squad/Parts/FuelTank/RockomaxTanks/Rockomax8
	}
	rescaleFactor = 1
    node_stack_top8 = 0.0, 0.455, 0.0, 0.0, 1.0, 0.0, 2
	node_stack_bottom8 = 0.0, -0.455, 0.0, 0.0, -1.0, 0.0, 2
	node_stack_top16 = 0.0, 0.92, 0.0, 0.0, 1.0, 0.0, 2
	node_stack_bottom16 = 0.0, -0.92, 0.0, 0.0, -1.0, 0.0, 2
    node_stack_top32 = 0.0, 1.86, 0.0, 0.0, 1.0, 0.0, 2
	node_stack_bottom32 = 0.0, -1.86, 0.0, 0.0, -1.0, 0.0, 2
    node_stack_top64 = 0.0, 3.73, 0.0, 0.0, 1.0, 0.0, 2
	node_stack_bottom64 = 0.0, -3.73, 0.0, 0.0, -1.0, 0.0, 2
	node_attach = 1.25, 0.0, 0.0, 1.0, 0.0, 0.0, 1
	TechRequired = fuelSystems
	entryCost = 8200
	cost = 1550
	category = FuelTank
	subcategory = 0
	title = Size2TanksB9 //#autoLOC_500541 //#autoLOC_500541 = Rockomax X200-16 Fuel Tank
	manufacturer = #autoLOC_501637 //#autoLOC_501637 = Rockomax Conglomerate
	description = #autoLOC_500542 //#autoLOC_500542 = After many, many studies, Rockomax engineers found that the space program does indeed have a use for a tank half the size of the X200-32. No refunds.
	attachRules = 1,1,1,1,0
	mass = 1
	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.3
	angularDrag = 2
	crashTolerance = 6
	breakingForce = 200
	breakingTorque = 200
	maxTemp = 2000 // = 2900
	bulkheadProfiles = size2, srf
	tags = #autoLOC_500543 //#autoLOC_500543 = fueltank ?lfo liquid oxidizer propellant rocket
	RESOURCE
	{
		name = LiquidFuel
		amount = 720
		maxAmount = 720
	}
	RESOURCE
	{
		name = Oxidizer
		amount = 880
		maxAmount = 880
	}

    MODULE
	{
		name = ModuleB9PartSwitch
		moduleID = tankLengthSwitch
		switcherDescription = Length

		SUBTYPE
		{
			name = Rocko16
			title = Size2x16
			transform = Squad/Parts/FuelTank/RockomaxTanks/Rockomax_16
			node = top16
			node = bottom16
        }
		SUBTYPE
		{
			name = Rocko32
			title = Size2x32
			transform = Squad/Parts/FuelTank/RockomaxTanks/Rockomax_32
			node = top32
			node = bottom32
            addedMass = 1 //fix
            addedCost = 100 //fix
        }
		SUBTYPE
		{
			name = Rocko64
			title = Size2x64
			transform = Squad/Parts/FuelTank/RockomaxTanks/Rockomax_64
			node = top64
			node = bottom64
            addedMass = 1 //fix
            addedCost = 100 //fix	
		}	
		SUBTYPE
		{
			name = Rocko8
			title = Size2x8
			transform = Squad/Parts/FuelTank/RockomaxTanks/Rockomax_8
			node = top8
			node = bottom8
            addedMass = -.1 //fix
            addedCost = -50 //fix
		}
	}	
}

 

I'm not sure if I should bring in all the models in one node, or if I should make a node for each of the 4 models. When I tried it with 4 model nodes, all the models showed up simultaneously (even though it seemed like the colliders were actually switching as intended.

The only other thing I can think of right now is that I'm not naming the correct transform name (there is a lot of very similar names).

 

Share this post


Link to post
Share on other sites
20 minutes ago, Nightside said:

Thanks for the help @blowfish. I had partial success.

The node switching stuff all works and getting the fuel stuff should be easy enough once I figure out how to get models to switch. But when the part loads in the editor only the first model in the list to show up. When I switch through the options in the editor the part is blank (Though I can still click on it and it still has attach nodes) for the rest of the models.

  Hide contents

 

I'm not sure if I should bring in all the models in one node, or if I should make a node for each of the 4 models. When I tried it with 4 model nodes, all the models showed up simultaneously (even though it seemed like the colliders were actually switching as intended.

The only other thing I can think of right now is that I'm not naming the correct transform name (there is a lot of very similar names).

 

A MODEL node can only take one model.

So you do that and then they all show up at the same time.  Good.  That's what you want, sorta.  Everything needs to be there in the first place, B9PartSwitch just disables the ones you don't want.

I can tell you that you don't have the transform names quite right.  I'm at my desktop now, so I can tell you that when KSP inserts a model into the hierarchy, it ends up with a name like "Squad/Parts/Aero/cones/ConeA(Clone)" - and note that you need to get the exact name right, since there is no fuzzy matching.  You should be able to see this with DebugStuff.

Share this post


Link to post
Share on other sites
On 6/6/2018 at 10:14 AM, blowfish said:

It probably expects CryoTanks to be installed but it is not.

It does, but it's the Near Future Construction that seems to lack it.

Share this post


Link to post
Share on other sites
11 hours ago, Renae said:

It does, but it's the Near Future Construction that seems to lack it.

Hmm, based on a look at the configs involved and other reports, I think this is actually caused by having an empty CryoTanks folder in GameData.  Near Future should be able to function without CryoTanks but the empty folder makes ModuleManager think it's installed when it isn't.

Share this post


Link to post
Share on other sites
34 minutes ago, blowfish said:

Recompile against KSP 1.4.4

Well, that was fast :) Hopefuly KSP update didn't broke much with other mods either.

Share this post


Link to post
Share on other sites

@blowfish is there a way to have a fuel type not be able to be switched to due to a required Tech not being met ?

The reason I ask is I have a problem with supporting CryoTanks for Kerbalism in that LH2 should only be available once the Advanced Fuels Tech is researched.

The problem arises when CryoTanks adds fuel types to most tanks making LH2 available before the Advanced Fuels Tech is researched. 

Share this post


Link to post
Share on other sites
2 hours ago, PiezPiedPy said:

@blowfish is there a way to have a fuel type not be able to be switched to due to a required Tech not being met ?

The reason I ask is I have a problem with supporting CryoTanks for Kerbalism in that LH2 should only be available once the Advanced Fuels Tech is researched.

The problem arises when CryoTanks adds fuel types to most tanks making LH2 available before the Advanced Fuels Tech is researched. 

There's not currently a way to do this.  I have contemplated being able to add tech restrictions to subtypes in the past, but I generally don't build things until there is a solid request for it.  And this could be that.  Add an issue on Github and I'll look into what it would take.

Although just for the sake of really figuring out the use case, what would be the gameplay consequence if players could select LH2 before that tech was unlocked.  Would they be able to do something with it other than having it sit unused in a tank?  Presumably engines that use LH2 would also require that tech or a following node.

Edited by blowfish

Share this post


Link to post
Share on other sites
On 6/21/2018 at 11:07 PM, kcs123 said:

Well, that was fast :) Hopefuly KSP update didn't broke much with other mods either.

Might as well be broke for me in them changing the RCS thruster sounds along with Sepratrons, separation motors, etc in 1.4.4 (don't know what other sounds are changed as I couldn't stand playing it long enough to find out). I tried and can't play the game with the new sounds. I was one bummed out dude trying to play with these changed sounds. Back to 1.4.3 for me.

Edited by MikeO89

Share this post


Link to post
Share on other sites

How does one tell CKAN to install a particular version of a mod? For instance I'm running version 1.4.3 of KSP so I figure the 1.4.4 compatible version of B9 Part Switch is bad (at least according to this thread), however CKAN keeps wanting to install the one for 1.4.4....is there some way to ask it not to, or should I just delete it and install the appropriate one manually?

Edited by JoE Smash

Share this post


Link to post
Share on other sites
12 minutes ago, JoE Smash said:

How does one tell CKAN to install a particular version of a mod? For instance I'm running version 1.4.3 of KSP so I figure the 1.4.4 compatible version of B9 Part Switch is bad (at least according to this thread), however CKAN keeps wanting to install the one for 1.4.4....is there some way to ask it not to, or should I just delete it and install the appropriate one manually?

Which version is it trying to install?  I inspected the metadata, and v2.3.1 is marked as compatible with only KSP 1.4.3 and v2.3.2 is marked as only compatible with KSP 1.4.4.  So unless you've marked KSP 1.4.4 as being compatible in CKAN's settings, it should be installing v2.3.1.

That being said, there weren't really any breaking changes between 1.4.3 and 1.4.4 as far as this mod is concerned.  I recompile on every KSP version just to be sure but I would be surprised if something broke.

Share this post


Link to post
Share on other sites
7 minutes ago, blowfish said:

Which version is it trying to install?  I inspected the metadata, and v2.3.1 is marked as compatible with only KSP 1.4.3 and v2.3.2 is marked as only compatible with KSP 1.4.4.  So unless you've marked KSP 1.4.4 as being compatible in CKAN's settings, it should be installing v2.3.1.

That being said, there weren't really any breaking changes between 1.4.3 and 1.4.4 as far as this mod is concerned.  I recompile on every KSP version just to be sure but I would be surprised if something broke.

Ok, got it. CKAN defaults to v1.4 compatible....so I uncheck that and then "add 1.4.3" and check that only....then it installs v2.3.1 for B9 part switch....

Sorry still new and don't know what I'm doing I guess.....probaby why my career save corrupted and I get to start over from scratch now....

Share this post


Link to post
Share on other sites

Everything was going fine until I accidentally updated this to the wrong version, or just had to download ONE MORE MOD which jacked up my whole game.

I want to say I added Fuel Tanks Plus, or updated this, or Interstellar Fuel Switch....no idea what I did actually.

Then I randomly realized most of my parts were sorting by mass all out of order and there was no way I could fix it.

I eventually uninstalled a few of my mods at a time (starting with over 100), and then waiting for my game to load over and over. Whatever it was continued until I had uninstalled everything. Then it stll continued after uninstalling and reinstalling the beta version of 1.4.3 through Steam.

I am assuming this means some value for fuel density must be overwritten in my save file. I don't even know if that is possible, or where to look in my file with notepad.....all I know is my save file is ginormous and I don't know what half of it does.

I just hope whatever happened doesn't happen again because I have just about lost my patience with this game. I mean I like it....but I seem to be able to break it too easily, so I seem to spend more time trying to fix stuff than actually doing missions and progressing....

Share this post


Link to post
Share on other sites

@JoE Smash here are some useful practices I've found for avoiding these scenarios:

  1. Don't mod your Steam install.  Steam auto-updates can leave you with incompatible mods and a broken install.  Even if you disable automatic updates it's too easy to forget something end end up with a broken mod.  Copy KSP outside of your Steam folder and mod it there.  KSP will work fine.
  2. Start with a fresh install for each KSP version.  This is a pain, yes, but you can ensure that all your mods are working before trying to port over a save.  And if something proves to be broken you still have the old version to work with until it gets fixed.
  3. Back up your saves.  If one gets corrupted just restore from the backups.

Share this post


Link to post
Share on other sites

The thing I am confused most about is it seems the issue that caused me to spend a whole day uninstalling mods and restarting the game over and over..... was still present even after uninstalling all mods and then even uninstalling the whole game and starting a new career from scratch on a clean install of 1.4.3.2152 from Steam.

I deleted everything, even all the left over folders and settings files.

Despite deleting everything and starting over parts are still not sorting by mass in order.

I am wondering if the beta version of 1.4.3 build 2152 is just bad, and I should try an even earlier build? Or are there more files in a folder somewhere that don't actually get deleted when you uninstall....like the unity files and things in user/steamapps/LocalLow....or wherever the crash and log files go to exactly....

Like should I delete all that stuff too? And if so, I'm not sure I know where all the secret locations are were stuff from the game might be...other than the normal program file stuff that deletes when you uninstall the game normally....

Share this post


Link to post
Share on other sites

You are quick dude. I didn't even know 1.4.5 was officially out. I'm a little nervous about it actually. 1.4.4 was a no go for me cause of the changed RCS thruster sound. I couldn't get used to it cause the way I play, I use RCS thrusters a lot. Will have to try this version to see what's up. If it's got those same sounds I will stick with 1.4.3.

Share this post


Link to post
Share on other sites
6 hours ago, blowfish said:

B9PartSwitch v2.3.3 for KSP 1.4.5

  • Recompile against KSP 1.4.5

So no changes other than a recompile?

And, have you tested the new version against 1.4.3?  Asking because CKAN is offering to update, and while I'm 99% sure it's ok, just trying to confirm.

Thx

Share this post


Link to post
Share on other sites
3 hours ago, linuxgurugamer said:

So no changes other than a recompile?

And, have you tested the new version against 1.4.3?  Asking because CKAN is offering to update, and while I'm 99% sure it's ok, just trying to confirm.

Thx

The metadata is only marked as compatible with 1.4.5.  I don't think anything would break in 1.4.3, but I'm surprised that's happening.  Maybe CKAN doesn't know about 1.4.5 yet?

Share this post


Link to post
Share on other sites
1 hour ago, blowfish said:

The metadata is only marked as compatible with 1.4.5.  I don't think anything would break in 1.4.3, but I'm surprised that's happening.  Maybe CKAN doesn't know about 1.4.5 yet?

I'll take a look at it

Share this post


Link to post
Share on other sites

@blowfish

The .version file in the B9 part switch is showing it as compatible with 1.4.4, this is what I got from the s3 link:

{
  "NAME"     : "B9 Part Switch",
  "DOWNLOAD" : "https://github.com/blowfishpro/B9PartSwitch/releases",
  "URL"      : "https://s3.amazonaws.com/blowfish-ksp-b9partswitch-avc/ksp-1.4.4/B9PartSwitch.version",
  "GITHUB" : {
    "USERNAME"   : "blowfishpro",
    "REPOSITORY" : "B9PartSwitch"
  },
  "VERSION" : {
    "MAJOR" : 2,
    "MINOR" : 3,
    "PATCH" : 2
  },
  "KSP_VERSION" : {
    "MAJOR" : 1,
    "MINOR" : 4,
    "PATCH" : 4
  }
}

 

Share this post


Link to post
Share on other sites

@linuxgurugamer each KSP version has a different file.  So that’s presumably the one pointed to from v2.3.2?

The idea is that it’ll tell you about updates that affect your KSP version.  Unfortunately it doesn’t handle the case that you upgrade KSP while leaving the mod on the old version (it will still look for updates on the old KSP version).  I’ve thought about ways to deal with this but haven’t come up with anything yet.

Share this post


Link to post
Share on other sites
2 hours ago, blowfish said:

The idea is that it’ll tell you about updates that affect your KSP version.  Unfortunately it doesn’t handle the case that you upgrade KSP while leaving the mod on the old version (it will still look for updates on the old KSP version).

Looking through the release history on GitHub, it doesn't look like you're doing releases for older versions (like maintaining parallel branches for 1.3 and 1.4 or something), so it's not clear what the use-case is for this.  From a user's perspective, it seems like the main effect is that if you install a new KSP version without manually checking for a matching B9PartSwitch update, you lose all B9PartSwitch update notifications until you remember to check manually.

For KSP patch releases like 1.4.4->1.4.5, I typically just upgrade immediately (since most mods are unaffected) and rely on AVC to tell me when mods are updated to "officially" support the new version.  For most mods, that works fine, but I tend to forget that B9PartSwitch is an exception, so I end up continuing to run an old version because I don't know it's been updated.

Share this post


Link to post
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.