// WIP. Not intended for release yet.

RESOURCE_DEFINITION:NEEDS[!Pathfinder]
{
  name = GeoEnergy
  density = 0
  unitCost = 0
  flowMode = STAGE_PRIORITY_FLOW
  transfer = PUMP
  isTweakable = true
}
PLANETARY_RESOURCE
{
	ResourceName = GeoEnergy
	ResourceType = 1
	PlanetName = None
	Tag = OcnLava
	Distribution
	{
		PresenceChance = 1000
		MinAbundance = 100 // 50
		MaxAbundance = 100 // 50
		Variance = 0
		Dispersal = 0
	}
}

// Lava viscosity and temperature patch for issues discovered while testing Beyond Home.
// Will become unneeded soon(tm). The planet maker has been notified.
@Kopernicus:AFTER[BeyondHome]
{
	@Body[Ash]
	{
		@Ocean
		{
			%density = 2.6
		}
		@HazardousBody
		{
			@Item
			{
				@ambientTemp = 2400
			}
		}
	}
	@Body[Fury]
	{
		@Ocean
		{
			%density = 2.6
		}
		@HazardousBody
		{
			@Item
			{
				@ambientTemp = 2400
			}
		}
	}
	@Body[Tribute]
	{
		@Ocean
		{
			%density = 2.6
			@HazardousBody // Doesn't actually work. Should not be inside Ocean{}
			{
				@Item
				{
					@ambientTemp = 2400
				}
			}
		}
	}
}

@PART[RadialDrill]:NEEDS[!Kerbalism]:AFTER[RationalResourcesParts]
{
	+MODULE[ModuleResourceHarvester],0
	{
		@ResourceName = GeoEnergy
		@ConverterName = GeoEnergy Harvester
		@StartActionName = Start GeoEnergy Harvester
		@StopActionName = Stop GeoEnergy Harvester
		@ToggleActionName = Toggle GeoEnergy Harvester
		@UseSpecialistBonus = False
		!SpecialistEfficiencyFactor = 0.2
		!SpecialistBonusBase = 0.05
		@UseSpecialistHeatBonus = False
		!SpecialistHeatFactor = 0.1
		!ExperienceEffect = DrillSkill
		@HarvesterType = 1
		!ImpactTransform = ImpactTransform
		!ImpactRange = 5.42
		@GeneratesHeat = False
		!TemperatureModifier {}
		!ThermalEfficiency {}
		@Efficiency = 1
		@INPUT_RESOURCE
		{
			@Ratio = 5
		}
		!HarvestThreshold = 0.025
	}
	RESOURCE
	{
		name = GeoEnergy
		amount = 0
		maxAmount = 1
	}
}
@PART[MiniISRU,ISRU,rr_boxblue_long,rr_boxblue]:NEEDS[!Kerbalism]:AFTER[RationalResourcesParts]
{
	+MODULE[ModuleResourceConverter],0
	{
		@ConverterName = Geothermal Power
		@StartActionName = Start Geothermal Power
		@StopActionName = Stop Geothermal Power
		@ToggleActionName = Toggle Geothermal Power
		@UseSpecialistBonus = False
		!SpecialistEfficiencyFactor = 0.2
		!SpecialistBonusBase = 0.05
		@UseSpecialistHeatBonus = False
		!SpecialistHeatFactor = 0.1
		!ExperienceEffect = DrillSkill
		@AutoShutdown = False
		@GeneratesHeat = False
		!TemperatureModifier {}
		!ThermalEfficiency {}
		@INPUT_RESOURCE:HAS[#ResourceName[Ore]]
		{
			@ResourceName = GeoEnergy
			@Ratio = 1
		}
		@INPUT_RESOURCE:HAS[#ResourceName[ElectricCharge]]
		{
			@ResourceName = Water
			@Ratio = 0.0001
		}
		@OUTPUT_RESOURCE:HAS[#ResourceName[LiquidFuel]]
		{
			@ResourceName = ElectricCharge
			@Ratio = 180
			%DumpExcess = True
		}
		@OUTPUT_RESOURCE:HAS[#ResourceName[Oxidizer]]
		{
			@ResourceName = Ore
			@Ratio = 0.001
			%DumpExcess = True
		}
		+OUTPUT_RESOURCE:HAS[#ResourceName[Ore]]
		{
			@ResourceName = CarbonDioxide
			@Ratio = 0.005
		}
		+OUTPUT_RESOURCE:HAS[#ResourceName[Ore]]
		{
			@ResourceName = Methane
			@Ratio = 0.015
		}
	}
}

@PART[rr_boxblue]:NEEDS[!Kerbalism]:AFTER[RationalResourcesParts]
{
	@MODULE[ModuleResourceConverter]:HAS[#ConverterName[Geothermal?Power]]
	{
		@INPUT_RESOURCE,*
		{
			@Ratio *= 0.6
		}
		@OUTPUT_RESOURCE,*
		{
			@Ratio *= 0.6
		}
	}
}

@PART[MiniISRU]:NEEDS[!Kerbalism]:AFTER[RationalResourcesParts]
{
	@MODULE[ModuleResourceConverter]:HAS[#ConverterName[Geothermal?Power]]
	{
		@INPUT_RESOURCE,*
		{
			@Ratio *= 0.25
		}
		@OUTPUT_RESOURCE,*
		{
			@Ratio *= 0.25
		}
	}
}