Jump to content

.20 And mods


DYJ

Recommended Posts

Legacy

Legacy parts go in KSP_OS/Parts

Legacy plugins go in KSP_OS/Plugins

New fancy system

The new fancy system gives each mod a folder inside GameData with a conventional structure inside, so:

GameData/YourModFolder/Plugins

GameData/YourModFolder/Parts

GameData/YourModFolder/Otherstuff

And so on

Plugindata gets generated in the folder the plugin is in.

Like this:

dllFolder/PluginData/dllName/

For the parser to find parts in the new system the .cfg needs a PART wrapper, like so:


PART
{
normal .cfg stuff
}

Flag Images

Flags should be a small graphic in .png format. It is recommended to use 256x160 as the image size, although it appears that larger images do load correctly.

Users should make a subfolder in the Gamedata folder with your choice of name and put the flag image files inside that.

Example:

Gamedata/Flags/image.png

It is probable that flags bundled with mods will load correctly because of this structure.

rescaleFactor and attachnodes

It appears rescaleFactor no longer scales the position of attachnodes,it seems that setting the scale to 1 scales the nodes 1* rescaleFactor ie correctly.

rescaleFactor = x

scale = 1

The devs are aware of this so it might be fixed soon.

Other moderators: Feel free to edit this post as new info emerges.

Everyone else: Post new/useful information in the thread and it'll eventually get added to the OP

Edited by DYJ
Link to comment
Share on other sites

Fresh from #kspmodders:

[22:48:21] <Taverius> Mu, how does overriding the .cfg of stock parts work in .20?

[22:48:43] <+Mu> blog post on it coming in next day or so

[22:48:56] <+Mu> but basically you need to use the @ symbol

[22:49:11] <+Mu> @someValue = newValue

[22:49:24] <+Mu> @someNode { // newnodedef }

[22:49:48] <+Mu> the node thing is a lil odd tho

[22:50:00] <+Mu> you need to tag the nodes with ids

[22:50:14] <+Mu> MODULE (Engine00) { // enginemodule }

[22:50:16] <+Mu> then

[22:50:27] <+Mu> @Engine00 { }

[22:50:38] <Taverius> so if the stock .cfg

[22:50:45] <Taverius> (like all the squad ones ive seen)

[22:50:48] <Taverius> doesnt number the node

[22:50:53] <Taverius> then I can't override?

[22:51:16] <careo> hehe. then you need to patch the stock config file first so you can avoid having to patch it for an override?

[22:51:17] <+Mu> currently no, they're in need of redoing :$

Link to comment
Share on other sites

I actually just dropped the old mod parts into the mod folder like in the older version, didn't even have to change the .cfg file at all, and it worked like a charm, most parts worked fine... The only exceptions were a few made with the part generator, their connector nodes went wonky, but otherwise great, even mechjeb worked by dropping it in the old way... Haystack and Crew manifest didn't work, though, not sure what happened there... :P

Link to comment
Share on other sites

[23:02:19] <+Mu> also..... big change.....

[23:02:41] <+Mu> if you're putting part configs in gamedata then they have to be surrounded with PART {} nodes

[23:02:49] <+Mu> cuz gamedata doesnt know whats in there

[23:02:54] <+Mu> but... you dont have to call them part.cfg

[23:03:05] <+Mu> and you can put many configs in the same config file

[23:03:11] <+Mu> parts, resources, internals, etc

Link to comment
Share on other sites

Plugindata gets generated in the folder the plugin is in, you shouldn't have one from the start.

Like this:

dllFolder/Plugindata/dllName/

Link to comment
Share on other sites

Custom engine sounds don't play in the new system. What is the proper syntax now?

It used to work with the lines:

// --- Sound FX definition ---

sound_fspropstart.wav = engage

sound_fspropidle.wav = power

sound_explosion_low = flameout

Where the two first ones are now in the GameData\Firespitter\Sounds folder, and the last one is a stock sound.

(The last one still works, obviously)

Link to comment
Share on other sites

Plugindata gets generated in the folder the plugin is in, you shouldn't have one from the start.

Some mods come with a PluginData folder that needs to go somewhere from the start...

While I'm here, may I direct attention here? I may have picked the wrong forum to ask that question, might have been better asked here.

Link to comment
Share on other sites

It appears rescaleFactor no longer scales the position of attachnodes, fixing this is as easy as adding a scale value matching the rescaleFactor like so:

rescaleFactor = x

scale = x

Matching the rescaleFactor value actually doesn't work. For my parts I needed to set:

scale = 1.0

rescaleFactor = 1.25

... in order to restore 0.19 behavior. Setting scale to 1.25 is what I tried first, but that actually moved the nodes well outside and away from the model.

Link to comment
Share on other sites

Gaius asked above, but its worth asking again: how do we deal with mods that come with their own PluginData folder containing misc config files?

the PluginData folder should be located within the same Plugins folder as the .dll. So it will be GameData/ModName/Plugins/PluginData.

Link to comment
Share on other sites

The new folder structure makes it fairly easy to group SQUADS parts together, but othermods load parts based on their own name... would it cause any problems if I just put parts under squad's folder so I can have my neat groupings?

Link to comment
Share on other sites

I was told you could share one mesh / texture across multiple parts. I don't know if this was a feature that made it for 0.2 or was a future goal. Any info? My first order of business was rescaling the RGUs up by 1.45 and down by 0.45 so I had a circular probe-sized one and a mammoth one. I'd like to just use the same loaded mesh / texture as the normal RGUs since they're 8MB apiece.

Link to comment
Share on other sites

Why the heck was all this re-formating necessary in the first place? as far as I can tell it's only reason to exist is to aggravate anyone who used mods. I've spent about an hour now trying to get all the mods I normally use to work, with no success whatsoever.

Heck, if what you say is correct, and all Plugin-related files go in the "GameData" folder then, why is there a Plugin folder in the KSP folder? that's just deliberately misleading.

Edited by Aeshi
Link to comment
Share on other sites

The new way to make Part-less plugins is to use the KSPAddon attribute, like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

[KSPAddon(KSPAddon.Startup.EditorAny, false)]
public class Class1 : MonoBehaviour
{
private float lastUpdate = 0;

void Awake()
{
Debug.Log("TAC [" + this.GetInstanceID().ToString("X") + "][" + Time.time + "] Awake");
}

void Update()
{
float delta = Time.time - lastUpdate;
if (delta > 15)
{
Debug.Log("TAC [" + this.GetInstanceID().ToString("X") + "][" + Time.time + "] Update");
lastUpdate = Time.time;
}
}
}

This class will be loaded every time the scene is changed to the Editor, and Awake will be called. And it will be unloaded when the scene is changed to something else, but until then Update() will be called.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...