Sign in to follow this  
Rivvik

Creating a part that utilizes two different plugins?

Recommended Posts

I queried this in the KIS thread, but to be proactive, I want to take a stab at doing this myself:

I made a tiny drone but assembly with @IgorZ KIS system is not possible as it uses Tweakscale, heavily, and KIS cannot accept full craft or sub assemblies into its Inventories. And @allista's Hangar mod does not supply a small enough item, nor are said items manipulable using KIS' EVA or inventory functions.

 

So here's my plan:

 

 

I would like to create a Box.

This box will be able to be carried by a Kerbal in EVA and stored in an inventory using KIS functionality.

This box will also utilize Hangar functionality to store a very small craft within itself.

Upon placing the Box on a surface, an option to open or pick up the box will be presented upon interaction.

Picking up the box will simply pick it up.

Opening the box will trigger the Hangar spawning function of the assigned small craft.

At this point the box will simply be a return point and sit on the ground.

The spawned craft will act as a craft.

The craft, upon landing or stopping on the box, will allow the box to be closed.

Upon closing, the box will enact Hangar's deconstruction function, and the box will return to being a simple EVA item.

This will then allow the box to be moved, re-opened, stored, etc.

I would like to make small boxes of various dimensions afterward, supposing this test works.

 

 

I have never made a mod before, but I want to learn.

Thank you for any help provided.

Share this post


Link to post
Share on other sites

Well, getting in into the modders world is not an easy task :)  I'd recommend you to start from some existing mod and see how it's implemented (all KSP mods are required to be open-source). Specifically for the KIS modules, try looking at the fun parts - they were made mostly for demonstrating the KIS mod abilities, but you may get an idea of how it's working. To solve the KIS part of the task, you only need to add a ModuleKISItemEvaTweaker module into your part to allow it being carried. making the carriable ability conditional (opened/closed) is not possible in KIS, so you'll have to change your feature design somehow to workaround it. I'd discourage you to directly talking from your code to KIS to make it an item equipped, it would be a very error prone approach.

As for the rest, you'll have to make your own module that will:

  1. Add a context menu item to trigger open/close action.
  2. Actually call the hangar mod code to spawn a vessel.
  3. Support the game editor to allow the player to add a vessel into the box.

You may save some efforts by using the third-party libraries. E.g. "Firespitter" or KSPDev Utils.

Share this post


Link to post
Share on other sites

Hey, I could simply add appropriate MM patches to make at least some of the hangars (e.g. the box fairing) KISable.

Share this post


Link to post
Share on other sites
12 hours ago, allista said:

Hey, I could simply add appropriate MM patches to make at least some of the hangars (e.g. the box fairing) KISable.

I almost pulled it off with the box hangar fairing. However, the KIS containers saw the Hangar as it's default scale, despite tweaking. I'm trying to "commandeer" a certain cardboard box to test the concept of "nesting" the hangar'd box in a KIS inventory.

 

Also installing Unity with the part tools is proving difficult

Edited by Rivvik

Share this post


Link to post
Share on other sites
9 hours ago, Rivvik said:

I almost pulled it off with the box hangar fairing. However, the KIS containers saw the Hangar as it's default scale, despite tweaking. I'm trying to "commandeer" a certain cardboard box to test the concept of "nesting" the hangar'd box in a KIS inventory.

Also installing Unity with the part tools is proving difficult

That's the problem then. But you can make a smaller new part by simply copying its .cfg and changing the MODEL.scale (and removing the AnisotropicPartResizer MODULE).

Oh yes, it is, especially on Linux :confused:

Share this post


Link to post
Share on other sites

Hey, guess what works with but a minimum of alteration!!

 

 

 

Here's the config modified from Alista's Boxfairing. Adding only KIS functions and a slight scaling modification!

PART {
	name = ToyBoxFairings
	module = Part
	author = Allis Tauri

	MODEL
	{
		model = Hangar/Parts/Models/BoxFairings
	}
	rescaleFactor = 0.1
	scale = 0.1

	node_stack_top  = 0.0, 1.12532, 0, 0, 1, 0, 2
	node_stack_bottom  = 0.0, -1.26244, 0, 0, -1, 0, 2
	
	TechRequired = generalRocketry
	category = Pods
	subcategory = 0
	title = Toybox Fairing Hangar
	manufacturer = AT Industries
	description = This fairing box uses our newest Hangar (TM) technology to provide the easiest and safest transfer of your payload to other planet or moon.  

	// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
	attachRules = 1,1,1,1,0

	//================================= BoxFairings ==================================
	//base: 1.589m^3, 0.1769204t, 556.8185Cr
	//   surface: [18.04m^2 x 0.002m], 2.63t/m^3, 0.0948904t, 86.592Cr
	//   content: 1.4765m^3, 0.02t/m^3, 0.02953t, 1.4765Cr
	//   batteries: 0.0125m^3, 0.2t/m^3 0.0025t, 68.75Cr
	//      energy amount = 50.0
	//   jettison-charge: 0.1m^3, 0.5t/m^3 0.05t, 400.0Cr
	//
	//cap-left: 1.24m^3, 0.0930748t, 63.544Cr
	//   surface: [12.98m^2 x 0.002m], 2.63t/m^3, 0.0682748t, 62.304Cr
	//   content: 1.24m^3, 0.02t/m^3, 0.0248t, 1.24Cr
	//
	//cap-right: 0.88m^3, 0.0749866t, 53.248Cr
	//   surface: [10.91m^2 x 0.002m], 2.63t/m^3, 0.0573866t, 52.368Cr
	//   content: 0.88m^3, 0.02t/m^3, 0.0176t, 0.88Cr
	//
	//walls: 1.8148m^3, 0.192128t, 404.48Cr
	//   surface: [50.56m^2 x 0.002m], 1.9t/m^3, 0.192128t, 404.48Cr
	//---------------------------------------  ---------------------------------------
	//Total volume:    5.524 m^3, 0.124430 t
	//Total surface:   92.490 m^2, 0.412680 t
	//Additional mass: 0.040000 t
	//Additional cost: 450.000 Cr
	//Resources  cost: 0.000 Cr
	entryCost = 5645
	cost = 1529
	mass = 0.577110

	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.2
	angularDrag = 3
	crashTolerance = 10
	breakingForce = 200
	breakingTorque = 200
	maxTemp = 2700
	fuelCrossFeed = False
	
	stageOffset = -1
	childStageOffset = -1
	bulkheadProfiles = size2
	CrewCapacity = 0
	
	vesselType = Ship
	
	// --- FX definitions --- 
	//does not need particle emitter
	// fx_gasBurst_white = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, decouple
	sound_decoupler_fire = decouple
	
	INTERNAL
	{
		name = Placeholder
	}

	MODULE 
	{
		name = HangarFairings
		LaunchVelocity = 0, 0, 0
		EnergyConsumption = 0
		HangarName = Box Fairing
		Fairings = wall, cap-left, cap-right
		FairingsCost = 50
		FairingsDensity = 0.1 //beware the negative mass: this density should be in agreement with part mass
		BaseCoMOffset = 0, -1.1588, 0
		JettisonDirection = 1, 0, 1
		JettisonForce = 650
		DecoupleNodes = top
	}
	
	MODULE
	{
		name = SingleUseHangarStorage
		HangarSpace = hangar-space
		SpawnTransform = launch-position
		SpawnOffset = 0,0,-1 //move spawned ship on ship.bounds.extents.y
	}
	
	MODULE
	{
		name = ModuleDecouple
		ejectionForce = 10
		explosiveNodeID = top
		isOmniDecoupler = false
		menuName = Detach Container
		stagingEnabled = False
		stagingEnableText = Detaching Not Staged
		stagingDisableText = Detaching Staged
	}
	
	MODULE
	{
		name = ModuleCommand
		minimumCrew = 0
		RESOURCE
		{
			name=ElectricCharge
			rate = 0.03
		}
	}
	
	MODULE
    {
        name = ModuleKerbNetAccess
        MinimumFoV = 17
        MaximumFoV = 63
        AnomalyDetection = 0.12
        DISPLAY_MODES
        {
            Mode = Terrain
        }
    }
    
    MODULE
	{
		name = ModuleDataTransmitter
		antennaType = DIRECT
		packetInterval = 0.35
		packetSize = 2
		packetResourceCost = 12.0
		requiredResource = ElectricCharge
		DeployFxModules = 0
		antennaPower = 5000
		antennaCombinable = True
	}
	
	MODULE
	{
		name = ModuleTestSubject
		
		// nowhere: 0, srf: 1, ocean: 2, atmo: 4, space: 8
		environments = 15
		
		useStaging = true
		useEvent = True
	}
	
	MODULE
	{
		name = AnisotropicPartResizer
		specificMass = 0.12443, 0.4126798, 0.0, 0.04 //weights: [ 0.215608884133, 0.715080215238, 0.0, 0.0693109006293 ]
		specificCost = 472.3465, 605.744, 0.0, 450.0 //weights: [ 0.309108982747, 0.396405841146, 0.0, 0.294485176107 ]
		size = 1
	}
	
		MODULE
	{
		name = ModuleKISItemEvaTweaker
		volumeOverride = 3
		editorItemsCategory = false
		carriable = true
		equipMode = part
		equipSlot = jetpack
		equipMeshName = jetpack_base01
		equipBoneName = bn_jetpack01
		equipPos = (0,0.21,-0.3)
		equipDir = (280,0,0)
		runSpeed = 0.8
	}
	
	//resources
	RESOURCE
	{
		name = ElectricCharge
		amount = 50
		maxAmount = 50
	}
}
//:mode=c#:

 

 

 

EDIT: I have since fixed the orientation issue and the drone flew properly.

 

 

Edited by Rivvik
update

Share this post


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

Hey, guess what works with but a minimum of alteration!!

 

 

 

Here's the config modified from Alista's Boxfairing. Adding only KIS functions and a slight scaling modification!


PART {
	name = ToyBoxFairings
	module = Part
	author = Allis Tauri

	MODEL
	{
		model = Hangar/Parts/Models/BoxFairings
	}
	rescaleFactor = 0.1
	scale = 0.1

	node_stack_top  = 0.0, 1.12532, 0, 0, 1, 0, 2
	node_stack_bottom  = 0.0, -1.26244, 0, 0, -1, 0, 2
	
	TechRequired = generalRocketry
	category = Pods
	subcategory = 0
	title = Toybox Fairing Hangar
	manufacturer = AT Industries
	description = This fairing box uses our newest Hangar (TM) technology to provide the easiest and safest transfer of your payload to other planet or moon.  

	// attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
	attachRules = 1,1,1,1,0

	//================================= BoxFairings ==================================
	//base: 1.589m^3, 0.1769204t, 556.8185Cr
	//   surface: [18.04m^2 x 0.002m], 2.63t/m^3, 0.0948904t, 86.592Cr
	//   content: 1.4765m^3, 0.02t/m^3, 0.02953t, 1.4765Cr
	//   batteries: 0.0125m^3, 0.2t/m^3 0.0025t, 68.75Cr
	//      energy amount = 50.0
	//   jettison-charge: 0.1m^3, 0.5t/m^3 0.05t, 400.0Cr
	//
	//cap-left: 1.24m^3, 0.0930748t, 63.544Cr
	//   surface: [12.98m^2 x 0.002m], 2.63t/m^3, 0.0682748t, 62.304Cr
	//   content: 1.24m^3, 0.02t/m^3, 0.0248t, 1.24Cr
	//
	//cap-right: 0.88m^3, 0.0749866t, 53.248Cr
	//   surface: [10.91m^2 x 0.002m], 2.63t/m^3, 0.0573866t, 52.368Cr
	//   content: 0.88m^3, 0.02t/m^3, 0.0176t, 0.88Cr
	//
	//walls: 1.8148m^3, 0.192128t, 404.48Cr
	//   surface: [50.56m^2 x 0.002m], 1.9t/m^3, 0.192128t, 404.48Cr
	//---------------------------------------  ---------------------------------------
	//Total volume:    5.524 m^3, 0.124430 t
	//Total surface:   92.490 m^2, 0.412680 t
	//Additional mass: 0.040000 t
	//Additional cost: 450.000 Cr
	//Resources  cost: 0.000 Cr
	entryCost = 5645
	cost = 1529
	mass = 0.577110

	dragModelType = default
	maximum_drag = 0.2
	minimum_drag = 0.2
	angularDrag = 3
	crashTolerance = 10
	breakingForce = 200
	breakingTorque = 200
	maxTemp = 2700
	fuelCrossFeed = False
	
	stageOffset = -1
	childStageOffset = -1
	bulkheadProfiles = size2
	CrewCapacity = 0
	
	vesselType = Ship
	
	// --- FX definitions --- 
	//does not need particle emitter
	// fx_gasBurst_white = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, decouple
	sound_decoupler_fire = decouple
	
	INTERNAL
	{
		name = Placeholder
	}

	MODULE 
	{
		name = HangarFairings
		LaunchVelocity = 0, 0, 0
		EnergyConsumption = 0
		HangarName = Box Fairing
		Fairings = wall, cap-left, cap-right
		FairingsCost = 50
		FairingsDensity = 0.1 //beware the negative mass: this density should be in agreement with part mass
		BaseCoMOffset = 0, -1.1588, 0
		JettisonDirection = 1, 0, 1
		JettisonForce = 650
		DecoupleNodes = top
	}
	
	MODULE
	{
		name = SingleUseHangarStorage
		HangarSpace = hangar-space
		SpawnTransform = launch-position
		SpawnOffset = 0,0,-1 //move spawned ship on ship.bounds.extents.y
	}
	
	MODULE
	{
		name = ModuleDecouple
		ejectionForce = 10
		explosiveNodeID = top
		isOmniDecoupler = false
		menuName = Detach Container
		stagingEnabled = False
		stagingEnableText = Detaching Not Staged
		stagingDisableText = Detaching Staged
	}
	
	MODULE
	{
		name = ModuleCommand
		minimumCrew = 0
		RESOURCE
		{
			name=ElectricCharge
			rate = 0.03
		}
	}
	
	MODULE
    {
        name = ModuleKerbNetAccess
        MinimumFoV = 17
        MaximumFoV = 63
        AnomalyDetection = 0.12
        DISPLAY_MODES
        {
            Mode = Terrain
        }
    }
    
    MODULE
	{
		name = ModuleDataTransmitter
		antennaType = DIRECT
		packetInterval = 0.35
		packetSize = 2
		packetResourceCost = 12.0
		requiredResource = ElectricCharge
		DeployFxModules = 0
		antennaPower = 5000
		antennaCombinable = True
	}
	
	MODULE
	{
		name = ModuleTestSubject
		
		// nowhere: 0, srf: 1, ocean: 2, atmo: 4, space: 8
		environments = 15
		
		useStaging = true
		useEvent = True
	}
	
	MODULE
	{
		name = AnisotropicPartResizer
		specificMass = 0.12443, 0.4126798, 0.0, 0.04 //weights: [ 0.215608884133, 0.715080215238, 0.0, 0.0693109006293 ]
		specificCost = 472.3465, 605.744, 0.0, 450.0 //weights: [ 0.309108982747, 0.396405841146, 0.0, 0.294485176107 ]
		size = 1
	}
	
		MODULE
	{
		name = ModuleKISItemEvaTweaker
		volumeOverride = 3
		editorItemsCategory = false
		carriable = true
		equipMode = part
		equipSlot = jetpack
		equipMeshName = jetpack_base01
		equipBoneName = bn_jetpack01
		equipPos = (0,0.21,-0.3)
		equipDir = (280,0,0)
		runSpeed = 0.8
	}
	
	//resources
	RESOURCE
	{
		name = ElectricCharge
		amount = 50
		maxAmount = 50
	}
}
//:mode=c#:

 

 

 

EDIT: I have since fixed the orientation issue and the drone flew properly.

 

 

You may also want to decrease the mass/cost of the part and the base CoM offset and jettison force of the fairings.

Share this post


Link to post
Share on other sites

@Rivvik, also, when you deem your part config finished, you can share it with me so that I could include it into Hangar as MM patch that is active when KIS is installed. I imagine others may find it useful as well :cool:

Share this post


Link to post
Share on other sites

Having an odd issue with the tank probe. Neither that or the quad-copter seem to have their associated plugins in order when respawned.

 

Probe control room causes the camera to an odd internal clipping view, and I think the tank probe, which utilizes kerbal Wheel plugins for the treads, has its physics go crazy when trying to move.

Both craft work fine if spawned normally from the sph.

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
Sign in to follow this