Jump to content

[Never mind] Overriding stock PartModules


Recommended Posts

Basically, what I want to do is make a MultiModeEngine extension. Instead of creating a separate part module and tying it to a MME module, I'd like to do this:


class ExtendedMultiModeEngine:MultiModeEngine
{
... my extended KSP Fields ...

public override void OnAwake()
{
base.OnAwake();
}

public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
}

public override void OnUpdate()
{
base.OnUpdate();
}

}

Should be benign, right? Except that I get a null dereference in MultiModeEngine.OnStart().


NullReferenceException: Object reference not set to an instance of an object
at MultiModeEngine.OnStart (StartState state) [0x00000] in <filename unknown>:0
at ExtendedMultiModeEngine.MultiModeEngineExtension.OnStart (StartState state) [0x00000] in <filename unknown>:0
at Part.ModulesOnStart () [0x00000] in <filename unknown>:0
at Part+.MoveNext () [0x00000] in <filename unknown>:0

So ... is there something obvious that I'm doing wrong here? I did not create a constructor for this class, and I didn't create an OnDestroy method (MME has both, and OnDestroy isn't virtual). Is there some C# gotcha that I'm tripping over?

EDIT: I'm still mildly curious why that doesn't work, but I realized I need to take a different approach to get what I want working right, so never mind.

Edited by MOARdV
Nevermind...
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...