Jump to content

Konfig [Use Patch Manager]


ShadowDev

Recommended Posts

Support for this mod has been dropped.
Please swap to Patch Manager
https://spacedock.info/mod/3482/Patch Manager
https://pm.kerbal.wiki/

 

 

Konfig (0.0.4)
The Simple Patcher

Spoiler

Konfig-1685822618.png

Install using CKAN for best experience

This is a high performance patcher.

Download SpaceDock
Github - License MIT
Wiki

Example - Extra fuel for SRB

Example - Skybox Scott manley

As of 0.0.4:
Part Patching
Celestial Body Patching
Skybox Patching

This mod was created out of a debate on what way would be best to do part patching (Currently 3 standards)

Requires:
ShadowUtilityLib 0.0.4 +
SpaceWarp 

Edited by ShadowDev
use pm
Link to comment
Share on other sites

Konfig (0.0.2)
Added Celestial body patching

Example below

[Target(Kerbin)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
Data.radius = 500.0;
Module.SetDefinition(Data);

 

Edited by ShadowDev
forgot =
Link to comment
Share on other sites

Konfig (0.0.4)

Added skybox

[Target(File_Name_of_your_skybox)]
[Module(Skybox)]
[Data(int)]
Data = 2048;//width/height

You will need files in the following naming convention

6 files
File_Name_of_your_skybox.Direction.png

Directions of:

  • xn
  • xp
  • yn
  • yp
  • zn
  • zp

Folder Structure:
1M9uJL3cMM.png

Link to comment
Share on other sites

  • 4 months later...

Is there a list of all things that can be modified by this, or a way to find such a list from the game?

In particular, I'm interested in modifying axial tilt of CelestialBodies. The example in the Wiki shows the format, but I don't know the actual word to use for Axial Tilt.

[Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
Data.rotationPeriod = 800;
Data.rotates = true;
Data.isTidallyLocked = false;
Module.SetDefinition(Data);

 

Edited by Superfluous J
Link to comment
Share on other sites

Thank you! However, I'm having an issue and have 2 more questions

The Issue:

This errors out and won't run currently. I have Konfig as the only mod installed in CKAN. It installed BepInEx, Shadow Utility LIB, SpaceWarp, and UITK for KSP 2. I load KSP, and Mods has a /!\ error. I click that and see this:

7ampF3T.jpg

Here's the player.log (renamed): https://drive.google.com/file/d/1l71jP_TYjDXtHOW7paVBCfZkPINxK1vc/view?usp=sharing

The Questions:

1) Assuming this is fixable, where do I put the config files? In the mod directory?

2) How do I represent a Vector3d in the config file? I'm guessing something like this but have no clue:

[Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
Data.axialTilt = (0.5,0.5,0.5);
Module.SetDefinition(Data);

 

Edited by Superfluous J
Link to comment
Share on other sites

On 10/29/2023 at 1:34 PM, Superfluous J said:

Thank you! However, I'm having an issue and have 2 more questions

The Issue:

This errors out and won't run currently. I have Konfig as the only mod installed in CKAN. It installed BepInEx, Shadow Utility LIB, SpaceWarp, and UITK for KSP 2. I load KSP, and Mods has a /!\ error. I click that and see this:

7ampF3T.jpg

Here's the player.log (renamed): https://drive.google.com/file/d/1l71jP_TYjDXtHOW7paVBCfZkPINxK1vc/view?usp=sharing

The Questions:

1) Assuming this is fixable, where do I put the config files? In the mod directory?

2) How do I represent a Vector3d in the config file? I'm guessing something like this but have no clue:

[Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
Data.axialTilt = (0.5,0.5,0.5);
Module.SetDefinition(Data);

 

sorry about shadowlib. It had a file leftover from when spacewarp was required. I  will push an update to fix that issue soon.

And yes filename.konfig can go in any folder within the plugins folder. 

for the vector 3 part you can do this. new Vector3d(0.5,0.5,0.5)

Link to comment
Share on other sites

  • 2 weeks later...

Before I start, I cannot stress enough how little I understand all of this. But I'm good at reporting things so what happened is exactly what happened, but why I tried what I tried is mostly due to fumbling in the dark.

So I did as mentioned above:

[Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
Data.axialTilt = new Vector3d(0.5,0.5,0.5);
Module.SetDefinition(Data);

And this is what the log said:

namespace KPatcher;

public class patch_Mun_000Mine_0 : PatchModule<CelestialBodyComponent,CelestialBodyProperties> {
    private Logger logger = new Logger("Konfig Patch", "0.0.1");
    static void Main()
    {

    }
    public override void Patch(ref CelestialBodyComponent Module, ref CelestialBodyProperties Data, string  partName,PartData partData, PartCore Target){
        Data.axialTilt = new Vector3d(0.5,0.5,0.5);
Module.SetDefinition(Data);
    }
}

[Error] [11/14/2023 2:00:23 AM] [Konfig] [0.0.1] CS0029: Cannot implicitly convert type 'Vector3d' to 'QuaternionD'

[Error] [11/14/2023 2:00:23 AM] [Konfig] [0.0.1] 0x000002250A25CF00

So I figure "Fine, make it a QuaternionD"

I google that because I've never heard of it before, and some random page tells me it's kind of like a vector3d but has a number before it. Okay, so let's try this:

[Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
Data.axialTilt = new QuaternionD(1,0.5,0.5,0.5);
Module.SetDefinition(Data);

And now Mun IS tilted, but so is its orbit, and it's no longer a circular orbit, it's an ellipse but the ellipse is centered on Kerbin. And when I focus on Mun, everything gets wonky. The whole solar system tilts, and Kerbin's marker remains on the screen even when it's not in focus or on the screen...

Here's a pic of Mun's (and Minmus') orbit from directly above. It's not tilted, that's the shape of the orbit.

MCHqPe7.png

Check out that tilt:

y64OlvQ.png

Like I said, wonky.

At the very least, I don't know what I'm doing. At the worst, there's a problem in the game itself. I'm hoping it's closer to my fault than KSP2's fault, like I don't know what values are valid so I'm causing the problem.

Link to comment
Share on other sites

I found this post where the tilt part (but not the weird orbit part) is reported in the game, and it implies perhaps that Eeloo, Pol, and Bop are configured "correctly" with axial tilt.

Is there a way to get the data on these worlds so I can see how they're set, so I can figure out how to set up Mun?

Edited by Superfluous J
Link to comment
Share on other sites

  • 3 weeks later...

sorry about the late reply.

yes you can get the data from them planets, 
the Newtonsoft lib is included in the patch class so you could convert the Data into json and then log it into the log.sl

[Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
logger.Log(JsonConvert.SerializeObject(Data))
Edited by ShadowDev
sent too early
Link to comment
Share on other sites

  • 4 weeks later...

Hey, i'm trying to increase the thrust (while keeping the same electricity consumption per second) of the Ion engine using Konfig. From what i understood from your github wiki i think the script should look something like this

[Target(dawn)]

[Module(Module_Engine)]

[Data(Data_Engine)]

partdata.thrust = 1 kn;

partdata.electricityconsumption = 10/s max;

but i'm not sure how to figure out what names i should use for the target or partdatas. where can i find them?

Link to comment
Share on other sites

On 11/29/2023 at 6:37 AM, ShadowDev said:

sorry about the late reply.

yes you can get the data from them planets, 
the Newtonsoft lib is included in the patch class so you could convert the Data into json and then log it into the log.sl

[Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
logger.Log(JsonConvert.SerializeObject(Data))

I tried this (exactly as typed) and this is what was logged in log.sl. It seems to be an error. I pasted everything from about where it started loading my konfig file.

namespace KPatcher;

public class patch_Mun_000_Mine_0 : PatchModule<CelestialBodyComponent,CelestialBodyProperties> {
    private Logger logger = new Logger("Konfig Patch", "0.0.1");
    static void Main()
    {

    }
    public override void Patch(ref CelestialBodyComponent Module, ref CelestialBodyProperties Data, string  partName,PartData partData, PartCore Target){
        logger.Log(JsonConvert.SerializeObject(Data))
    }
}
[Debug] [12/26/2023 03:17:22] [Konfig] [0.0.1] logger.Log(JsonConvert.SerializeObject(Data))
[Debug] [12/26/2023 03:17:22] [Konfig] [0.0.1] [Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
logger.Log(JsonConvert.SerializeObject(Data))
[Info] [12/26/2023 03:17:22] [Konfig] [0.0.1] Found patch file D:\SteamLibrary\steamapps\common\Kerbal Space Program 2\BepInEx\plugins\000_Mine\munlog.konfig
[Info] [12/26/2023 03:17:22] [Konfig] [0.0.1] Searching D:\SteamLibrary\steamapps\common\Kerbal Space Program 2\BepInEx\plugins\000_Mine
[Info] [12/26/2023 03:17:22] [Konfig] [0.0.1] Getting patches
[Error] [12/26/2023 03:17:22] [Konfig] [0.0.1] The invoked member is not supported in a dynamic module.

mscorlib
System.Collections.ListDictionaryInternal

-2146233067
  at System.Reflection.Emit.AssemblyBuilder.get_Location () [0x00006] in <eef08f56e2e042f1b3027eca477293d9>:0 
  at Konfig.KonfigMod.GetConfigs () [0x0003a] in <4218657a54774aa7ae43857ea3ac1656>:0 
System.String get_Location()
[Info] [12/26/2023 03:17:23] [Konfig] [0.0.1] Initialized
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] 0x00000226104BCF00


System.Collections.ListDictionaryInternal

-2147024885
  at (wrapper managed-to-native) System.AppDomain.LoadAssemblyRaw(System.AppDomain,byte[],byte[],System.Security.Policy.Evidence,bool)
  at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence, System.Boolean refonly) [0x0000e] in <eef08f56e2e042f1b3027eca477293d9>:0 
  at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence) [0x00000] in <eef08f56e2e042f1b3027eca477293d9>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain.Load(byte[],byte[],System.Security.Policy.Evidence)
  at System.AppDomain.Load (System.Byte[] rawAssembly) [0x00000] in <eef08f56e2e042f1b3027eca477293d9>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain.Load(byte[])
  at System.Reflection.Assembly.Load (System.Byte[] rawAssembly) [0x00005] in <eef08f56e2e042f1b3027eca477293d9>:0 
  at Konfig.KonfigMod.GetConfigs () [0x005c9] in <4218657a54774aa7ae43857ea3ac1656>:0 

[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0534: 'patch_Mun_000_Mine_0' does not implement inherited abstract member 'PatchModule<CelestialBodyComponent, CelestialBodyProperties>.Patch(ref CelestialBodyComponent, ref CelestialBodyProperties, string, PartData, PartCore)'
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0246: The type or namespace name 'PartCore' could not be found (are you missing a using directive or an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0246: The type or namespace name 'PartData' could not be found (are you missing a using directive or an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0246: The type or namespace name 'CelestialBodyProperties' could not be found (are you missing a using directive or an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0246: The type or namespace name 'CelestialBodyComponent' could not be found (are you missing a using directive or an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0246: The type or namespace name 'CelestialBodyProperties' could not be found (are you missing a using directive or an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0246: The type or namespace name 'CelestialBodyComponent' could not be found (are you missing a using directive or an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'Sim' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'Sim' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'Sim' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'UI' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'Messages' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'Sim' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'Game' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS0234: The type or namespace name 'Modules' does not exist in the namespace 'KSP' (are you missing an assembly reference?)
[Error] [12/26/2023 03:17:23] [Konfig] [0.0.1] CS1002: ; expected
[Debug] [12/26/2023 03:17:24] [Konfig] [0.0.1] MainMenu

Konfig is installed via CKAN and is version 0.0.4

Link to comment
Share on other sites

10 hours ago, ShadowDev said:

on the end of 

logger.Log(JsonConvert.SerializeObject(Data))

you need to add a ;

will look something like this

logger.Log(JsonConvert.SerializeObject(Data));

I had missed it out in my reply. 

I can't add any more reactions today.

So this is my :happy:

...however, it's still not outputting.

Here's the new log when I added the ; to the end. It's a bit shorter than it was:

namespace KPatcher;

public class patch_Mun_000_Mine_0 : PatchModule<CelestialBodyComponent,CelestialBodyProperties> {
    private Logger logger = new Logger("Konfig Patch", "0.0.1");
    static void Main()
    {

    }
    public override void Patch(ref CelestialBodyComponent Module, ref CelestialBodyProperties Data, string  partName,PartData partData, PartCore Target){
        logger.Log(JsonConvert.SerializeObject(Data));
    }
}
[Debug] [12/26/2023 22:17:50] [Konfig] [0.0.1] logger.Log(JsonConvert.SerializeObject(Data));
[Debug] [12/26/2023 22:17:50] [Konfig] [0.0.1] [Target(Mun)]
[Module(CelestialBodyComponent)]
[Data(CelestialBodyProperties)]
logger.Log(JsonConvert.SerializeObject(Data));
[Info] [12/26/2023 22:17:50] [Konfig] [0.0.1] Found patch file D:\SteamLibrary\steamapps\common\Kerbal Space Program 2\BepInEx\plugins\000_Mine\munlog.konfig
[Info] [12/26/2023 22:17:50] [Konfig] [0.0.1] Searching D:\SteamLibrary\steamapps\common\Kerbal Space Program 2\BepInEx\plugins\000_Mine
[Info] [12/26/2023 22:17:50] [Konfig] [0.0.1] Getting patches
[Error] [12/26/2023 22:17:50] [Konfig] [0.0.1] The invoked member is not supported in a dynamic module.

mscorlib
System.Collections.ListDictionaryInternal

-2146233067
  at System.Reflection.Emit.AssemblyBuilder.get_Location () [0x00006] in <eef08f56e2e042f1b3027eca477293d9>:0 
  at Konfig.KonfigMod.GetConfigs () [0x0003a] in <4218657a54774aa7ae43857ea3ac1656>:0 
System.String get_Location()
[Debug] [12/26/2023 22:17:53] [Konfig] [0.0.1] MainMenu

 

Link to comment
Share on other sites

Thank you for this amazing mod. I spent hours patching with MM after I understood the syntax but now I'm working on learning how to create the .konfig files and could use a little help with a (hopefully simple) part  patch. I would like the radial decouplers to have a much stronger max impulse so I used the solid fuel booster patch example as a framework and tried to work out how to implement this using a language I'm not very familiar with (yet). I came up with the following, but I'm not sure if I have the syntax correct:
 

[Target(decoupler_1v_radial)]
[Module(Module_Decouple)]
[Data(Data_Decouple)]
Data.ejectionForce *= 10;

[Target(decoupler_2v_radial)]
[Module(Module_Decouple)]
[Data(Data_Decouple)]
Data.ejectionForce *= 10;

I can not get it to update the ejection impulse in-game. Am I on the right track or do I need to attempt this from another angle?

Edited by shoe7ess
Updated Code
Link to comment
Share on other sites

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...