Jump to content

Need help with ore generator code


Jovis

Recommended Posts

I'm trying to make a basic mod in which there is a button on ballast tanks to fill them, and a button to empty them (Maybe a button to gently empty them in the future) For now i'm using ore, and will add the ballast resource later so it is not as abusable in terms of infinite fuel without F12. My code currently reads:

PART
{
name = LargeBallastTank
module = Part
author = Jovis

mesh = LargeTank.mu
scale = 1
rescaleFactor = 1

node_attach = 0,0,-1.2,0,0,0,2
node_stack_top = 0.0, .9, 0.0, 0.0, 1.0, 0.0, 2
node_stack_bottom = 0.0, -.9, 0.0, 0.0, -1.0, 0.0, 2

TechRequired = experimentalScience
entryCost = 9000
cost = 3000
category = FuelTank
subcategory = 0
title = Large Ballast Tank
manufacturer = Jovis' Experimental Submarine Supplies
description = A large refillable ballast tank. Sandwiches not included
attachRules = 1,1,1,1,0

// --- standard part parameters ---
mass = 2.0
dragModelType = default
maximum_drag = 0.2
minimum_drag = 0.2
angularDrag = 2
crashTolerance = 7
maxTemp = 2000 // = 3000
bulkheadProfiles = size2, srf
tags = black isru mine )mining (ore resource store
RESOURCE
{
	name = Ore
	amount = 0
	maxAmount = 1500
}

MODULE
{
	name = ModuleFuelJettison
}


}

MODULE
{
	name = ModuleGenerator
	isAlwaysActive = false
	activateGUIName = Begin Filling Tank
	shutdownGUIName = Stop Filling Tank

	OUTPUT_RESOURCE
	{
		name = Ore
		ratio = 10.0
	}

}

Or to pull your attention to the part I have added:

MODULE
{
	name = ModuleGenerator
	isAlwaysActive = false
	activateGUIName = Begin Filling Tank
	shutdownGUIName = Stop Filling Tank

	OUTPUT_RESOURCE
	{
		name = Ore
		ratio = 10.0
	}

}

When I load the game, and launch a vehicle with a cupola module and this ballast tank, there is no "Begin Filling Tank" option, and I can get no error codes etc. because this is a mod for ksp. It is, however, my first mod of any substance, (I made some cheat parts and a ballast resource on my old computer.) So I apologise for how terribly flawed this code will almost definitely be, and am grateful for any and all help.

Link to comment
Share on other sites

1 hour ago, Jovis said:

After much experimentation I managed to get the GUI to appear, but the buttons refuse to do anything. Will report back if anything changes.

Try looking at USI Fusion Cores

Spoiler

MODULE
{
		name = ModuleResourceConverter
		ConverterName = Reactor
		StartActionName = Start Reactor
		StopActionName = Stop Reactor
		INPUT_RESOURCE
		{
			ResourceName = EnrichedUranium
			Ratio = 0.00000078
		}
		OUTPUT_RESOURCE
		{
			ResourceName = DepletedFuel
			Ratio = 0.00000052
			DumpExcess = true		
		}
		OUTPUT_RESOURCE
		{
			ResourceName = XenonGas
			Ratio = 0.00000026
			DumpExcess = true		
		}
		OUTPUT_RESOURCE
		{
			ResourceName = ElectricCharge
			Ratio = 230
			DumpExcess = false		
		}
		AutoShutdown = true
		TemperatureModifier
		{
			key = 0 2000000
			key = 750 200000
			key = 1000 20000
			key = 1250 10000	
			key = 2000 200	
			key = 4000 0
		}				
		GeneratesHeat = true
		DefaultShutoffTemp = .8
		ThermalEfficiency 
		{
			key = 0 0 0 0
			key = 500 0.1 0 0
			key = 1000 1.0 0 0
			key = 1250 0.1 0 0
			key = 3000 0 0 0 
		}			
}

 

Notice this part

		name = ModuleResourceConverter
		ConverterName = Reactor
		StartActionName = Start Reactor
		StopActionName = Stop Reactor

o he is using

ConverterName = "A NAME"
StartActionName = "GUI FOR STARTING"
StopActionName = "GUI FOR STOPPING"

You are using something else.

Try this

 

PART
{
  name = LargeBallastTank
  module = Part
  author = Jovis

  mesh = LargeTank.mu
  scale = 1
  rescaleFactor = 1

  node_attach = 0,0,-1.2,0,0,0,2
  node_stack_top = 0.0, .9, 0.0, 0.0, 1.0, 0.0, 2
  node_stack_bottom = 0.0, -.9, 0.0, 0.0, -1.0, 0.0, 2

  TechRequired = experimentalScience
  entryCost = 9000
  cost = 3000
  category = FuelTank
  subcategory = 0
  title = Large Ballast Tank
  manufacturer = Jovis' Experimental Submarine Supplies
  description = A large refillable ballast tank. Sandwiches not included
  attachRules = 1,1,1,1,0

  // --- standard part parameters ---
  mass = 2.0
  dragModelType = default
  maximum_drag = 0.2
  minimum_drag = 0.2
  angularDrag = 2
  crashTolerance = 7
  maxTemp = 2000 // = 3000
  bulkheadProfiles = size2, srf
  tags = black isru mine )mining (ore resource store
  RESOURCE
  {
      name = Ore
      amount = 0
      maxAmount = 1500
  }

  MODULE
  {
      name = ModuleFuelJettison
  }

  MODULE
  {
      name = ModuleGenerator
      isAlwaysActive = false
      ConverterName = Tank Filler
      StartActionName = Begin Filling Tank
      StopActionName = Stop Filling Tank

      OUTPUT_RESOURCE
      {
          name = Ore
          ratio = 10.0
      }

  }
}

I haven't tested it, but it should work.

Notice: I did fix a "}" issue in your CFG file syntax as well.

Link to comment
Share on other sites

I just remembered the Roverdude did a submarine "Otter" a while back.

Check this out

https://github.com/BobPalmer/SubPack/blob/master/FOR_RELEASE/GameData/UmbraSpaceIndustries/SubPack/Otter/Parts/BallastTank.cfg#L1-L73

He uses intake liquid, and the definitions are part of the community resource pack

Check it out for inspiration :cool:

Link to comment
Share on other sites

Using your first solution, It showed up, and even had an efficiency at 1 when on, and 0 when off, but no ore was produced. When I added an input of 1 electricity, I achieved the same result but the efficiency didn't change from 0. MOAR EXPERIMENTATION

Link to comment
Share on other sites

1 hour ago, Jovis said:

Using your first solution, It showed up, and even had an efficiency at 1 when on, and 0 when off, but no ore was produced. When I added an input of 1 electricity, I achieved the same result but the efficiency didn't change from 0. MOAR EXPERIMENTATION

I'm pretty sure you need an input resource to counter  your output resource. 

MODULE
	{
		name = ModuleGenerator
		isAlwaysActive = False
		requiresAllInputs = True
		
		INPUT_RESOURCE
		{
			name = ElectricCharge
			rate = 1
		}

		OUTPUT_RESOURCE
		{
			name = Ore
			rate = 10.0
		}
	}

 

Link to comment
Share on other sites

40 minutes ago, genericeventhandler said:

I'm pretty sure you need an input resource to counter  your output resource. 


MODULE
	{
		name = ModuleGenerator
		isAlwaysActive = False
		requiresAllInputs = True
		
		INPUT_RESOURCE
		{
			name = ElectricCharge
			rate = 1
		}

		OUTPUT_RESOURCE
		{
			name = Ore
			rate = 10.0
		}
	}

 

Nope. ModuleResourceConverter works just fine without input, like the rtg.

Link to comment
Share on other sites

On 7/22/2016 at 10:51 AM, Jovis said:

I've tried both, to no avail. Giving up until i get a new solution.

your problem is you have an extraneous "}" sitting in the middle of your config, right after the module fuel jettison. It prematurely ends the part config. Maybe you already caught it (only skimmed the thread). You'll need to set up a generator with just an Input of Ore to empty the tanks as well.

I've collected a bunch of sub mods and I've done a bit with subs, and decided on a different method than using generators to fill ballast tanks. Namely, using "vents". Take two RCS thrusters. Set one up with a negative ISP curve for IntakeLqd (or whatever you want to use), and the other with a positive. Then when you translate with one thruster, the tanks fill, and with the other, they empty. Also done some engines. Basically, you can make a sub 100% stock + CRP, easy peasy.

EDIT: I can send you the configs if you want; shoot me a PM and I'll throw some nautical RCS thrusters and engines at you. Probably still have the ballast tanks too, but I never settled on numbers I liked.

Edited by Deimos Rast
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.

×
×
  • Create New...