blowfish

[1.3.1] B9PartSwitch v2.0.0 (November 15) - Switch fuels, models, nodes, and more

Recommended Posts

1 minute ago, blowfish said:

Pretty much anything you can display to the user can be localized via the usual methods.  Does that answer your question?

Sorry for wording my question vaguely. Does it support localization of the strings it provides itself? I.E. the "switch able parts" and "x subtypes"? Strings provided by mods providing configs for this mod seem to work fine, indeed.

Share this post


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

Sorry for wording my question vaguely. Does it support localization of the strings it provides itself? I.E. the "switch able parts" and "x subtypes"? Strings provided by mods providing configs for this mod seem to work fine, indeed.

An yeah, those aren’t localized.  But any mod can override those strings with localized versions

Share this post


Link to post
Share on other sites

B9PartSwitch v1.10.0 for KSP 1.3.1 is now available

  • Add new GUI that allows selecting subtype from a list
  • Allow switching in flight via switchInFlight parameter (uses new GUI)

More details on switchInFlight - this is a parameter on ModuleB9PartSwitch which defaults to false but can be set to true for a particular module.  If enabled, it will show the GUI button to select a new subtype (the slider is not visible in flight).  If resources are present on the part that would be removed, it warns you first.

I highly recommend that if you intend to use this, you create a unique set of subtypes for it.  They should have zero mass and cost and have the tanks empty by default.

Share this post


Link to post
Share on other sites

Hello! 

Have an issue lately after migrating to 1.3.1, updating modes and installing new ones. But it doesn't seem related to other modes afaik. Any ideas?

Output:

 
(Filename:  Line: -1)

InvalidOperationException: Cannot get volume before parent has been linked!
  at B9PartSwitch.PartSubtype.get_TotalVolume () [0x00000] in <filename unknown>:0 
  at B9PartSwitch.PartSubtype.get_TotalCost () [0x00000] in <filename unknown>:0 
  at B9PartSwitch.ModuleB9PartSwitch.GetModuleCost (Single baseCost, ModifierStagingSituation situation) [0x00000] in <filename unknown>:0 
  at Part.GetModuleCosts (Single defaultCost, ModifierStagingSituation sit) [0x00000] in <filename unknown>:0 
  at KSP.UI.Screens.Editor.PartListTooltip.Setup (.AvailablePart availablePart, .Callback`1 onPurchase, UnityEngine.RenderTexture texture) [0x00000] in <filename unknown>:0 
  at KSP.UI.Screens.Editor.PartListTooltipController.CreateTooltip (KSP.UI.Screens.Editor.PartListTooltip tooltip, KSP.UI.Screens.EditorPartIcon partIcon) [0x00000] in <filename unknown>:0 
  at KSP.UI.Screens.Editor.PartListTooltipController.OnTooltipSpawned (KSP.UI.Tooltip tooltip) [0x00000] in <filename unknown>:0 
  at KSP.UI.UIMasterController.SpawnTooltip (ITooltipController tooltipController) [0x00000] in <filename unknown>:0 
  at KSP.UI.PinnableTooltipController.OnPointerEnter (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <filename unknown>:0 
  at UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerEnterHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <filename unknown>:0 
  at UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerEnterHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) [0x00000] in <filename unknown>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.BaseInputModule:HandlePointerExitAndEnter(PointerEventData, GameObject)
UnityEngine.EventSystems.PointerInputModule:ProcessMove(PointerEventData)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent()
UnityEngine.EventSystems.StandaloneInputModule:Process()
UnityEngine.EventSystems.EventSystem:Update()

.cfg

PART
{
	name = kube_test
	title = Kube Test
	author = Katten
	manufacturer = m3tech
	description = Take a moment to appreciate this elegant shape! By using advanced technologies, we have been able to construct a part whose every side is the same form as all the other sides! Remarkable, yes. But beware - if you drop it on the floor, you might not know what side is up anymore!
	MODEL
	{
		model = Kube/Parts/kube_test
	}
	rescaleFactor = 2.5
	node_stack_top 		= 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 2
	node_stack_bottom 	= 0.0, -0.5, 0.0, 0.0, -1.0, 0.0, 2
	node_stack_left 	= 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 2
	node_stack_right 	= 0.0, 0.0, -0.5, 0.0, 0.0, -1.0, 2
	node_stack_front	= -0.5, 0.0, 0.0, -1.0, 0.0, 0.0, 2
	node_stack_back 	= 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 2
	node_stack_cargotop	= 0,0.48, 0.0, 0.0, -1.0, 0.0,1
	node_stack_cargobottom = 0,-0.48, 0.0, 0.0, 1.0, 0.0,1

	mass = 0.1
	module = Part
	category = Electrical
	heatConductivity = 0.12 
	skinInternalConductionMult = 4.0
	emissiveConstant = 0.4 
	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.2
	angularDrag = 2
	breakingForce = 70
	breakingTorque = 70
	crashTolerance = 20
	maxTemp = 1200 
	TechRequired = start
	entryCost = 10000
	cost = 1000
	subcategory = 0
	attachRules = 1,0,1,1,0
	bulkheadProfiles = size3

	tags = 
	baseVolume = 2000
	

	MODULE
	{
		name = ModuleB9PartSwitch
		moduleID = core
		title = Core
		switcherDescription = Core
		SUBTYPE
		{
			name = Solid
			node = left
			node = right
			transform = core_solid
			transform = node_collider_solid
		}
		SUBTYPE
		{
			name = Truss
			node = cargotop
			node = cargobottom
			transform = truss_hollow
			transform = node_collider_hollow
		}
		SUBTYPE
		{
			name = Closed truss
			node = left
			node = right
			transform = truss_hollow
			transform = truss_solid
			transform = node_collider_solid
		}
		SUBTYPE
		{
			name = Tank
			node = left
			node = right
			transform = core_tank
			transform = truss_hollow
			transform = truss_solid
			transform = node_collider_solid
		}
	}

	MODULE
	{
		name = ModuleB9PartSwitch
		moduleID = tanks
		switcherDescription = Tank
		baseVolume = 1000
		
		SUBTYPE
		{
			name = None
		}
		SUBTYPE
		{
			name = LFO
			tankType = LFOX
			addedCost = 1
			addedMass = 1
			crashTolerance = 50
			transform = tank_lfo
		}		
		
		SUBTYPE
		{
			name = Liquid Fuel
			tankType = LF
			addedCost = 1
			addedMass = 1
			crashTolerance = 50
			transform = tank_lf
		}		
		
		SUBTYPE
		{
			name = Monopropellant
			tankType = MonoPropellant
			addedCost = 1
			addedMass = 1
			crashTolerance = 50
			transform = tank_monopropellant
		}
	}	
}

 

Share this post


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

Hello! 

Have an issue lately after migrating to 1.3.1, updating modes and installing new ones. But it doesn't seem related to other modes afaik. Any ideas?

*snip*

Already answered this via another channel but for others' sake - this is usually the result of referencing a tank type that doesn't exist.  If that's the case there will also be a KeyNotFoundException higher up in the log.  I've opened an issue to try and handle the errors more smoothly.

Edited by blowfish

Share this post


Link to post
Share on other sites

@blowfish  not sure if you wanna consider this normal, or a minor issue... The GUI/switchInFlight buttons show up in the editor, along with the sliders... Dont know if its supposed to show both in editor...

Otherwise it all seems to work as advertised... Thanx for adding the in-flight functionality... :)

81WybIy.jpg

Edited by Stone Blue

Share this post


Link to post
Share on other sites

@Stone Blue yeah, I figured there wasn’t a reason to hide them in the editor, it might even be easier to use for switchers with a lot of subtypes.

Share this post


Link to post
Share on other sites

PSA - I plan to release version 2.0 soon, which will contain a potentially breaking change.  Currently, if you specify node = xxx on a subtype, B9 Part Switch will find all nodes that contain xxx.  This has caused some issues, and I plan to change it so that it will only find nodes that exactly match xxx.  So for example node = top will currently match node_stack_top, node_stack_top01, node_stack_top02, etc, but with this change it would only match node_stack_top (the node_stack_ part is stripped out by KSP in either case).  Please let me know if there are any concerns about this.

Share this post


Link to post
Share on other sites

KSP 1.3.1, B9 Part Switch 1.10.0

Early on in the log file (line 3269) I'm getting this error:

Quote

KSP-AVC -> Version file contains errors: D:\Programs\Games\Steam\steamapps\common\KSP v1.3.1\GameData\B9PartSwitch\B9PartSwitch.version

In the next line, I'm getting the following but I don't know if they're related:

Quote

 

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

KSP-AVC -> System.InvalidCastException: Cannot cast from source type to destination type.
  at KSP_AVC.AddonInfo.ParseVersion (System.Collections.Generic.Dictionary`2 data) [0x00000] in <filename unknown>:0
  at KSP_AVC.AddonInfo.GetVersion (System.Object obj) [0x00000] in <filename unknown>:0
  at KSP_AVC.AddonInfo.ParseAvc (System.String json) [0x00000] in <filename unknown>:0
  at KSP_AVC.AddonInfo..ctor (System.String path, System.String json, RemoteType remoteType) [0x00000] in <filename unknown>:0

 

It doesn't seem to be having any negative effect (but what do I know), so this is FYI.

Share this post


Link to post
Share on other sites
5 minutes ago, Brigadier said:

KSP 1.3.1, B9 Part Switch 1.10.0

Early on in the log file (line 3269) I'm getting this error:

In the next line, I'm getting the following but I don't know if they're related:

It doesn't seem to be having any negative effect (but what do I know), so this is FYI.

Yeah, the .version file had the version numbers as strings instead of numbers.  CKAN seems to digest this fine, but apparently AVC doesn't like it.  It's already been fixed, just haven't released a new version since then.

Share this post


Link to post
Share on other sites

B9 Part Switch v2.0.0 for KSP 1.3.1

Major version change as this contains a potentially breaking change (probably not though)

  • Only match on exact attach node id (this is the potentially breaking change, see below)
  • When switching in flight, resources should always start empty
  • Allow individual subtypes to not allow switching in flight via allowSwitchInFlight field
  • Allow ModuleB9PartSwitch to have its GUI hidden if it has advancedTweakablesOnly = true and advanced tweakables are disabled
  • Better error handling if resource of tank type does not exist (show error dialog in game and force the user to quit)
  • Fix .version file not being able to be parsed by KSP-AVC
  • Move remote .avc file from bintray to s3
  • Add back assembly guid (accidentally removed a while ago)

More info on only matching exact node IDs: Previously if you had node = top, that would match node_stack_top, node_stack_top01, etc.  Now it will only match node_stack_top.

Edited by blowfish

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now