Jump to content

Understanding ModuleLight changes in 1.11


Recommended Posts

The recent changes to ModuleLight in KSP 1.11 mean my Strobe-O-Matic rotator light mod no longer works, so I've been trying to figure out how to revamp my spinner lights.

Context (1.05~1.10 era)

My mod provides rotator lights in five fixed standardized industrial colors - amber, blue, green, red and white.

Each rotator light consists of a common base model (not relevant to this discussion) and a colored lens model containing the light source and animated rotating mirror. As it is not possible to actually redirect a light beam off a mirror, I actually have two light sources - a spherical Pointlight that makes the inner workings glow, and a conical Spotlight that casts the actual light beam out into the world:

QBN6lsh.png

Back in KSP 1.0.5 through to 1.10, I was able to toggle both light sources and the spinning mirror animation with a single ModuleLight:

MODULE
{
    name = ModuleLight
    lightName = Pointlight, Spotlight
    useAnimationDim = true
    lightBrightenSpeed = 100
    lightDimSpeed = 100
    resourceAmount = 0.01
    animationName = SDHI_ToggleLight_Amber
    useResources = true
}

d3elnWN.png

The Problem (1.11+ era)

However, after the recent KSP 1.11 update, the light sources and animation no longer work when the rotator light is switched on or off.

According to @JPLRepo in the recent Modders Notes for 1.11.0:

On 12/17/2020 at 1:30 PM, JPLRepo said:

ModuleLight no longer uses animations to control color and brightness of the lights.Instead this is done by the part module itself.

My understanding is that these changes were made to support player-tweakable light colors, which isn't what I want for these rotator strobe lights.

Where I need help

Basically, I want to restore my mod's 1.0.5~1.10 light color and animation functionality in 1.11.0.

  • How do I control multiple light sources on the same part with just one ModuleLight part module? (I cannot put each light source into separate ModuleLights, as this would allow players to individually turn the Pointlight and Spotlight, which would destroy the visual effect I am aiming for. Renaming both Pointlight and Spotlight to a shared toggleableLight transform name does not work, either.)
     
  • How do I force the light to be always use my custom color, disable the light color picker for my part? (These rotator strobes use standardized industrial colors, and should not be changed by the player. However, my reworked lights are always white, even when I set custom lightR, lightG and lightB values in the CFG.)
     
  • How do I toggle the spinning animation on/off with ModuleLight? (Turning the light on and off should start and stop rotating the Spotlight transform. Having a separate ModuleAnimateGeneric is counter-intuitive, as players shouldn't have to separately turn on the light and the rotator as two separate actions.)

Anyone have any specific insights into getting my mod working again?

Link to comment
Share on other sites

  • 2 weeks later...

@sumghai, if this is still relevant. I hope this is some kind helpful, at least on node 1 and 3.

name = SDHI_WRL_Amber
MODULE    
{       
  name = ModuleLight       
  lightName = Spotlight		
  lightMeshRendererName = Pointlight       
  useAnimationDim = true		
  lightBrightenSpeed = 100       
  lightDimSpeed = 100       
  resourceAmount = 0.01       
  animationName = SDHI_ToggleLight_Amber        
  useResources = true		
  movementTransformName = Pointlight
}

You will see for yourself what the code does on existing model, but apparently there needs to be some changes to animation hierarchy.

As far the fixed color goes, i tried to link "ModuleLight" to "ModuleColorChanger" with no avail (so far).

As i would like to see you to make just one part that uses existing stock behavior, i'll try to figure out the rest of the puzzle.

best regards

 

Link to comment
Share on other sites

Hello dear sir, just FYI. I was investigating another bug and find out that maybe link between "ModuleLight" and animation is broken. 

It's not directly related, but i think that the sock landing gear has the same problem as your mod.

Link to comment
Share on other sites

@sumghai

I totally forgot, how the old landing legs were fixed. :blink:

green:

Spoiler

    //MODULE
    //{
        //name = ModuleLight
        //lightName = Spotlight
        //useAnimationDim = true
        //lightBrightenSpeed = 100
        //lightDimSpeed = 100
        //resourceAmount = 0.01
        //animationName = SDHI_ToggleLight_Green
        //useResources = true
    //}
    MODULE
    {
    name = ModuleAnimateGeneric
    animationName = SDHI_ToggleLight_Green
    startEventGUIName = Deploy
    endEventGUIName = Retract
    actionGUIName = Toggle gear
    }

amber:

Spoiler

    //MODULE
    //{
        //name = ModuleLight
        //lightName = Spotlight
        //lightMeshRendererName = Pointlight
        //useAnimationDim = true
        //lightBrightenSpeed = 100
        /lightDimSpeed = 100
        //resourceAmount = 0.01
        //animationName = SDHI_ToggleLight_Amber
        //useResources = true
    //}
    MODULE
    {
    name = ModuleAnimateGeneric
    animationName = SDHI_ToggleLight_Amber
    startEventGUIName = Ligts ON
    endEventGUIName = Ligts OFF
    actionGUIName = Toggle ligt
    }

blue:

Spoiler

    MODULE
    {
    name = ModuleAnimateGeneric
    animationName = SDHI_ToggleLight_Blue
    startEventGUIName = Ligts ON
    endEventGUIName = Ligts OFF
    actionGUIName = Toggle ligt
    }

 

Quote

ModuleLight no longer uses animations to control color and brightness of the lights.Instead this is done by the part module itself.

"ModuleAnimateGeneric" now controls color and brightness of the lights.

Edited by sebi.zzr
Link to comment
Share on other sites

  • 2 years later...
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...