Jump to content

ModuleLight on/off???


Recommended Posts

Ok, this has me totally befuddled.

Here's the basic code:

            ModuleLight allLights;
            allLights = GetComponent<ModuleLight>();

First I get the ModuleLight from the part.

                allLights.useAnimationDim = false;
                allLights.useAutoDim = false;
                allLights.LightsOn();

Lights on!

                allLights.LightsOff();
                allLights.useAnimationDim = defaultDim;
                allLights.useAutoDim = defaultAutoDim;

Lights off... or not.

If I manually turn the light on, these two bits of code will turn the light off and back on.

If I manually turn the light off, these bits of code will never turn it on.

If I watch the PAW, it says that the lights are turning on and off.  But the lights never physically turn on.

What am I missing?

 

Link to comment
Share on other sites

So, after three days of screwing with this, I now have a clue as to why it's not working.  I was attempting to hook into some of ModuleLight's abilities so that my code would work with stock lights as well.  I'm now giving up as I have come to the conclusion that ModuleLight is junk.

You would think, that setting the useAnimationDim and useAutoDim to false would give you a light that simply turns on and off.   Wrong. If you use neither, you have no light.  Which makes no sense.

Another example of why it's junk.  If I place a light using symmetry and then launch the vehicle and try to turn one of those lights on, it turns both on.  Why are lights not using persistent fields to determine if a specific light is on or off?  Why is it doing it by groups?  Answer, because it's junk.

You'll note the use of the word junk, so that my thoughts are not replaced by the vulgar words I'd like to use.

Edited by Fengist
Link to comment
Share on other sites

6 hours ago, JPLRepo said:

What you should do is raise a bug report so a dev can fix it. Without a bug report, then it's random browsing of the forum that might get one of our attention to a problem no one knew existed.

Well, technically, using just stock parts with default ModuleLight parameters, it's not a bug.  If you change those parameters, then it will fail to work.

Link to comment
Share on other sites

Probably too late as I see on your other thread you already wrote your own ModuleLight but : May I ask why you use "useAnimationDim" and "useAutoDim" ? In my experience "LightsOn()" / "LightsOff()" is all you need to turn lights on / off.

Looking forward to the release, I love putting lights everywhere until the game look like a slide-show :D

Link to comment
Share on other sites

3 hours ago, Benjamin Kerman said:

Probably so it has the "cooling" animation of not turning off right away, but glowing and fading. 

The dimming do happen with just LightsOn(), on stock lights anyway. I'd ask as I thought maybe the behavior @Fengist was experiencing comes from using those two lines.

Link to comment
Share on other sites

On 9/14/2017 at 5:32 AM, Li0n said:

Probably too late as I see on your other thread you already wrote your own ModuleLight but : May I ask why you use "useAnimationDim" and "useAutoDim" ? In my experience "LightsOn()" / "LightsOff()" is all you need to turn lights on / off.

Looking forward to the release, I love putting lights everywhere until the game look like a slide-show :D

AutoDim won't be supported in the module I'm writing.  I did a quick check and I think there might be 2 lights, other than stock, that use it.

Here's why LightsOn and LightsOff won't work.

In the stock module, those either play the animation attached to the light or they can use the autoDim to fade it in and out (stock lights use only the animation).  If you're trying to simulate a blinking light that turns on for say 0.1 seconds, the stock light will still attempt to play that animation when you use LightsOn/LightsOff.  But, by the time that 0.1 seconds has elapsed and you try to turn the light off, the animation has only played 0.1 seconds out of a full second (stock seem to be a 1 second animation). Therefore, the light doesn't fully come on before it gets shut off.

My thoughts were, by toggling the useAnimationDim and useAutoDim to off that I would be able to either turn it on and off to achieve a blink or move the animation play head between the beginning and the end.  With ModuleLight, that simply doesn't work.   Even after setting both values to false, It will still attempt to use the animation.

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...