Skip to content

SCANsat Custom Resource Scanners

DMagic edited this page Jan 13, 2016 · 12 revisions

Contents

🔝 SCANsat Resource Config


Included in the GameData/SCANsat/Resources folder is a file called SCANresource.cfg. This file contains all currently supported resource types.

The config layout is as below:

 SCANSAT_SENSOR
 {
      name = Ore
      SCANtype = 256 //2^8
 }

There are only two values required to define a SCANsat resource.

  • Name: This field must match the name of a planetary resource created using the stock resource configs (creating such definitions will not be covered here)
  • SCANtype: This is SCANsat's internal identifier for the resource. This value must be a power of two (the numbers following the // denote which power of two is used by that resource) and must not be the same as an existing SCANtype

Additionally, there are several SCANtype values reserved for internal use that are not found in this file. All values below 64 and 524288 (2^19) can't be used. Any higher value (up to 2^32) is available.

🔝 Creating New Resource Definition


Adding a new resource for SCANsat to recognize is as simple as adding a new SCANSAT_SENSOR config node with that resource's name (this must match exactly) and a valid SCANtype number. As long as a stock, planetary (oceanic, atmospheric, and interplanetary resources are not supported by SCANsat) resource is located when KSP starts up SCANsat will accept the new definition.

🔝 Adding New Resource Scanner Modules


Once you have added a new resource definition you'll need a SCANsat resource scanner module on a new or existing part before you can actually start scanning.

The GameData/SCANsat/MM_Parts folder has a file called SCANsat_Resource_Scanner.cfg. In it are the Module Manager configs for adding SCANsat resource scanners for the stock and Community Resource Pack resources.

There are two Part Modules that need to be added for full SCANsat functionality.

 @PART[OrbitalScanner]:FOR[SCANsat]
 {
      MODULE
      {
           name = ModuleSCANresourceScanner
           sensorType = 256
           fov = 3
           min_alt = 10000
           max_alt = 500000
           best_alt = 150000
           scanName = Ore Scan
           power = 0.4
      }
 }

This module adds the actual scanning function to an existing part. The same module could be added directly to a part's config file without using the Module Manager section.

  • The @PART[] field at the top specifies which part the module should be added to, change the value in the brackets to the part you are interested in (note that you must use the actual part name, not the in-game title)
  • The name field must match the name of your planetary resource, the same as the SCANSAT_SENSOR config
  • The sensorType field again must match the SCANtype value used in your SCANSAT_SENSOR config
  • The following fields allow for modifying the minimum, maximum, and ideal scanning altitudes (in meters), as well as the scanning swath width, power usage (in EC per second) and the in-game title for the SCANsat start and stop button.

Something to note is that the sensorType value is a bitmask; this means that multiple values can be combined into one sensor, rather than creating a new sensor for each resource. This can be seen in the MKS_Antenna config in the same file. It uses a sensorType of 107648, there is no matching SCANtype value (and this isn't a power of 2). Instead this is a combination of five resources. To calculate the combined value for a new sensorType simply add the SCANtype values for all of the desired resource types (the MKS_Antenna uses 128 + 1024 + 8192 + 32768 + 65536).

If you want to modify an existing SCANsat resource scanner, rather than adding your own module, you can modify only the sensorType field using Module Manager (you should make sure that your MM config is set to run after the default SCANsat MM configs, adding :AFTER[SCANsat], instead of :FOR[SCANsat] to the end of the first line should accomplish that).

That config would look like (this would add a Metallic Ore scan to the default Ore scan; 128 + 256):

  @PART[OrbitalScanner]:AFTER[SCANsat]
  {
       @MODULE[ModuleSCANresourceScanner]
       {
            @sensorType = 384
       }
  }

You might also want to change the scanName field.

The other required Part Module is the resource display module:

 @PART[OrbitalScanner]:FOR[SCANsat]
 {
      MODULE
      {
           name = SCANresourceDisplay
           sensorType = 256
           ResourceName = Ore
      }
 }

The rules about the ResourceName and sensorType fields matching the SCANSAT_SENSOR config are the same as above. The only difference here is that you can't combine modules, each resource requires a separate module on each part. The purpose of this module is only for displaying the resource concentration at your vessel's current location in the part's right-click menu. It doesn't affect standard SCANsat scanning methods.

🔝 Editing Resource Properties


Resource properties, such as the display colors, and resource concentration cutoff values for each planet can be modified in-game using the Resource tab of the SCANsat Color Management Window.