Jump to content

Location of module definitions


LethalDose

Recommended Posts

So, this is probably a massively newb-ish question, but I'm not getting anywhere on my own. As some background, I program a lot in R (scripted language for statistics), and have some C experience from some college classes, and some casual experience with C++. I know my way around variables, methods, arguments, recursion, etc, but, I'm still having issues with some of this.

First off, what's a module? It looks like a some kind of method call. For example, a MODULE is included in the SolarPanels2 part's cfg file:

MODULE

{

name = ModuleDeployableSolarPanel

animationName = solarpanels2

resourceName = ElectricCharge

chargeRate = 2

powerCurve

{

key = 206000000000 0 0 0

key = 13599840256 1 0 0

key = 68773560320 0.5 0 0

key = 0 10 0 0

}

}

As far as I can tell, this module refers to a "ModuleDeployableSolarPanel" method, and passes the arguments animationName, resourceName, chargeRate, and powerCurve to the method. However, without seeing the code for this module, I'm not sure how these get used and, therefore, how to modify these Module calls (definitions? references?) to add the parts and resources our add-on needs.

If I can get directed to where the modules are defined/coded, that would be amazing. Any help would be great!

Thanks!

Link to comment
Share on other sites

I am not a very experienced modder, but I do know what partmodules do. The first line MODULE, tells the game that a partmodule is being defined.The braces tell the game that the forthcoming lines of text are the parameters for the module. The name being what module it is and what it will do. Then, the animation name tells the game what the extend/retract animation is within the unity asset (encrypted into .mu). The, the resourcename tells the game that this solar panel (as defined earlier) will produce ElectricCharge. The chargeRate is the specified rate at which the solar panels produce ElectriceCharge. Then, powerCurve works as follows;

key = 206000000000 0 0 0

key = (distance from Kerbol (sun)) (amount of power generated (ratio to chargeRate)) (nothing useful) (nothing useful)

If you want to know more about how any other modules work, feel free to PM me.

Link to comment
Share on other sites

This below should be of help, until some more experienced forumites write better info.

The module name you pointed at effectively matches code with the same name for its class definition. Standard module names should all be part of the KSP.exe; module names defined in mods are built into plugins (.dll files).

I found this (and most other useful info) explained

(it is a series of 7 videotutorials, the module name is shown in the 2nd video).
Link to comment
Share on other sites

The MODULE calls being used to create objects of class = [name] makes loads of sense. I would still love to see the existing modules and their definitions so I can figure out which classes work best for what I need to do, how the classes are written, and where I need to create new classes.

Link to comment
Share on other sites

I linked to the annotated class definitions above. That's pretty much as far as you'll be able to get with looking at KSP's code. The game isn't open source.

I saw your links, and I appreciate it. However, there's stuff missing, e.g. I can't find the "ModuleDeployableSolarPanel" PartModule class anywhere and the GitHub site hasn't been updated in nearly a year.

I'm not complaining, mind you, I'm just trying to figure out what's available and what classes I can use. I really hate wandering around in code blindfolded trying to find what's there.

Thanks, again.

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