Skip to content

Add better support for PartModules from mods #11

@602p

Description

@602p

I'm not really sure how @djungelorm would want to implement this, but I would like to see a way to allow mod authors to support KRPC for their PartModules in the same way stuff like the specific subclasses for stock PartModules are (e.g. Engine, LaunchClamp.) So for example I could add support for getting the FailureModule from a part and check it's age, without using the (functional but ugly) Module system of HasField and GetField. I would like to be able to write something along the lines of the LandingLeg class for it that would allow important fields as KRPCProperties.

Maybe allow PartModules to implement an ISupportsKRPC interface that has a function public Module GetRepresentation() to return an instance of a specific subclass of Module that is passed over the connection when the client asks for the functionality of that PartModule? I'd like to hear how you would do this.

Then add methods SupportsRepresentation and GetRepresentation to the Module class to check if the PartModule implements ISupportsKRPC, and if it does call GetRepresentation() and pass that back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions