Jump to content

[1.2] PlanetShine - v0.2.5.2 stable - v0.5 experimental [4 October 2016]


Valerian

Recommended Posts

Is it possible add mod planets using ModuleManager or at least without having to overwrite CelestialBodies.cfg?

Currently you need to edit CelestialBodies.cfg directly, but when I have more time I will make a way to allow an easier integration with other mods.

Link to comment
Share on other sites

Hi,

Firstly, compliments of the season to all readers.

Secondly, I need some pointers on how to go about determining the cause and then hopefully the means to resolve this error message detailed below:


[EXC 16:00:20.477] NullReferenceException: Object reference not set to an instance of an object FlightGlobals.get_Bodies ()
PlanetShine.ConfigManager.LoadSettings ()
PlanetShine.ConfigManager.Start ()

Thanks in advance.

P.S. Running KSP 0.90.

Edited by BruceKnowles
Link to comment
Share on other sites

I don't know if it uses ModuleManager, but if you place a CelestialBody.cfg with just your planet's colors in your mod's folder it will load it nicely together with the default PS colors.

Hi are you sure about this file name?

I have a file named CelestialBodies.cfg in directory GameData/PlanetShine/Config which comes as part of the default installation.

I have had a look at the code and after a lot of squeezing the fault location I narrowed it down to this call in Config.LoadSettings();

[COLOR=#4EC9B0][FONT=Consolas]CelestialBody[/FONT][/COLOR][FONT=Consolas] body [/FONT][FONT=Consolas]= [/FONT][COLOR=#4EC9B0][FONT=Consolas]FlightGlobals[/FONT][/COLOR][FONT=Consolas].[/FONT][FONT=Consolas]Bodies[/FONT][FONT=Consolas].[/FONT][FONT=Consolas]Find(n [/FONT][FONT=Consolas]=>[/FONT][FONT=Consolas] n[/FONT][FONT=Consolas].[/FONT][FONT=Consolas]name [/FONT][FONT=Consolas]==[/FONT][FONT=Consolas] bodySettings[/FONT][FONT=Consolas].[/FONT][FONT=Consolas]GetValue([/FONT][COLOR=#D69D85][FONT=Consolas]"name"[/FONT][/COLOR]));

This was my conclusion for the Start() routine in Config.cs:


[COLOR=#569CD6][FONT=Consolas]public [/FONT][/COLOR][COLOR=#569CD6][FONT=Consolas]void[/FONT][/COLOR][FONT=Consolas] Start() {
[/FONT] [COLOR=#569cd6]if[/COLOR] (Instance != [COLOR=#569cd6]null[/COLOR]) {
Destroy(Instance.gameObject);
}

Instance = [COLOR=#569cd6]this[/COLOR];

LoadSettings(); [COLOR=#57a64a]// I think this needs to be delayed until we are sure some solar system info is loaded
[/COLOR] [COLOR=#DCDCDC][FONT=Consolas]}[/FONT][/COLOR]

This remark is a result of my determination that FlightGlobals.Bodies was a null pointer at the instant the routine was called.

The release implementation has the ConfigManager started 'EveryScene' which includes the startup/load phase.

Since it is possible to insert an entirely new Planetary system in place of the default one, it made sense to me that the variable would indeed not be initialised until the very last moment, which would allow third party plugins to populate this part of the data structure suite by some means.

Given also that we cannot predict with absolute certainty the order of loading modules other than by arranging the order of directories in the GameData sub tree structure by external means, I think it necessary that a different checkpoint is used to trigger the initialisation cycle. Examples of an external means are the names of the Toolbar and USITools directories which attempt (but not guarantee) that they are loaded as early in the load cycle as possible.

I have thus altered my version of the code as follows:

Old

[KSPAddon(KSPAddon.Startup.EveryScene, false)]

public class ConfigManager : MonoBehaviour

{

New

[KSPAddon(KSPAddon.Startup.MainMenu, false)]

public class ConfigManager : MonoBehaviour

{

This change has resolved the immediate problem, however, due to my lack of experience both with C# and this game, I am not yet convinced that this is a complete solution.

For the moment though, all does appear satisfactory.

Link to comment
Share on other sites

Looks sweet as! Just a quick question though, is the AmbientLightShifter included in the download?

I'll be sure to include this in my new .25 playthrough!

This mod is an replacement for AmbientLightShifter and is incompatible so it does not come with it no.

Link to comment
Share on other sites

Hi are you sure about this file name?

I have a file named CelestialBodies.cfg in directory GameData/PlanetShine/Config which comes as part of the default installation.

Actually, the name of the file itself is not a factor. What is a factor is the data inside it. As long as the file contains a node structured like this: (Sample)

CelestialBodyColor
{
name = Sun
color = 255,225,180
intensity = 6
atmosphereAmbient = 0
groundAmbientOverride = 1
}

...then all should go as planned.

UPDATE: As it turns out, this is not accurate. My latest post below is the correct format.

Edited by Gaalidas
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

This mod is truly the best visual upgrade in my opinion, one ive found does not add any extra junk like menus, ect, works very well, is stable, and unlike some other visual mods, doesnt kill your FPS or cause various bugs. Im also really liking the darkness in vaccum, its much more realistic, as you wouldnt expect any of the far away stars to actually create enough light to illuminate anything. It also doesnt actually change the game's original feel by much, which is an added benefit, for one who actually doesnt find the stock game bad looking per say, just needing some small minor fixes here and there, this mod being one of them.

Sadly environmentalvisualenchancements has alot of visual artifacts and obvious glitches such as z-clipping and general obvious polygons of the cloud mesh. City lights are impossible to use, as they look very bad up close, and from very far away end up shimmering and have z-clip issues. If most of this wasnt the case, id be much more inclined to run that mod alongside this.

Link to comment
Share on other sites

Sorry if this has been reported before (and/or is not meaningful), but PlanetShine consistently produces an exception every time I load KSP. It looks like this (a little before & after provided):

[Hangar] PartUpdater: registering AtHangar.EngineFXUpdater

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

[Hangar] PartUpdater: registering AtHangar.ResourceIntakeUpdater

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

ModularFuelTanks 5.4.1

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

NullReferenceException: Object reference not set to an instance of an object

at FlightGlobals.get_Bodies () [0x00000] in <filename unknown>:0

at PlanetShine.ConfigManager.LoadSettings () [0x00000] in <filename unknown>:0

at PlanetShine.ConfigManager.Start () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

CRFFix.Start()

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

[TR.TextureReplacer] Started 2.2.5.38190

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Tac.InstallChecker[FFFFD686][0.00]: TAC Life Support - KSPUtil.ApplicationRootPath = C:/Games/KSP_win/KSP_Data/../

Link to comment
Share on other sites

Same here, Planet Shine throws one exception during game start:

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

NullReferenceException: Object reference not set to an instance of an object

at FlightGlobals.get_Bodies () [0x00000] in <filename unknown>:0

at PlanetShine.ConfigManager.LoadSettings () [0x00000] in <filename unknown>:0

at PlanetShine.ConfigManager.Start () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

CRFFix.Start()

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Link to comment
Share on other sites

It's not that crazy really, as long as you don't make a duplicate entry for a certain body... unsure what that would do. Anyway, there's no parent node defined in the default configuration file, however the code in the DLL suggests that it looks for the file by name and location, so you cannot simply add a new file with the "CelestialBodyColor" node inside of it and expect it to work. You would basically need to append the new entries to the end of the file. An update to the code really needs to be done in order to let it load new color profiles from a parent node that the config manager in the DLL would look for, rather than the specific file path/name.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
Would anyone be interested/able in making this mod more mod compatible, aka make it easy for module manager changes to be made instead of having to overwrite everything?

^ this would be the greatest, no longer would we have to constantly overwrite everyone else's configs!

Link to comment
Share on other sites

I'm currently backpacking & hitchiking through asia without a computer for a few months, so feel free to send pull requests as well as the compiled version so I can update the mod with my phone.

Regarding the settings button requiring toolbar, sorry for not mentioning it in the main post, I would appreciate if someone could update the code to add it to the ingame toolbar.

Sorry for the overcomplicated code for the lightings, I know that with a bit of time I could have made it much simpler.

Link to comment
Share on other sites

  • 2 weeks later...
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...