Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Restock+ antennas #787

Closed
xdreaper15 opened this issue Mar 16, 2019 · 10 comments
Closed

Support for Restock+ antennas #787

xdreaper15 opened this issue Mar 16, 2019 · 10 comments

Comments

@xdreaper15
Copy link
Contributor

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

@xdreaper15
Copy link
Contributor Author

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

@KSP-TaxiService
Copy link
Contributor

KSP-TaxiService commented Mar 17, 2019

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
Copy link
Contributor Author

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
Copy link
Contributor

KSP-TaxiService commented Mar 18, 2019

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
Copy link
Contributor Author

xdreaper15 commented Mar 18, 2019 via email

@xdreaper15
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link

mindset-tk commented Jun 14, 2021

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants