TheJangleMan

Ore.cfg [help with C#]

Recommended Posts

Main questions, how do I make a new ore, then have that ore show up on every planet but jool and kerbin, and what does the "ResourceType" value do? I tried searching, but all I found was an old thread that didn't mention "ResourceType"

Share this post


Link to post
Share on other sites

If you look in GameData\Squad\Resources\ResourcesGeneric.cfg you can see the Squad defined resources - just make a cfg file of your own following their format. Can put in your own mod folder - doesn't need to be (shouldn't be) in Squad folder. See Ore.cfg for configuring where it's found.

Educated guess on ResourceType - if you look in the Community Resource Pack files under ResourceConfigs the ground resources appear to have a ResourceType = 0, ocean resources = 1 and Atmospheric resources 2. (CRP also has many examples of defined resources)

  • Like 1

Share this post


Link to post
Share on other sites

@wasml Good description. I was about to say similar.

On 1/31/2017 at 7:02 PM, TheJangleMan said:

Main questions, how do I make a new ore, then have that ore show up on every planet but jool and kerbin, and what does the "ResourceType" value do? I tried searching, but all I found was an old thread that didn't mention "ResourceType"

@TheJangleMan What do you intend to do with this new resource? :)

 

As wasml said, you'll need to create a RESOURCE_DEFINITION node and a PLANETARY_RESOURCE node as you'll find in the config files they're pointing you to. Here is some explanation for the parameters to help you along. Based on the following you'll want to create a global distribution to make your resource present on all planets by default, then create planetary distributions with 0 for all distribution fields for each planet you want it to be absent from.

RESOURCE_DEFINITION (gives substance to your resource)

Spoiler
  • name = machine-readable name for game mechanics. No spaces
  • title = Display name for UI elements, can have spaces
  • abbreviation = For KerbNet resource switcher button 
  • density = Weight in kg for 1 unit of resource in a tank 
  • unitCost = :funds: per unit of resource when filling up in VAB/SPH
  • hsp = Specific Heat, how much energy in joules per kelvin needed to raise the temperature of 1kg of resource by 1 deg Kelvin (you may have to study and weigh the densities and volatilities of other resources for a fair number. If it's based on a real resource you might be able to google it or you can ask someone who knows a lot of Math to give a proper number). This makes it usable as alternative ablator.
  • flowMode = if it's a fuel then how does it drain out when consumed by an ISRU or an engine.
    • ALL_VESSEL = every part that consumes this will receive from it and every tank that holds it will receive it evenly from a producer, no exceptions or conditions, examples: Ore, IntakeAir and probably Monopropellant by RCS.
    • STAGE_PRIORITY_FLOW = I'm not sure. Probably all-vessel but when it's practical to be able to control whether one tank fills or drains before the next with fuel flow priority.
    • STACK_PRIORITY_SEARCH = The resource will/should only be accessed if it's on the same stage with the producer (an ISRU) or a consumer (an engine).
    • NO_FLOW = If logically, your resource cannot be refilled in-situ IRL, like Ablator, SolidFuel and EVA fuel.
  • transfer = should it be accessible by consumers outside of itself or be transferable between tanks at all?
    • PUMP = yes
    • NONE = no (set alongside NO_FLOW)
  • isTweakable = Can you control its slider in flight? (Like to lock/unlock or transfer between tanks. For example, EC from an alternator is not tweakable) 
  • isVisible = Is this slider even visible? (There's no point showing the slider for an Alternator) Also hides it from stock resource panel in flight.
  • volume = Not sure yet but this seems to serve as a multiplier regarding storage inside a KIS container. The stock resources use 5. Increase it and you can store more of this in the same container. Decrease it and you can store less.

PLANETARY_RESOURCE (per ResourceType per planet)

Spoiler
  • ResourceName = name with no spaces
  • ResourceType = What form it's accessible in. Stick with 0 and only work with drills until you can modify parts to harvest its other forms
    • 0 = Crustal
    • 1 = In oceans and lakes
    • 2 = Atmospheric like IntakeAir
    • 3 = Exospheric (as particles in space) (This involves a different set of parameters under Distribution)
  • PlanetName = This planet.

Distribution

  • PresenceChance = 0 ~ 100 (% chance of being present in each and every biome)
  • MinAbundance = 0 ~ 100 (% of the crust, ocean material or atmosphere)
  • MaxAbundance = 0 ~ 100 (% of the crust, ocean material or atmosphere. Per save, this planet will get a random amount between this Min and Max)
  • Variance = 0 ~ 100 (% how noisy the resource distribution is between highest and lowest amount, not necessarily your defined Min and Max.)
  • Dispersal = 0 ~ 100 (multiplies the sharpness/contrast of that noise and makes the high points much more abundant and the low points much less abundant)

GLOBAL_RESOURCE (use once per ResourceType)

Just like PLANETARY_RESOURCE but omit PlanetName and only use once. This works just like PLANETARY_RESOURCE but affects every planet present in a game.

BIOME_RESOURCE (per ResourceType per biome per planet)

Just like PLANETARY_RESOURCE but add BiomeName = Biome name with or without spaces, after PlanetName = , useful if you want a planet to have your resource only in this biome or to have it in any biome except this.

Edited by JadeOfMaar
  • Like 3

Share this post


Link to post
Share on other sites

I intend on making a resource that you can drill from the ground, then send it to a refinery to make liquid fuel.

Share this post


Link to post
Share on other sites
On 1/31/2017 at 10:59 PM, JadeOfMaar said:

@wasml Good description. I was about to say similar.

@TheJangleMan What do you intend to do with this new resource? :)

 

As wasml said, you'll need to create a RESOURCE_DEFINITION node and a PLANETARY_RESOURCE node as you'll find in the config files they're pointing you to. Here is some explanation for the parameters to help you along. Based on the following you'll want to create a global distribution to make your resource present on all planets by default, then create planetary distributions with 0 for all distribution fields for each planet you want it to be absent from.

RESOURCE_DEFINITION (gives substance to your resource)

  Hide contents
  • name = machine-readable name for game mechanics. No spaces
  • title = Display name for UI elements, can have spaces
  • abbreviation = For KerbNet resource switcher button 
  • density = Weight in kg for 1 unit of resource in a tank 
  • unitCost = :funds: per unit of resource when filling up in VAB/SPH
  • hsp = Specific Heat, how much energy in joules per kelvin needed to raise the temperature of 1kg of resource by 1 deg Kelvin (you may have to study and weigh the densities and volatilities of other resources for a fair number. If it's based on a real resource you might be able to google it or you can ask someone who knows a lot of Math to give a proper number) 
  • flowMode = if it's a fuel then how does it drain out when consumed by an ISRU or an engine.
    • ALL_VESSEL = every part that consumes this will receive from it and every tank that holds it will receive it evenly from a producer, no exceptions or conditions, examples: Ore, IntakeAir and probably Monopropellant by RCS.
    • STAGE_PRIORITY_FLOW = I'm not sure. Probably all-vessel but when it's practical to be able to control whether one tank fills or drains before the next with fuel flow priority.
    • STACK_PRIORITY_SEARCH = The resource will/should only be accessed if it's on the same stage with the producer (an ISRU) or a consumer (an engine).
    • NO_FLOW = If logically, your resource cannot be refilled in-situ IRL, like Ablator, SolidFuel and EVA fuel.
  • transfer = should it be accessible by consumers outside of itself or be transferable between tanks at all?
    • PUMP = yes
    • NONE = no (set alongside NO_FLOW)
  • isTweakable = Can you control its slider in flight? (Like to lock/unlock or transfer between tanks. For example, EC from an alternator is not tweakable) 
  • isVisible = Is this slider even visible? (There's no point showing the slider for an Alternator)
  • volume = I have no clue. Just put "1" but I think you can get away without this.

PLANETARY_RESOURCE (per ResourceType per planet)

  Reveal hidden contents
  • ResourceName = name with no spaces
  • ResourceType = What form it's accessible in. Stick with 0 and only work with drills until you can modify parts to harvest its other forms
    • 0 = Crustal
    • 1 = In oceans and lakes
    • 2 = Atmospheric like IntakeAir
    • 3 = Exospheric (as particles in space) (This involves a different set of parameters under Distribution)
  • PlanetName = This planet.

Distribution

  • PresenceChance = 0 ~ 100 (% chance of being present in each and every biome)
  • MinAbundance = 0 ~ 100 (% of the crust, ocean material or atmosphere)
  • MaxAbundance = 0 ~ 100 (% of the crust, ocean material or atmosphere. Per save, this planet will get a random amount between this Min and Max)
  • Variance = 0 ~ 100 (% how noisy the resource distribution is between highest and lowest amount, not necessarily your defined Min and Max.)
  • Dispersal = 0 ~ 100 (multiplies the sharpness/contrast of that noise and makes the high points much more abundant and the low points much less abundant)

GLOBAL_RESOURCE (use once per ResourceType)

Just like PLANETARY_RESOURCE but omit PlanetName and only use once. This works just like PLANETARY_RESOURCE but affects every planet present in a game.

BIOME_RESOURCE (per ResourceType per biome per planet)

Just like PLANETARY_RESOURCE but add BiomeName = Biome name with or without spaces, after PlanetName = , useful if you want a planet to have your resource only in this biome or to have it in any biome except this.

Thanks for this

 

Share this post


Link to post
Share on other sites

@JadeOfMaar I made a new resource called Biomass that can be stored in Biomass Containers then put through a BioFuelConverter which Converts Biomass and oxidizer into Liquid Fuel

My only problem is that I copied the fuel cell to make the BioFuelConverter, but it just overwrote the fuel cell :|

 

Share this post


Link to post
Share on other sites

@TheJangleMan Sounds cool. I think I saw a mod that used BioMass before, but what was it? :huh: I believe it was used along with MKS on a Laythe base in a YouTube video.

When you create a new part its config has to have 

PART
{
	name = somethingdifferentnospaces
	title = Something different with spaces

The name field is mandatory and uniquely identifies a part in-game. KerbalX craft sharing uses this to identify mods. The title is not mandatory but it's the name you'll see when you mouseover it in the parts list. I'm genuinely curious as to why your fuel cell requires Oxidizer.

  • Like 1

Share this post


Link to post
Share on other sites

Ohhh I forgot to change the TITLE xD

Thanks

I made some changes, and made it produce heat so it isn't op.

  • Like 1

Share this post


Link to post
Share on other sites

If your part config starts with 

@PART[partname]

then all you're doing is modifying an existing part. There's no new part, and the name parameter should be removed.

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