blowfishpro / B9PartSwitch

A Kerbal Space Program plugin designed to implement switching of part meshes, resources, and nodes
GNU Lesser General Public License v3.0
50 stars 33 forks source link

Testing two module B9 in the part and i loose my sensor function #226

Closed Massetstephane closed 2 years ago

Massetstephane commented 2 years ago

I've been changing my mu and cfg file for a week now to get a single piece, with left right indicator (or not) for the sensor type (ACC etc), without result I combined modulePartVariants with your module I have a functional version but the problem the texture of the indicator changed by the two modules, is not linked when B9 sets the texture to ACC, and I use the PartVariants module to switch to right or left part I find the original texture again :), but the sensor work and well controled by B9partSwitch.

I tested this version with two B9partSwitch modules the code :

// ---- Pitot tube by MASSET stephane WIP
// ---- GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
// ---- If one day i try to program c+ module i do a real pitot function
// ---- Compiled with 1.12 partools
// ---- 13/01/2022 update with B9PartSwitch to choose sensor type
// ---- Added module variant part to switch left right sensor flag
//      (B9PartSwich sensor not working with two modules)   
//      
PART
{
    name = PitoTubeLat
    module = Part
    author = Masset stephane
    //
    scale = 1
    rescaleFactor = 1
    //
    node_stack_bottom = 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0
    node_attach = 0.0, -0.0025, 0.0, 0.0, -1.0, 0.0, 0
    attachRules = 1,1,0,0,1
    //
    TechRequired = aerodynamicSystems
    entryCost = 100
    cost = 300
    category = Science
    subcategory = 0
    title = #PitotNoseTitle_2
    manufacturer = #PitotNoseManuc
    description = #PitotNoseDesc
    mass = 0.005
    dragModelType = default
    maximum_drag = 0.02
    minimum_drag = 0.02
    angularDrag = 1
    crashTolerance = 10
    maxTemp = 2000 // = 3000
    explosionPotential = 0.1
    bulkheadProfiles = size0, surf
    thermalMassModifier = 2.0
    emissiveConstant = 0.50
    tags = #PitotNoseTag

    // Part
    MODEL
    {
        model = PlaneTool/Parts/Pitot/Assets/PitotNose_Lat
    }   

    // ---- It's not the real function but it's a start ----
    // Testing B9PartSwitch mod to change module functions
    // test on ModuleEnviroSensor switch -> sensorType seem ok
    // test on ModuleScienceExperiment switch -> experimentID not working

    // switch sensor and indicator type
    MODULE
    {
        name = ModuleB9PartSwitch
        moduleID = Sensor
        switcherDescription = #B9switchdesc_1
        switchInFlight = False
        uiGroupName = #B9UIgrp_1
        uiGroupDisplayName = #B9UIDisplN_1

        SUBTYPE
        {
            name = BlankS
            title = #sensorBlank_1
            primaryColor = Grey
            secondaryColor = Grey
            descriptionSummary = #sensorBlDescSum
            descriptionDetail = #sensorBlDescDet
            MODULE
            {
                IDENTIFIER
                {
                    name = ModuleEnviroSensor
                }
                moduleActive = false
            }                       
        }

        SUBTYPE
        {
            name = ACC
            title = #sensorACC
            primaryColor = DarkNavyBlue
            secondaryColor = Grey
            descriptionSummary = #autoLOC_500697
            descriptionDetail = #autoLOC_500698

            TEXTURE
            {
                texture = PlaneTool/Parts/Pitot/Assets/IndiceACC
                baseTransform = FLAG
            }

            MODULE
            {
                IDENTIFIER
                {
                    name = ModuleEnviroSensor
                }
                DATA
                {
                    sensorType = ACC
                }
            }
        }

        SUBTYPE
        {
            name = PRES
            title = #sensorPRES
            primaryColor = CobaltBlue
            secondaryColor = Grey
            descriptionSummary = #autoLOC_500700
            descriptionDetail = #autoLOC_500701

            TEXTURE
            {
                texture = PlaneTool/Parts/Pitot/Assets/IndicePRES
                baseTransform = FLAG
            }

            MODULE
            {
                IDENTIFIER
                {
                    name = ModuleEnviroSensor
                }
                DATA
                {
                    sensorType = PRES
                }
            }
        }

        SUBTYPE
        {
            name = GRAV
            title = #sensorGRAV
            primaryColor = BottleGreen
            secondaryColor = Grey
            descriptionSummary = #autoLOC_500703
            descriptionDetail = #autoLOC_500704

            TEXTURE
            {
                texture = PlaneTool/Parts/Pitot/Assets/IndiceGRAV
                baseTransform = FLAG
            }

            MODULE
            {
                IDENTIFIER
                {
                    name = ModuleEnviroSensor
                }
                DATA
                {
                    sensorType = GRAV
                }
            }
        }

        SUBTYPE
        {
            name = TEMP
            title = #sensorTEMP
            primaryColor = BrickRed
            secondaryColor = Grey
            descriptionSummary = #autoLOC_500706
            descriptionDetail = #autoLOC_500707

            TEXTURE
            {
                texture = PlaneTool/Parts/Pitot/Assets/IndiceTEMP
                baseTransform = FLAG
            }

            MODULE
            {
                IDENTIFIER
                {
                    name = ModuleEnviroSensor
                }
                DATA
                {
                    sensorType = TEMP
                }
            }
        }
    }   

    // switch side indicator
    MODULE
    {
        name = ModuleB9PartSwitch
        moduleID = Switch
        switcherDescription = #B9switchdesc_2
        switchInFlight = False
        uiGroupName = #B9UIgrp_2
        uiGroupDisplayName = #B9UIDisplN_2

        SUBTYPE
        {
            name = BlankI
            title = #sensorBlank_2
            primaryColor = Grey
            secondaryColor = Grey
            descriptionSummary = #sensorBlDescSum
            descriptionDetail = #sensorBlDescDet

            TRANSFORM
            {
                name = IndicatorL
                positionOffset = 0.05, 0.0, 0.0
            }
            TRANSFORM
            {
                name = IndicatorR
                positionOffset = -0.05, 0.0, 0.0
            }
        }

        SUBTYPE
        {
            name = LEFT
            title = #PitotLEFT
            primaryColor = #3f9b0b
            secondaryColor = Grey
            descriptionSummary = #PitotLEFT
            descriptionDetail = #B9sideDescDet_1

            TRANSFORM
            {
                name = IndicatorL
                positionOffset = 0.05, 0.0, 0.0
            }
            TRANSFORM
            {
                name = IndicatorR
                positionOffset = 0.0, 0.0, 0.0
            }
        }

        SUBTYPE
        {
            name = RIGHT
            title = #PitotRIGHT
            primaryColor = #e50000
            secondaryColor = Grey
            descriptionSummary = #PitotRIGHT
            descriptionDetail = #B9sideDescDet_2

            TRANSFORM
            {
                name = IndicatorL
                positionOffset = 0.0, 0.0, 0.0
            }
            TRANSFORM
            {
                name = IndicatorR
                positionOffset = -0.05, 0.0, 0.0
            }
        }
    }

    // ---- MAIN sensor module ----
    MODULE
    {
        name = ModuleEnviroSensor
        // set by ModuleB9PartSwitch
        sensorType = ACC 
    }       

    // ---- Emissive Anim for heat ----
    MODULE
    {
        name = ModuleAnimateHeat
        ThermalAnim = Pitot_Heat
    }

    // ---- Experiment (for all type ACC, PRES, GRAV, TEMP)
    // ---- Not Functional
    //
    MODULE
    {
        name = ModuleCargoPart
        stackableQuantity = 4
        packedVolume = 1
    }
}
//END FILE

In this form my texture work, but now i don't have any module active in KSP, the first B9Partswith work well alone, but adding the second module to switch left or right side indicator texture kill the sensor function. I tried to include also in the second module the code for managing module (DATA, active no active etc) and every time i lose the sensor fonction. tested this for example in second B9Partmodule :

SUBTYPE
        {
            name = LEFT
            title = #PitotLEFT
            primaryColor = #3f9b0b
            secondaryColor = Grey
            descriptionSummary = #PitotLEFT
            descriptionDetail = #B9sideDescDet_1

            TRANSFORM
            {
                name = IndicatorL
                positionOffset = 0.05, 0.0, 0.0
            }
            TRANSFORM
            {
                name = IndicatorR
                positionOffset = 0.0, 0.0, 0.0
            }
                        MODULE
            {
                IDENTIFIER
                {
                    name = ModuleEnviroSensor
                }
                moduleActive = true
            }
        }

not working no sensor active. My other version works (combination of B9partswitch and moduleVariantparts) you just have to set the part to left or right first, and chose the type of sensor and change the texture indicator, but you must not change sides otherwise the texture returns to default, but once launched everything is ok the texture is displayed :) Or else I only use one B9 module with 9 subtypes :) Or two distinct part :) left and right.

I love this layout: one piece and nine possibilities, it was even possible to have the sensor without an indicator texture, too bad. form

I will watch with the 9 nine options on a single line (only one module) the place taken and how the panel reacts. I think this is the best solution. steph

Massetstephane commented 2 years ago

Hi ! It's work but I have no choice on the indicator anymore, so I'm going to do one part with indicator and one part without, in case people don't want to see the indicator on the part (little texture showing ACC, PRES etc) form