RemoteTechnologiesGroup / RemoteTech

Community developed continuation of Kerbal Space Program's RemoteTech mod.
http://remotetechnologiesgroup.github.io/RemoteTech
GNU General Public License v2.0
230 stars 103 forks source link

Support for Restock+ antennas #787

Closed xdreaper15 closed 5 years ago

xdreaper15 commented 5 years ago

The new mod Restock contains some really cool antennae, which have no config for RemoteTech yet. Are there any plans to add one?

xdreaper15 commented 5 years ago

It appears they're just re-skins of current antennas. Maybe just apply the applicable antenna config to that part?

KSP-TaxiService commented 5 years ago

Under ReStocked/Distribution/Restock/ directory, it looks indeed re-skinning of the existing stock antennas (not covering RemoteTech antennas) so the Remotetech configs for the same stock antennas should work.

However, under ReStocked/Distribution/RestockPlus/ directory, there are at least 3 new stock-like antennas, HG-20 High Gain Antenna, Communotron DTS-J1 and Communotron HG-61, beefed-up versions of the equivalent antennas.

As these new antennas are maintained in another mod, it is up to us (including anyone via pull requests) to duplicate and edit the existing MM patch of equivalent antennas to support the new antennas.

xdreaper15 commented 5 years ago

I have a fair amount of past history with coding in C# and i've dabbled in Unity before, but never anything for KSP, is there a good quick-resource I can use to jump into adapting the MM patch?

KSP-TaxiService commented 5 years ago

Sure! Here's the official Module Manager handbook on syntax of a MM patch.

This enables you to write a simple and human-readable file to be parsed by Module Manager on a target object (eg part), without worrying about programming or compilation.

For this case, you just need to find the exact part name (eg name = RTGigaDish1) and write a patch against the name. Module Manager will take care of the rest.

xdreaper15 commented 5 years ago

Thanks! I'll report back tonight, hopefully with a push ready.

On Mon, Mar 18, 2019, 10:51 TaxiService notifications@github.com wrote:

Sure! Here's the official Module Manager handbook https://github.com/sarbian/ModuleManager/wiki/Module%20Manager%20Syntax on syntax of a MM patch.

This enables you to write a simple and human-readable file to be parsed by Module Manager on a target object (eg part).

For this case, you just need to find the exact part name (eg name = RTGigaDish1) and write a patch against the name. Module Manager will take care of the rest.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RemoteTechnologiesGroup/RemoteTech/issues/787#issuecomment-473942578, or mute the thread https://github.com/notifications/unsubscribe-auth/AF3NQyCLW52DFdsaR-9ve5SNytDphJyTks5vX6ffgaJpZM4b362D .

xdreaper15 commented 5 years ago

I'm a bit confused here. Is this really as simple as copying the RemoteTech properties from one part to another? +PART[myPartName] { @name = myNewPartCopy }

xdreaper15 commented 5 years ago

I did it! I made a file named RemoteTech_Restock.cfg and put it in the Patch folder where all the rest of the addon patches are, and it works! FirstMMPatchRemoteTechRestockPlusAntennae

@PART[*]:HAS[@MODULE[ModuleDataTransmitter]]:FOR[RemoteTech]
{
    !MODULE[ModuleDataTransmitter]{}
}

@PART[restock-antenna-stack-2]:FOR[RemoteTech]
{
    @MODULE[ModuleDeployableAntenna]
    {
        %name=ModuleAnimateGeneric
        %allowManualControl = false
        %actionAvailable = false
        %eventAvailableFlight = false
        %eventAvailableEditor = false
        %eventAvailableEVA = false
    }

    %MODULE[ModuleRTAntenna] {
        %Mode0DishRange = 0
        %Mode1DishRange = 75000000
        %EnergyCost = 0.82
        %MaxQ = 6000
        %DishAngle = 45.0

        %DeployFxModules = 0
        %ProgressFxModules = 1

        %TRANSMITTER {
            %PacketInterval = 0.3
            %PacketSize = 2
            %PacketResourceCost = 15.0
        }
    }

    %MODULE[ModuleSPUPassive] {}
}

@PART[restock-antenna-stack-3]:FOR[RemoteTech]
{
    @MODULE[ModuleDeployableAntenna]
    {
        %name=ModuleAnimateGeneric
        %allowManualControl = false
        %actionAvailable = false
        %eventAvailableFlight = false
        %eventAvailableEditor = false
        %eventAvailableEVA = false
    }

    %MODULE[ModuleRTAntenna] {
        %Mode0DishRange = 0
        %Mode1DishRange = 25000000000
        %EnergyCost = 1.04
        %MaxQ = 6000
        %DishAngle = 0.12

        %DeployFxModules = 0
        %ProgressFxModules = 1

        %TRANSMITTER {
            %PacketInterval = 0.15
            %PacketSize = 3
            %PacketResourceCost = 20.0
        }
    }

    %MODULE[ModuleSPUPassive] {}
}

@PART[restock-relay-radial-2]:FOR[RemoteTech]
{
    @MODULE[ModuleDeployableAntenna]
    {
        %name=ModuleAnimateGeneric
        %allowManualControl = false
        %actionAvailable = false
        %eventAvailableFlight = false
        %eventAvailableEditor = false
        %eventAvailableEVA = false
    }

    %MODULE[ModuleRTAntenna] {
        %Mode0DishRange = 0
        %Mode1DishRange = 80000000
        %EnergyCost = 1.10
        %MaxQ = 6000
        %DishAngle = 90

        %DeployFxModules = 0
        %ProgressFxModules = 1

        %TRANSMITTER {
            %PacketInterval = 0.15
            %PacketSize = 3
            %PacketResourceCost = 20.0
        }
    }

    %MODULE[ModuleSPUPassive] {}
}

Now, the only thing I was unsuccessful on, was trying to copy all the variable values from the relevant part. That way, if the reference parts are edited, they retain the relationship to that part.

//This antenna is just 4 of the HG-5 stacked, so I want the range to be 4 times the referenced part's range
%Mode1DishRange = 4 * #$@PART[HighGainAntenna5]/Mode1DishRange$

Every single line of the above would error out, but not sure how or why, I'm most certainly trying to reference that variable wrong.

KSP-TaxiService commented 5 years ago

Seem I can't get the reference part right too. The values are not displayed in-game. Ah well, another time on this.

Thanks for making this MM patch for the mod!

mindset-tk commented 3 years ago

FYI as of KSP1.11 restockplus has updated the part name of the HG-20 from restock-relay-radial-2 to restock-relay-radial-2_v2. I was able to fix this by updating the MM patch partname.

Edit: it seems that restock-relay-radial-2 still exists but is a "hidden" part (probably to avoid breaking users' extant ships after updating the plugin) so I ended up changing the mm patch to have two blocks:


//This is 4 HighGain5 antennae stuck together, so I just multiplied the range by 4 and the EnergyCost by 2
@PART[restock-relay-radial-2]:FOR[RemoteTech]
{
    @MODULE[ModuleDeployableAntenna]
    {
        %name=ModuleAnimateGeneric
        %allowManualControl = false
        %actionAvailable = false
        %eventAvailableFlight = false
        %eventAvailableEditor = false
        %eventAvailableEVA = false
    }

    %MODULE[ModuleRTAntenna] {
        %Mode0DishRange = 0
        %Mode1DishRange = 80000000
        %EnergyCost = 1.10
        %MaxQ = 6000
        %DishAngle = 90.0

        %DeployFxModules = 0

        %TRANSMITTER {
            %PacketInterval = 0.15
            %PacketSize = 3
            %PacketResourceCost = 20.0
        }
    }

    %MODULE[ModuleSPUPassive] {}
}

//This is 4 HighGain5 antennae stuck together, so I just multiplied the range by 4 and the EnergyCost by 2
@PART[restock-relay-radial-2_v2]:FOR[RemoteTech]
{
    @MODULE[ModuleDeployableAntenna]
    {
        %name=ModuleAnimateGeneric
        %allowManualControl = false
        %actionAvailable = false
        %eventAvailableFlight = false
        %eventAvailableEditor = false
        %eventAvailableEVA = false
    }

    %MODULE[ModuleRTAntenna] {
        %Mode0DishRange = 0
        %Mode1DishRange = 80000000
        %EnergyCost = 1.10
        %MaxQ = 6000
        %DishAngle = 90.0

        %DeployFxModules = 0

        %TRANSMITTER {
            %PacketInterval = 0.15
            %PacketSize = 3
            %PacketResourceCost = 20.0
        }
    }

    %MODULE[ModuleSPUPassive] {}
}```
KSP-TaxiService commented 3 years ago

Whoops, I forgot about the pending changes yet to be released officially since RT 1.9.10. Thanks for reminding me!

The ReStockPlus change you reported was accepted via this pull request.