Jump to content

[1.12.x] JX2Antenna v2.0.5: Giant 1000G antenna for big solar systems


Snark

Recommended Posts

When I have this mod installed alongside OPM Galileo (and quite a few other mods), all CommNet stops working causing the following NRE, endlessly:

[EXC 20:28:43.338] NullReferenceException: Object reference not set to an instance of an object
	CommNet.CommNetwork.TryConnect (CommNet.CommNode a, CommNet.CommNode b, Double distance, Boolean aCanRelay, Boolean bCanRelay, Boolean bothRelay)
	CommNet.CommNetwork.SetNodeConnection (CommNet.CommNode a, CommNet.CommNode b)
	CommNet.Network.Net`4[_Net,_Data,_Link,_Path].UpdateNetwork ()
	CommNet.Network.Net`4[_Net,_Data,_Link,_Path].Rebuild ()
	CommNet.CommNetwork.Rebuild ()
	CommNet.CommNetNetwork.Update ()

All vessels lost connectivity, except for some weird connections with one of the relays. Removing JX2 resolved the issue.

Edited by garwel
Link to comment
Share on other sites

Argh.  Thanks for the report, @garwel, @Gordon Dry.

Well, here's the thing:

  • I'm happy to make fixes, if I can figure out what they are.
  • I'm happy to make it work together with a specific mod.
  • However, unfortunately I really don't have the time to figure out an interaction between three or more mods, especially if they're not mods I routinely use.

Here's the patch.

Here is what I believe to be the case (unverified, so if anyone has reason to believe that any of the following statements are false, please let me know):

  • The patch only has any effect if you are running OPM, and aren't running GPP.
  • So, if you're not running OPM, you're fine.
  • If you are running GPP, you're fine.
  • If you're running OPM, and not GPP, and you're not running some other mod that tinkers with the tracking station via CustomBarnKit, then you're fine.

As far as I know:  The only scenario in which this patch will affect any other mod is if you do have OPM installed, and you also have some other mod present that tinkers with the tracking station via CustomBarnKit.

OPM munges basically every single value on the tracking station via a CustomBarnKit TRACKING entry.  I'll happily provide a fix for this... but I have no idea what the fix is.  I'm running a fair number of mods myself, and none of them has the slightest problem with this fix, which makes it kind of hard to debug because I don't know what the actual problem is.  It would help if someone could point me at an actual piece of code that has a problem.  i.e. if you're getting a NullReferenceException in the game, then point me at the exact line of code in a .cs file in some mod's github repo that is where the exception is actually happening.

I see that @garwel shows a stack trace that looks like it's in KSP rather than some mod.... but I'm pretty sure I haven't broken the base game itself, since I don't get those exceptions myself and have no problems at all with CommNet.

So I need details, guys.  "I'm running a bunch of mods" doesn't help me.  I need to know exactly which mod is causing the issue, and I need to know where in the code it's doing so.  Without that I have no clue where to begin.  Can you provide some more information, please?

In the meantime, I've asked over in the OPM thread if they've got any advice on a simple, surgical way I can undo what their patch is doing.  They're tinkering with some numbers I know and other numbers I don't know.  If I can get the original values of the numbers they've overwritten, then I could come up with a patch that works better.  I'll see what I can find out.

Link to comment
Share on other sites

@Snark

My list of mods than also contain the word "CUSTOMBARNKIT" AND touch "TRACKING" in any .cfg:

  • (of course) CustomBarnKit
  • OPM
  • SETIcustomBarnKitConfig -> GameData\SETIcustomBarnKitConfig\SETI-CustomBarnKit-Config.cfg:
    Spoiler
    
    @TRACKING
    	{
    		@upgrades = 20000, 50000, 500000

     

     

These mods also contain the word "CUSTOMBARNKIT" but DO NOT touch "TRACKING":

  • SETIcontracts -> GameData\SETIcontracts\CC-contracts\SETI-Contracts-General.cfg (VAB, SPH, MISSION)
  • Strategia (the first in the list inside the spoiler really does something with ADMINISTRATION and MISSION, the others only contain a NEEDS[CustomBarnKit]:
    Spoiler
    
    GameData\Strategia\CustomBarnKitConfig.cfg
    GameData\Strategia\Departments\CrewedMissions.cfg
    GameData\Strategia\Departments\UncrewedMissions.cfg
    GameData\Strategia\StockStrategyDisabler.cfg
    GameData\Strategia\Strategies\CrewedMissions-1-MoonProgram.cfg
    GameData\Strategia\Strategies\CrewedMissions-2-PlanetaryProgram.cfg
    GameData\Strategia\Strategies\CrewedMissions-3-GasGiantProgram.cfg
    GameData\Strategia\Strategies\Finances-1-AstronautTrainingProgram.cfg
    GameData\Strategia\Strategies\Finances-2-MassiveLaunches.cfg
    GameData\Strategia\Strategies\Finances-3-SlotMachine.cfg
    GameData\Strategia\Strategies\Operations-1-PilotFocus.cfg
    GameData\Strategia\Strategies\Operations-2-EngineerFocus.cfg
    GameData\Strategia\Strategies\Operations-3-ScientistFocus.cfg
    GameData\Strategia\Strategies\PublicRelations-1-TechStagnation.cfg
    GameData\Strategia\Strategies\PublicRelations-2-FreeIceCream.cfg
    GameData\Strategia\Strategies\PublicRelations-3-MediaCircus.cfg
    GameData\Strategia\Strategies\Science-1-ToBoldlyGo.cfg
    GameData\Strategia\Strategies\Science-2-ProbeFrenzy.cfg
    GameData\Strategia\Strategies\Science-3-LocalResearch.cfg
    GameData\Strategia\Strategies\UncrewedMissions-1-MoonProbes.cfg
    GameData\Strategia\Strategies\UncrewedMissions-2-PlanetaryProbes.cfg
    GameData\Strategia\Strategies\UncrewedMissions-3-ImpactorProbes.cfg
    GameData\Strategia\Strategies\UncrewedMissions-4-FlyBys.cfg

     

  • UnmannedBeforeManned (only when not SETIcustomBarnKitConfig):

    Spoiler
    
    @CUSTOMBARNKIT:NEEDS[CustomBarnKit,!SETItechtree,!SETIcustomBarnKitConfig]
    {
    	@VAB
    	{
    		@actionGroupsStockUnlock = 1
    		@actionGroupsCustomUnlock = 1
    	}
    	
    	@SPH
    	{
    		@actionGroupsStockUnlock = 1
    		@actionGroupsCustomUnlock = 1
    	}
    }
    

     

     

I hope that bit of info helps.

Edited by Gordon Dry
Board scrapped my last paragraph, had to edit to re-enter it
Link to comment
Share on other sites

3 minutes ago, Gordon Dry said:

My list of mods than also contain the word "CUSTOMBARNKIT" AND touch "TRACKING" in any .cfg:

Thanks.  So does each one of them trigger the bug if present?  (Other than OPM, which I know is fine because I've tested it, of course.)

4 minutes ago, Gordon Dry said:

These mods also contain the word "CUSTOMBARNKIT" but DO NOT touch "TRACKING":

Do any of these trigger the bug?  Or are they all completely unaffected by this issue?

Link to comment
Share on other sites

@Snark: They all coexist well, only removing the tracking entry and setting it back to stock is an issue.

You could just add NEEDS[!SETIcustomBarnKitConfig], that should be enough for this case.

But perhaps it also could affect Strategia somehow... so an additonal !Strategia could be helpful.

Link to comment
Share on other sites

41 minutes ago, Snark said:

In the meantime, I've asked over in the OPM thread if they've got any advice on a simple, surgical way I can undo what their patch is doing.  They're tinkering with some numbers I know and other numbers I don't know.  If I can get the original values of the numbers they've overwritten, then I could come up with a patch that works better.  I'll see what I can find out.

An initial (lazy) hunch I was going to pursue was to simply quote their TRACKING config but drop the values for their new upgrade level. You're right, though -- not knowing what the stock levels are means we can't quite trust OPM's #s for the levels 1-3, or if they leave enough of a gap for JX2 (etc.) to fill.

Link to comment
Share on other sites

1 hour ago, Gordon Dry said:

They all coexist well, only removing the tracking entry and setting it back to stock is an issue.

Thank you, but that's actually not what I asked.  (I know that getting rid of the broken JX2Antenna patch will "solve" the issue, so that information doesn't actually help me.)  :wink:

What I'm asking is:  If you don't remove the JX2Antenna, exactly which mods are or aren't broken.  You have a list of N mods.  For each mod, I would like to know, "Is it broken if this mod is installed at the same time as JX2Antenna and OPM."

[EDIT] Never mind, I have a different information request, see below.  :wink:

1 hour ago, Beetlecat said:

An initial (lazy) hunch I was going to pursue was to simply quote their TRACKING config but drop the values for their new upgrade level.

Yes, if that's all they did, it would be no problem. Except that they switch around all the values for all the parameters, including levels 1-3, which means I need to know what the original values are if I'm going to put them back.  Some of those are clear enough and I can figure out from the stock game (e.g. DSN power and upgrade cost), but not all are so obvious.

Link to comment
Share on other sites

Hi gang,

I think I have a solution to the OPM compatibility patch.  I've got it running locally, and it works fine... except that the last (broken) patch worked fine on my machine, too, because I'm not running the mods that the folks with problems are.

So, before I push out this new release, I'd kinda like to make sure it actually fixes problems, first.

So, @garwel and @Gordon Dry, since you're the ones experiencing the problem, could you do me a favor and test my fix to verify that it works for you?  Details in spoiler.

Spoiler

So, the thing to do is to find the jx2_OPM.cfg file in the JX2Antenna/Patches folder, then open it in Notepad (or whatever) and replace the contents with this instead:


@CUSTOMBARNKIT:NEEDS[OPM]:FINAL
{	
	@TRACKING
	{
        @levels = 3
        @upgradesVisual = 1, 2, 3
        @upgrades = 38000, 150000, 563000
        @patchesAheadLimit = 0, 2, 3
        @trackedObjectLimit = 0, 8, -1
        @DSNRange = 2000000000, 50000000000, 250000000000
	}
}

...Expected result of doing this:

  1. Your mods should work fine now (no NRE spam)
  2. Your CommNet should work
  3. Your DSN should work exactly like the stock game:  specifically, there should not be a "level 4" DSN (which is what OPM adds if JX2Antenna is not installed).

If you could try the above fix, and verify each of the above three expected results, I'd be much obliged.  Thank you.

As soon as I get a "yes, it works, no problems" thumbs-up, I'll push out the 2.0.4 patch so everyone can share.  Thanks!

Link to comment
Share on other sites

23 hours ago, Snark said:

Yes, if that's all they did, it would be no problem. Except that they switch around all the values for all the parameters, including levels 1-3, which means I need to know what the original values are if I'm going to put them back.  Some of those are clear enough and I can figure out from the stock game (e.g. DSN power and upgrade cost), but not all are so obvious.

Can we not spread misinformation around please? All we have done is, simply, append an extra level onto the existing stock DSN module. All the stock values for Levels 1-3 have been retained. The CustomBarnKit 'vanilla' config can be found here: https://github.com/sarbian/CustomBarnKit/blob/master/CustomBarnKit/default.cfg All the Space Center vanilla values are shown there and are retained by CustomBarnKit unless specifically modified.

 

Link to comment
Share on other sites

6 minutes ago, Poodmund said:

Can we not spread misinformation around please?

Yep, that was said before I got the updated info from you on the other thread.

(Apologies for the mistake.  Simply looking at the actual CommNet config in OPM, it's not super obvious that it's actually not touching anything at all except adding a level, which contributed to my confusion.  Perhaps worth adding a comment to the CommNet config in OPM?  Just something to the effect of "Add a level 4 to the tracking station with 2000G power; leaves all other settings for the first three levels at stock values.")

6 minutes ago, Poodmund said:

The CustomBarnKit 'vanilla' config can be found here: https://github.com/sarbian/CustomBarnKit/blob/master/CustomBarnKit/default.cfg

Ah, thank you, that's excellent to know.  Had no idea where to find that or where it was coming from or anything else.  (Perhaps another thing worth adding as a comment in the config file that tweaks the values?)

Link to comment
Share on other sites

@Snark, I've got a problem with your mod getting in the way of something I'm trying to do, so I'm hoping you will consider implementing a tiny fix to correct it.

First let me give you some background on what I'm doing.  I'm the author of Grannus Expansion Pack, which adds planets around the star Grannus in GPP.  I'm also working on an update that allows Grannus and its planets to be installed as an expansion to the stock solar system.  As part of the update I want to give players the option to extend the commnet all the way to Grannus, providing they've researched all the requisite tech and completed all the upgrades.  To achieve this I need a combination of a 2T Level 4 Tracking Station and a 1T advanced antenna.  This produces a comm link to Grannus of about 6% when at periapsis.  Of course this means that comm links to planets in the local system are overpowered, but that's unavoidable if we're seeking a signal powerful enough to reach Grannus.  It should be up to the player to decide which combinations of tech and upgrades he wants to use.

Therefore I'm adding to GEP a Level 4 Tracking Station (the same upgrade used in OPM) and upgrades to some of the stock antennas to boost their strength (the same upgrades used in GPP).  However, I plan to make the antenna upgrades conditional on NEEDS[!JX2Antenna].  That way the upgrades appear only if your JX2Antenna is not present.  And if JX2Antenna is installed, then those become the antenna options from which the player must choose.  Of course if the player fully upgrades the Tracking Station, the JX2 becomes less vital as a tool to exploring the outer planets of the main system, but it still remains an essential part of the commnet to Grannus.  The Level 4 Tracking Station and the JX2 antenna need each other to accomplish the goal.

The problem I'm having is that anytime GEP is installed in combination with OPM, I can't get the Tracking Station upgrade to work.  JX2Antenna keeps reverting the upgrade because of your OPM patch, making it impossible to establish a comm link with Grannus.  The mods should be made to work together to achieve everyone's objectives, not fight each other.  The solution to this problem is very simple:  I just require that the NEEDS part of your jx2_OPM patch be revised to NEEDS[OPM,!GEP].  That way all my revisions work, and, I think, everybody wins.  Can you make that revision?  I don't think it will be necessary for you to make any other GEP patches because I'm handling the antenna upgrade thing on my end.

 

Edited by OhioBob
Link to comment
Share on other sites

39 minutes ago, OhioBob said:

@Snark, I've got a problem with your mod getting in the way of something I'm trying to do, so I'm hoping you will consider implementing a tiny fix to correct it.

...

The problem I'm having is that anytime GEP is installed in combination with OPM, I can't get the Tracking Station upgrade to work.  JX2Antenna keeps reverting the upgrade it because of your OPM patch, making it impossible to establish a comm link with Grannus.  The mods should be made to work together to achieve everyone's objectives, not fight each other.  The solution to this problem is very simple:  I just require that the NEEDS part of your jx2_OPM patch be revised to NEEDS[OPM,!GEP].  That way all my revisions work, and, I think, everybody wins.  Can you make that revision?  I don't think it will be necessary for you to make any other GEP patches because I'm handling the antenna upgrade thing on my end.

 

Another angle is to over-override the JX2-OPM patch (which is doing the same thing to the OPM info) with one that restores the values from OPM?  I'm not quite sure how to enforce hierarchy/order of overrides. :)

Link to comment
Share on other sites

1 hour ago, Beetlecat said:

Another angle is to over-override the JX2-OPM patch (which is doing the same thing to the OPM info) with one that restores the values from OPM?  I'm not quite sure how to enforce hierarchy/order of overrides. :)

I've tried to do that but I can't make it work.  I been unable to figure out a conditional string that overrides Snark's revert (doesn't mean there isn't one, I just haven't found it).  I also don't like the idea of having mods at war with each other trying to undo what the other is doing.  Isn't it better if we can all just get along?  The only solution I've found that works is to delete jx2_OPM.cfg from Snark's mod.  That will be the solution I'll have to recommend to GEP users if I can't find something better.  But that's an awkward solution I don't like.  Far better to tweak the config so users don't have to go around deleting files.
 

Edited by OhioBob
Link to comment
Share on other sites

51 minutes ago, OhioBob said:

I've tried to do that but I can't make it work.  I been unable to figure out a conditional string that overrides Snark's revert (doesn't mean there isn't one, I just haven't found it).  I also don't like the idea of having mods at war with each other trying to undo what the other is doing.  Isn't it better if we can all just get along?  The only solution I've found that works is to delete jx2_OPM.cfg from Snark's mod.  That will be the solution I'll have to recommend to GEP users if I can't find something better.  But that's an awkward solution I don't like.  Far better to tweak the config so users don't have to go around deleting files.

Yeah, looking at the JX2 patch, and the OPM patch, it doesn't look like the patches can be automatically applied in the correct order at the moment.

The problem is that the JX2 patch is :FINAL.  If that were changed to :AFTER[OPM], then your patch could be applied :FINAL, or you could use a custom name with :FOR that's after OPM, and it would work.  But since the JX2 patch is :FINAL, there's no way to override it.

Link to comment
Share on other sites

7 minutes ago, DStaal said:

The problem is that the JX2 patch is :FINAL.  If that were changed to :AFTER[OPM], then your patch could be applied :FINAL, or you could use a custom name with :FOR that's after OPM, and it would work.  But since the JX2 patch is :FINAL, there's no way to override it.

That's what I thought the problem was.  Thanks for confirming.

Link to comment
Share on other sites

A more elegant way of handling this whole thing would be to include something like PatchManager as a dependency and then the user would be prompted on first load of the game with the J2X mod to select whether they want the OPM-revert patch loaded or not.

 

Link to comment
Share on other sites

Thanks for the heads-up, @OhioBob.  I'll tinker with it.  Perhaps the solution may be to make it simply AFTER[OPM] rather than FINAL, and NEEDS[!GEP].

That would explicitly shut it up about your mod (regardless of ordering), and by making it AFTER[OPM] rather than FINAL, would make it play a bit nicer with any other third-party mods that may go a-tinkering with the tracking station.

Thoughts?

Link to comment
Share on other sites

1 hour ago, Snark said:

Thanks for the heads-up, @OhioBob.  I'll tinker with it.  Perhaps the solution may be to make it simply AFTER[OPM] rather than FINAL, and NEEDS[!GEP].

That would explicitly shut it up about your mod (regardless of ordering), and by making it AFTER[OPM] rather than FINAL, would make it play a bit nicer with any other third-party mods that may go a-tinkering with the tracking station.

Thoughts?

I like it.  I also like the idea of putting it in a Patchmanager-managed patch - you could make it so it's default on, and Patchmanager isn't needed - it just gives it an easy way to select to turn it off.  That would allow players to play with how they want it.

Link to comment
Share on other sites

4 hours ago, Snark said:

Thanks for the heads-up, @OhioBob.  I'll tinker with it.  Perhaps the solution may be to make it simply AFTER[OPM] rather than FINAL, and NEEDS[!GEP].

That would explicitly shut it up about your mod (regardless of ordering), and by making it AFTER[OPM] rather than FINAL, would make it play a bit nicer with any other third-party mods that may go a-tinkering with the tracking station.

Thoughts?

That sounds like a good solution, I see no problems with it.  As long as you don't do anything that prevents GEP from creating the Level 4 Tracking Station, I'm happy.

Somebody else also mentioned PatchManager to me.  I don't know much about it.  I do like the idea of giving the end user options.
 

Edited by OhioBob
Link to comment
Share on other sites

@Snark, I'm still not 100% certain how I'll end up handling these CommNet upgrades in GEP.  Right now I'm leaning toward making it an optional install that will come packaged in the GEP download.  It will likely end up being a separate folder inside GameData, something like this:

[KSP]/Gamedata/GEP_CommNet/

Therefore your OPM patch would need to include NEEDS[!GEP_CommNet] rather than just NEEDS[!GEP].  That way if the user decides he/she doesn't want to install the upgrades, your patch will still work.  If we just did NEEDS[!GEP], then your patch wouldn't work regardless of whether GEP includes the upgrades or not.

I'll let you know what I finally decide before I release, but I think the above works best.  Thoughts?
 

Edited by OhioBob
Link to comment
Share on other sites

@Snark, I've got my GEP CommNet all worked out.  I believe I've come up with a solution that works in all possible installation scenarios, and gives us both what we're after.  I've created a new mod named GEP_CommNet, which is an optional install that comes with GEP.  When installed, the player will get both of the following:

  1. A Level 4 Tracking Station with a rating of 2T.
  2. An additional antenna with a rating of 1T.

which will allow direct communications with the home world from as far away as the star Grannus.  Of course this will make communications within the home system overpowered, but that's the choice the player makes by installing the addon.

The additional antenna will be the JX2 if your mod is installed.  And if your mod is not installed, the player gets the "Communotron 7-1000", which is just a clone of the 88-88 that is rescaled and upgraded.  This ensures that the player has something that provides direct communication with Grannus.  However, the 7-1000 doesn't have relay capability, so that means the player has greater functionality with the JX2 than without it.

I've chosen to undo GPP's antenna upgrades when GEP_CommNet is installed (I borrowed the code from your GPP patch).  Adding the extra antenna in lieu of the upgrades is necessary because the upgrades don't apply themselves in sandbox mode, and I can't have a situation where the player doesn't have a 1T antenna available to him/her.

The only thing I need from you to make it all work is to have you edit one line in your jx2_OPM.cfg.  I believe the following is the best solution:

@CUSTOMBARNKIT:AFTER[OPM]:NEEDS[!GEP_CommNet]

This will free GEP_CommNet up to add the Level 4 Tracking Station without JX2Antenna trying to undo it.  If the player chooses not to install GEP_CommNet, then everything remains exactly as it is now.

Can you make that change?  There's no rush on it.  I would just need the revision to be in place by the time GEP is ready for its next release.  I'm not sure when that will be because it's contingent on GPP.
 

Edited by OhioBob
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...