Jump to content

Is a CommNet "Relay Computer module" possible?


Tyko

Recommended Posts

I've been trying to figure out if I could make a module that would enable Direct antennas to function as relays - you'd add the direct antennas, then also add this Relay Computer onto the ship. The Relay Computer would allow the Direct antennas to be included in the Relay antenna calculations. Under this model, all antenna's would be categorized as Direct and the Relay Computer would be unlocked in the tech tree after which any antenna can be used as Relay simply by adding the Relay Computer module.

I could write a MM .cfg that would change all Antenna's to Relay type, but I can't figure out how trigger that change by the user adding the Relay Computer part. I'm not even sure if you can do it that way because I think all MM changes occur when the game is loaded, not when parts are attached.

Has anyone else explored this?

Edited by Tyko
Link to comment
Share on other sites

It might be doable at the custom plugin level, but I don't think it is possible at the ModuleManager patch level.

If you have a new part, say 'Relay Module'; it gets added to a ship similar to a MJ case, battery, or science instrument.  It has a single custom PartModule on it; lets call it 'ModuleRelayControl'.

When flight scene is started, or vessel changed, your custom partmodule (ModuleRelayControl) will look for all ModuleDataTransmitter on the vessel, and update their internal 'antennaType' fields to 'RELAY'.  They keep all of their existing range stats, but merely get turned into relays, if, and only if, your relay module is installed.  Might need some additional event handling to disable the relay functionality when vessels are undocked, where you would re-scan and re-enable the relay functionality for the two vessels independently.

Disclaimer:  While this should work in theory (based on the API), I have not tried it in practice.  It would depend entirely on the internal code of the antenna and if it caches any values that depend on the antenna-type.  May still be doable by manually calling the OnLoad() and/or OnStart() methods to re-initialize the module and recreate the caches.

Link to comment
Share on other sites

12 minutes ago, Shadowmage said:

When flight scene is started, or vessel changed, your custom partmodule (ModuleRelayControl) will look for all ModuleDataTransmitter on the vessel, and update their internal 'antennaType' fields to 'RELAY'.  They keep all of their existing range stats, but merely get turned into relays, if, and only if, your relay module is installed.  Might need some additional event handling to disable the relay functionality when vessels are undocked, where you would re-scan and re-enable the relay functionality for the two vessels independently.

The problem is that the relay functionality is usually used when the relay vessel is not loaded, so the partModules do not come to life.

It might be possible with a custom module derived from ModuleDataTransmitter, which overloads the method(s) for unloaded antenna power. Then the relay computer would act as a relay antenna and would report the combined range.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...