Jump to content

Kerbalism Greenhouses - Convert to rate based instead of harvest based.


RoadWarrior9
 Share

Recommended Posts

I came up with a workaround (config) that should allow the default greenhouse that comes with kerbalism to use a rate based food per second output instead of having to go to the ship and harvest the food when the harvest is ready every 200 days. This sets the harvest time to >1000 years and adds a resource output of food (along with oxygen) that should match the old output. There are also configs that modify and add the greenhouse functionality to the Stockalike Station Parts Redux greenhouse parts. Create a folder like zMyMods and create a *.cfg file and copy the sections you want to it.

//Kerbalism greenhouse patchs

@PART[kerbalism-greenhouse]:NEEDS[ProfileDefault]:AFTER[KerbalismDefault]  // Default Kerbalism greenhouse
{
  @MODULE[Greenhouse]
  {
    @crop_rate = 0.00000000005
	
	OUTPUT_RESOURCE
	{
		name = Food
		rate = 0.000003190104
	}
  }
}

@PART[sspx-greenhouse-25-1]:NEEDS[StationPartsExpansionRedux,ProfileDefault]:AFTER[KerbalismDefault]  // PPD-F412M Hydroponics Module
{
	@MODULE[Greenhouse]
	{
		@crop_rate = 0.00000000005

		OUTPUT_RESOURCE
		{
			name = Food
			rate = 0.000006380208
		}
	}
	
	MODULE
	{
		name = Comfort
		bonus = plants
		desc =  There's something inherently calming about an artificial slice of nature, kept alive only by the miracles of duct-tape and kerbal engineering. Let's hope the crew doesn't think too much about it.
	}
}

@PART[sspx-greenhouse-375-1]:NEEDS[StationPartsExpansionRedux,ProfileDefault]:AFTER[KerbalismDefault]  // PXL-R4NCH-3R Hydroponics Module
{
	@MODULE[Greenhouse]
	{
		@crop_rate = 0.00000000005

		OUTPUT_RESOURCE
		{
			name = Food
			rate = 0.000006380208
		}
	}
	
	MODULE
	{
		name = Comfort
		bonus = plants
		desc =  There's something inherently calming about an artificial slice of nature, kept alive only by the miracles of duct-tape and kerbal engineering. Let's hope the crew doesn't think too much about it.
	}
}

@PART[sspx-greenhouse-5-1]:NEEDS[StationPartsExpansionRedux,ProfileDefault]:AFTER[KerbalismDefault]  // SDV-4 'Demeter' Cultivation Module
{
	!MODULE[Greenhouse] {}
	MODULE
	{
		name = Greenhouse

		crop_resource = Food
		crop_size = 110.0
		crop_rate = 0.00000000005
		ec_rate = 10
		light_tolerance = 400.0
		pressure_tolerance = 0.1
		radiation_tolerance = 0.000008333

		INPUT_RESOURCE
		{
			name = Ammonia
			rate = 0.0003828125
		}

		INPUT_RESOURCE
		{
			name = Water
			rate = 0.0000127604
		}

		INPUT_RESOURCE
		{
			name = WasteAtmosphere
			rate = 0.004983199
		}

		INPUT_RESOURCE
		{
			name = CarbonDioxide
			rate = 0.0016610663
		}

		OUTPUT_RESOURCE
		{
			name = Oxygen
			rate = 0.006895193
		}

		OUTPUT_RESOURCE
		{
			name = Food
			rate = 0.000012760416
		}
	}

	MODULE
	{
		name = Comfort
		bonus = plants
		desc =  There's something inherently calming about an artificial slice of nature, kept alive only by the miracles of duct-tape and kerbal engineering. Let's hope the crew doesn't think too much about it.
	}

	RESOURCE
	{
		name = Ammonia
		amount = 1000
		maxAmount = 1000
	}

	RESOURCE
	{
		name = CarbonDioxide
		amount = 18000
		maxAmount = 18000
	}

	// To support pressure control
	@MODULE[Configure]
	{
		@SETUP[Pressure?Control]
		{
		!RESOURCE[Nitrogen] {}
		}
	}

	RESOURCE
	{
		name = Nitrogen
		amount = 20000
		maxAmount = 20000
	}

	RESOURCE
	{
		name = Water
		amount = 50	
		maxAmount = 50
	}
}

@PART[sspx-dome-greenhouse-5-1]:NEEDS[StationPartsExpansionRedux,ProfileDefault]:AFTER[KerbalismDefault]  // SDV-G2 'Villa' Cultivation Dome
{
	!MODULE[Greenhouse] {}
	MODULE
	{
		name = Greenhouse

		crop_resource = Food								// name of resource produced by harvests
		// Twice as effective as kerbalism-greenhouse part. 
		// See https://forum.kerbalspaceprogram.com/index.php?/topic/172400-131145-kerbalism-v180/&page=32&tab=comments#comment-3446891 for details.

		// Both growing "rings" of this greenhouse are unfortunately in the same section. No independent growing possible. (Different watering and lighting needs for different grow stages). 
		crop_size = 80.0									// 2x kerbalism-greenhouse
		crop_rate = 0.00000000005					 // regular growth speed
		ec_rate = 7												 // 2x"kerbalism-greenhouse"
		light_tolerance = 400.0						 // minimum lighting flux required for growth, in W/m^2
		pressure_tolerance = 0.1						// minimum pressure required for growth, in sea level atmospheres
		radiation_tolerance = 0.000008333	 // maximum radiation allowed for growth in rad/s, considered after shielding is applied

		INPUT_RESOURCE
		{
			name = Ammonia
			rate = 0.0002777777							// 2x"kerbalism-greenhouse"
		}

		INPUT_RESOURCE
		{
			name = Water
			rate = 0.000009259247							 // 2x"kerbalism-greenhouse"
		}

		INPUT_RESOURCE
		{
			name = WasteAtmosphere						// Plants work on WasteAtmosphere and replace a scrubber, if not enough WasteAtmosphere exists then CO2 is used
			rate = 0.0036159							 // 2x"kerbalism-greenhouse"
		}

		INPUT_RESOURCE
		{
			name = CarbonDioxide							// Kerbals don't provide enough WasteAtmosphere for their required food production. If excess WasteAtmosphere is
																				// present then it will be used in place of CO2 injection
			rate = 0.0012053							// 2x"kerbalism-greenhouse"
		}

		// Note. if there is a deficiency in the amount of WasteAtmosphere needed then the missing amount of WasteAtmosphere will be added to the
		// CarbonDioxide input and Vies Versa if not enough CarbonDioxide is present and there is extra WasteAtmosphere.
		// If there is not enough resources then the plants will suffer.

		OUTPUT_RESOURCE
		{
			name = Oxygen
			rate = 0.00500331							 // 200% of oxygen required by 1 crew member
		}

		OUTPUT_RESOURCE
		{
			name = Food
			rate = 0.00000992592587						 // 200% of oxygen required by 1 crew member
		}
	}

	MODULE
	{
		name = Comfort
		bonus = plants
		desc =  There's something inherently calming about an artificial slice of nature, kept alive only by the miracles of duct-tape and kerbal engineering. Let's hope the crew doesn't think too much about it.
	}

	//	Concider those nice IVA tanks and closets for increasing current resource capacity. I won't touch em for now.
	RESOURCE
	{
		name = Ammonia
		amount = 750												// 2x"kerbalism-greenhouse"
		maxAmount = 750
	}

	RESOURCE
	{
		name = CarbonDioxide
		amount = 15000											 // 2x"kerbalism-greenhouse"
		maxAmount = 15000
	}

	// To support pressure control
	@MODULE[Configure]
	{
		@SETUP[Pressure?Control]
		{
		!RESOURCE[Nitrogen] {}
		}
	}

	RESOURCE
	{
		name = Nitrogen
		amount = 15000											// 1x"kerbalism-greenhouse" as it does not mess with crops
		maxAmount = 15000
	}

	RESOURCE
	{
		name = Water
		amount = 35												 // 2x"kerbalism-greenhouse"
		maxAmount = 35
	}
}


@PART[sspx-aquaculture-375-1]:NEEDS[StationPartsExpansionRedux,ProfileDefault]:AFTER[KerbalismDefault]  // PXL-F15H Aquaculture Module
{
	!MODULE[Greenhouse] {}
	MODULE
	{
		name = Greenhouse

		crop_resource = Food								// name of resource produced by harvests
		// Twice as effective as kerbalism-greenhouse part. 
		// See https://forum.kerbalspaceprogram.com/index.php?/topic/172400-131145-kerbalism-v180/&page=32&tab=comments#comment-3446891 for details.

		// Both growing "rings" of this greenhouse are unfortunately in the same section. No independent growing possible. (Different watering and lighting needs for different grow stages). 
		crop_size = 55									// 2x kerbalism-greenhouse
		crop_rate = 0.00000000005					 // regular growth speed
		ec_rate = 5												 // 2x"kerbalism-greenhouse"
		light_tolerance = 400.0						 // minimum lighting flux required for growth, in W/m^2
		pressure_tolerance = 0.1						// minimum pressure required for growth, in sea level atmospheres
		radiation_tolerance = 0.000008333	 // maximum radiation allowed for growth in rad/s, considered after shielding is applied

		INPUT_RESOURCE
		{
			name = Ammonia
			rate = 0.00019140625							// 2x"kerbalism-greenhouse"
		}

		INPUT_RESOURCE
		{
			name = Water
			rate = 0.0000063802							 // 2x"kerbalism-greenhouse"
		}

		INPUT_RESOURCE
		{
			name = WasteAtmosphere						// Plants work on WasteAtmosphere and replace a scrubber, if not enough WasteAtmosphere exists then CO2 is used
			rate = 0.0024915995							 // 2x"kerbalism-greenhouse"
		}

		INPUT_RESOURCE
		{
			name = CarbonDioxide							// Kerbals don't provide enough WasteAtmosphere for their required food production. If excess WasteAtmosphere is
			rate = 0.00083053315							// 2x"kerbalism-greenhouse"
		}

		// Note. if there is a deficiency in the amount of WasteAtmosphere needed then the missing amount of WasteAtmosphere will be added to the
		// CarbonDioxide input and Vies Versa if not enough CarbonDioxide is present and there is extra WasteAtmosphere.
		// If there is not enough resources then the plants will suffer.

		OUTPUT_RESOURCE
		{
			name = Oxygen
			rate = 0.0034475965							 // 200% of oxygen required by 1 crew member
		}

		OUTPUT_RESOURCE
		{
			name = Food
			rate = 0.000006380208						 // 200% of oxygen required by 1 crew member
		}
	}

	MODULE
	{
		name = Comfort
		bonus = plants
		desc =  There's something inherently calming about an artificial slice of nature, kept alive only by the miracles of duct-tape and kerbal engineering. Let's hope the crew doesn't think too much about it.
	}

	//	Concider those nice IVA tanks and closets for increasing current resource capacity. I won't touch em for now.
	RESOURCE
	{
		name = Ammonia
		amount = 544												// 2x"kerbalism-greenhouse"
		maxAmount = 544
	}

	RESOURCE
	{
		name = CarbonDioxide
		amount = 9000											 // 2x"kerbalism-greenhouse"
		maxAmount = 9000
	}

	// To support pressure control
	@MODULE[Configure]
	{
		@SETUP[Pressure?Control]
		{
		!RESOURCE[Nitrogen] {}
		}
	}

	RESOURCE
	{
		name = Nitrogen
		amount = 10000											// 1x"kerbalism-greenhouse" as it does not mess with crops
		maxAmount = 10000
	}

	RESOURCE
	{
		name = Water
		amount = 22												 // 2x"kerbalism-greenhouse"
		maxAmount = 22
	}
}

 

Edited by RoadWarrior9
Link to comment
Share on other sites

On 12/2/2021 at 11:21 PM, RoadWarrior9 said:

I came up with a workaround (config) that should allow the default greenhouse that comes with kerbalism to use a rate based food per second output instead of having to go to the ship and harvest the food when the harvest is ready every 200 days. This sets the harvest time to >1000 years and adds a resource output of food (along with oxygen) that should match the old output. There are also configs that modify and add the greenhouse functionality to the Stockalike Station Parts Redux greenhouse parts. Create a folder like zMyMods and create a *.cfg file and copy the sections you want to it.

 

ok, let me get this straight:

1) I only have kerbalism greenhouses, so i only need

@PART[kerbalism-greenhouse]:NEEDS[ProfileDefault]:AFTER[KerbalismDefault]  // Default Kerbalism greenhouse
{
  @MODULE[Greenhouse]
  {
    @crop_rate = 0.00000000005
	
	OUTPUT_RESOURCE
	{
		name = Food
		rate = 0.000003190104
	}
  }
}

this part, right?

2) I can do that to my exhisting profile, and it will start working for missions already in progress?

3) where exactly do I need to copy the stuff? do i make a new config file, or do I copy into an exhisting config file?

 

if so, you've done me a huge service

Edited by king of nowhere
Link to comment
Share on other sites

That should work. I put it in an existing game and it changed to the rate based version with no issues. If you have a harvest pending you may need to complete the harvest to get the rate part working. Also you may need to change the section ":AFTER[KerbalismDefault]" to ":FINAL" depending on what order your patch runs. This should run after kerbalism. I would suggest putting personal patches in a folder called "zz..." so it loads after all of the other patches. I think module manager loads by folder name if everything else is the same.

Edited by RoadWarrior9
Link to comment
Share on other sites

for the stock greenhouse, you made a calculation mistake. food per second should be

0.0000063796

 

i applied the patch to my game, where I had this self-sufficient ship, and it was losing food. i remade the calculations, and I got the new value, which is almost twice the one you posted.

Can't say if there are similar mistakes with the other greenhouses, as i don't have those mods

EDIT: but aside from that, it works perfectly.

THANK YOU

Do you have an idea what it means to run a 300-years mission and having to stop every 200 days to harvest food? i wish i had that earlier.

(in retrospect, it's simple enough that i could have done it myself. but i never thought of just ignoring the normal crop cycle)

Edited by king of nowhere
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.

 Share

×
×
  • Create New...