ShotgunNinja / Kerbalism

Hundreds of Kerbals were killed in the making of this mod.
The Unlicense
43 stars 19 forks source link

MOLE custom solar panel modules don't work with the background simulation [MM fix included] #82

Closed gotmachine closed 7 years ago

gotmachine commented 7 years ago

Custom modules for solar panels in MOLE, WBIDualAxisSolarArray and WBIModuleMirroredSolarPanel don't seem to play well with the background simulation. Unless you want to add hardcoded support for those, here is a MM patch replacing them with stock modules in the two offending parts.

The drawbacks of this solution are pretty minor and purely cosmetic : for WBIDualAxisSolarArray, the first pivot is always tracking the sun even if the panel is retracted, and for WBIModuleMirroredSolarPanel the part mirroring feature is gone.

// Use stock modules instead of WBIDualAxisSolarArray for dual-axis sun tracking
@PART[WBI_SolarBatteryModule]
{
    -MODULE[WBIDualAxisSolarArray] {}
    -MODULE[ModuleDeployableSolarPanel] {}

    //Y-axis of SARJ is the pivot
    //Z-axis of suncatcher2 points to the sun.
    MODULE
    {
        name = ModuleDeployablePart 
        pivotName = SARJ
        secondaryTransformName = suncatcher2 // same as raycastTransformName in a ModuleDeployableSolarPanel
        trackingSpeed = 0.25
        isBreakable = false
        showStatus = false
    }

    //Y-axis of SolarArrayPivot is the pivot
    //Z-axis of suncatcher points to the sun.
    MODULE 
    {
        name = ModuleDeployableSolarPanel
        animationName = Deploy
        pivotName = SolarArrayPivot
        raycastTransformName = suncatcher
        windResistance = 5
        trackingSpeed = 0.25    
        isBreakable = true
        retractable = true
        resourceName = ElectricCharge
        chargeRate = 24.0
    } 
}

@PART[WBI_SkylabSolarPanel]
{
    -MODULE[WBIModuleMirroredSolarPanel] {}

    // Hacky way to hide the unused "SolarPanelMirror" model so there isn't any ugly clipping
    node_stack_disabled = 0.0, -1000.0, 0.0, 0.0, -1.0, 0.0, 0
    MODULE
    {
        name = ModuleJettison
        jettisonName = SolarPanelMirror
        bottomNodeName = disabled
        allowShroudToggle = false
    }

    MODULE
    {
        name = ModuleDeployableSolarPanel
        isTracking = false
        raycastTransformName = suncatcher
        pivotName = suncatcher
        animationName = Deploy
        retractable = false
        isBreakable = true
        impactResistance = 8
        resourceName = ElectricCharge
        chargeRate = 6.0
    }
}
ShotgunNinja commented 7 years ago

Included here. Given that these two modules are only used in two parts, I think the hack is the appropriate solution. Many thanks!