ShotgunNinja / Kerbalism

Hundreds of Kerbals were killed in the making of this mod.
The Unlicense
43 stars 19 forks source link

Open support for Coatl Aerospace ProbesPlus! #128

Closed ghost closed 7 years ago

ghost commented 7 years ago

Coatl Aerospace is a popular parts mod that adds a few antennas -and probe's but they're not so important). Currently, there is no support of Kerbalism for this parts pack which shows up most prominently in the antennas as they do not trigger Kerbalism's recognition as such. Meaning, you can't use them for squat. They're not recognized for a connection and don't contribute to probe control -which is a real shame they look really nice.

I think it would be really great if Kerbalism could expand support to this parts pack.

(Link to Coatl Aerospace Repo: https://github.com/raveloda/Coatl-Aerospace)

ghost commented 7 years ago

This time I did check the latest release before submitting, no such luck ;)

That said, I wouldn't mind taking this on, I've kind of already started it, but if I'm honest I'm not really sure what I'm doing. I'm not familiar with the syntax or how elements work together beyond what I can guess from reading through the support config files available. I've cobbled together something that sort of works but isn't all encompassing and, frankly, doesn't look good code wise.

I really would like to do this but I don't know how. If someone would be so kind as to direct me to resources to learn how to do this properly, I can probably knock this out without burdening the rest of the project.

ShotgunNinja commented 7 years ago

Some basic knowledge of Module Manager syntax is required. Also refer to the antenna module specs here on the wiki. If you have specific questions, feel free to ask.

The fixed antenna case is simple. We edit a part by name, but only when the Signal feature is enabled. The edit consist of adding a new Antenna module, with relative Reliability module. The stock data transmitter module is alreary removed automatically from all parts when Signal is enabled, so we don't need to do it here.

@PART[my-fixed-antenna-part-name]:NEEDS[FeatureSignal]:FOR[Kerbalism]
{
  MODULE
  {
    name = Antenna
    type = low_gain
    cost = 0.1
    dist = 5e6
    rate = 0.016
  }

  MODULE:NEEDS[FeatureReliability]
  {
    name = Reliability
    type = Antenna
    title = Antenna
    redundancy = Communication
    repair = true
    mtbf = 72576000 // 8y
    extra_cost = 2.0
    extra_mass = 1.0
  }
}

The retractable antenna case is slightly more complex. In addition to the operations done in the previous case, we add a ModuleAnimationGroup and specify the name of the animation that drive the extended/retracted state. You can find it by reading the original part config node. Then as a bonus we also remove the original stock ModuleAnimateGeneric (usually present in extendible antennas), to avoid showing the user two different extend/retract buttons.

@PART[my-retractable-antenna-part-name]:NEEDS[FeatureSignal]:FOR[Kerbalism]
{
  MODULE
  {
    name = Antenna
    type = high_gain
    cost = 0.3
    dist = 25e9
    rate = 0.064
  }

  MODULE:NEEDS[FeatureReliability]
  {
    name = Reliability
    type = Antenna
    title = Antenna
    redundancy = Communication
    repair = true
    mtbf = 72576000 // 8y
    extra_cost = 2.0
    extra_mass = 1.0
  }

  MODULE
  {
    name = ModuleAnimationGroup
    deployAnimationName = my-animation-name
    moduleType = Antenna
  }

  !MODULE[ModuleAnimateGeneric]:HAS[#animationName[my-animation-name]] {}
}
ShotgunNinja commented 7 years ago

Thank you.