Jump to content

Regarding .cfg module = paramater


Syndic

Recommended Posts

Is it possible to double up on these? I'm diddling around with making a mod pack for my own personal use, picking and choosing the best bits, but I want the features of two plugins on this 1 part.

Is it possible?

And if it is, what is the correct Syntax? :)

Link to comment
Share on other sites

I don't think you can make it as a "double feature" with .CFGs alone; you'll need to "merge" the source files in a third type (not the code, but I'll explain below).

Let's say you have a ModuleA class, importing from Part, and a ModuleB class, also importing from Part.

Both classes have different methods, called onPartDestroy, onUpdate, etc. You'll probably have the same method redefined in both classes.

So, to combine them, you'll need to make your "ModuleAB" class, importing from ModuleA and ModuleB.

For each method, you'll need to do something like:

void onPartDestroy() {

(ModuleA)this.onPartDestroy();

(ModuleB)this.onPartDestroy();

}

whilst being careful that base.onPartDestroy() is not called twice in each submethod.

So yeah, not easy.

Link to comment
Share on other sites

So, to combine them, you'll need to make your "ModuleAB" class, importing from ModuleA and ModuleB.

Nope. you can only inherit from one class in c#.

EDIT: If at least one of the two functions your part should have is available as part module, then you're lucky. They've been invented to allow multiple purposes for one part.

Edited by Kreuzung
Link to comment
Share on other sites

Nope. you can only inherit from one class in c#.

Oops. I'm a bit rusty in C#, sorry.

Well then, disregard my post; you'll need to integrate the code from both modules in a new module "manually" (copy-paste the code).

Since you'll need to do that manual merge at each update, it can get a bit tedious.

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