Jump to content

[1.0.5] Surface Mounted Stock-Alike Lights for Self-Illumination (v1.2.2 - 11/15/15)


Why485

Recommended Posts

13 minutes ago, Athlonic said:

You are right, but I had no other choice.

Update() seems to no longer being part of ModuleLight class which this mod belong. This is also why I called this fix "dirty" ;)

But it works ^^

I'm guessing the relevant code moved to OnUpdate(), which is the KSP equivalent of Update() (both are called).  SurfaceLights shouldn't have to intract with FixedUpdate() or OnFixedUpdate() at all.

Also, for the Unity methods (Update and FixedUpdate), I'm pretty sure that calling the base isn't necessary at all - Unity will call everything in the inheritance hierarchy up to MonoBehaviour.  These methods can even be private and Unity will still call them.

Link to comment
Share on other sites

2 hours ago, blowfish said:

...

Also, for the Unity methods (Update and FixedUpdate), I'm pretty sure that calling the base isn't necessary at all ...

This is exactly what I was wondering also, will do some testing. Thanks ;)

 

Tested without calling base.OnUpdate and ... nothing exploded.

Dropbox file updated.

New changelog from original below (along new references to be added) :

Spoiler

SurfaceLight.cs    Thu Apr 07 19:47:30 2016
@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
-using System.Threading.Tasks;
+using System.Threading;
 
 using UnityEngine;
 
@@ -43,10 +43,8 @@
             loadedFromSavedCraft = true;
         }
 
-        new protected virtual void Update()
+        protected virtual void Update()
         {     
-            base.Update();
-
             // Setting material color is expensive. Only do this in the editor where light
             // color can change, and only do it when the color has changed.
             if (HighLogic.LoadedSceneIsEditor)
             
             
SurfaceNavLight.cs    Thu Apr 07 10:22:22 2016
@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
-using System.Threading.Tasks;
+using System.Threading;
 
 using UnityEngine;

 

Edited by Athlonic
Link to comment
Share on other sites

  • 2 weeks later...

https://www.dropbox.com/s/js0m8ufpemb6i0h/SurfaceLights_devtemp_forKSP_V1.1.zip?dl=0

While waiting for Why485 update, my temporary fixed dll, still works here. Just install the original mod and replace the "GameData\SurfaceLights\SurfaceLights.dll" file with this one.

I just recompiled it with KSP v1.1(final) references just to be safe. :)

Link to comment
Share on other sites

5 hours ago, Athlonic said:

https://www.dropbox.com/s/js0m8ufpemb6i0h/SurfaceLights_devtemp_forKSP_V1.1.zip?dl=0

While waiting for Why485 update, my temporary fixed dll, still works here. Just install the original mod and replace the "GameData\SurfaceLights\SurfaceLights.dll" file with this one.

I just recompiled it with KSP v1.1(final) references just to be safe. :)

It really works. Thanks )

Link to comment
Share on other sites

21 hours ago, klesh said:

Anyone tried these fantastic lights in 1.1 yet?

The dll is bust, but I don't se what we need it for? I just changed the modules in the cfg files to the stock "ModuleLight". Color changing on lights are stock now.... Do that and delete the plugins, and you are good to go.

Link to comment
Share on other sites

6 hours ago, Warezcrawler said:

The dll is bust, but I don't se what we need it for? I just changed the modules in the cfg files to the stock "ModuleLight". Color changing on lights are stock now.... Do that and delete the plugins, and you are good to go.

In general it works but 4Way light behaves odd: you cannot turn on/off only one of the four light.

Btw, to set default RGB on the part a different property need to be used. Instead of:

MODULE
{
	startingRGB = 1.0, 0.9, 0.8
}

Use:

MODULE
{
	lightR = 1.0
	lightG = 0.9
	lightB = 0.8
}

Is the code source for the mod available somewhere?

Link to comment
Share on other sites

If anyone has been able to get the cfg files working without the DLL as mentioned in the posts above, could you share them somewhere please? Much appreciated!

Actually, it was pretty easy. I made the changes as outlined in the previous posts and the lights work great. The 4way light does have the limitation of either all on or all off, but they can all have different colors. Here is a repack of the dirty fix used for anyone that doesn't like editing files. Just extract the zip into your GameData folder.

SurfaceLights Dirty Fix for 1.1

Edited by Kiro
update
Link to comment
Share on other sites

Anyone has an idea what is "Creative Commons" license? Given inactivity of the original author I think I could reverse engineer the code and put it on Github but not sure if this license permits it. These lights are really useful, and it's pity the mod is not supported anymore.

Edited by IgorZ
Link to comment
Share on other sites

2 minutes ago, blowfish said:

The license is linked in the OP :huh:

It is linked there but do you understand it? Can you explain in human language what can and what cannot be done with the binary and models?

Edited by IgorZ
Link to comment
Share on other sites

8 minutes ago, IgorZ said:

It is linked there but do you understand it? Can you explain in human language what can and what cannot be done with the binary and models?

Ah, it links the legalese version.  Maybe try the more human readable version which summarizes the main points.

Link to comment
Share on other sites

5 minutes ago, blowfish said:

Ah, it links the legalese version.  Maybe try the more human readable version which summarizes the main points.

Thanks! Now it's a human language :) Looks like I can decompile, change and publish the new version as long as I give credits to the original author. Sounds good to me.

Link to comment
Share on other sites

21 minutes ago, Athlonic said:

Source code is in the zip file ^^

Lol. I so get used to Github that totally missed the other alternative of giving sources :) With the sources it's much easier.

Link to comment
Share on other sites

4-way light needs a node orientation adjustment. If @IgorZ is working on a new version he can make the change, but in the meantime just edit the config or patch it:

@PART[W485_Surface4WayLight]
{
  @node_stack_bottom = 0, 0, 0, 0, -1, 0, 0
}

 

Link to comment
Share on other sites

14 hours ago, Gaiiden said:

4-way light needs a node orientation adjustment. If @IgorZ is working on a new version he can make the change, but in the meantime just edit the config or patch it:


@PART[W485_Surface4WayLight]
{
  @node_stack_bottom = 0, 0, 0, 0, -1, 0, 0
}

 

Thanks! A really useful fix.

So, I did some code re-factoring (mostly style), compiled it for 1.1, and put on Guthub. For now it technically works with the original (SurfaceLights) parts. Though, the issue with 4-way light is still there. Looks like it's some change in the stock `ModuleLight`. Will figure it out later. If you have any hints you're welcome to suggest (or send pull requests).

A version for KSP 1.1 can be downloaded here. Once all issues are resolved I'll try to publish it on CKAN.

Edited by IgorZ
Link to comment
Share on other sites

So, I was trying to fix 4Way light and figured out the problem is in the animation. Then I ran 1.0.5 to figure out why it was working there and... discovered it wasn't working there! Am I crazy or it was broken from the beginning? :confused:

Link to comment
Share on other sites

NOTE: the following is not a bug in SurfaceLights (or kOS, as it happens).

I think I’ve found a fascinatingly weird interaction with Surface Mounted Lights parts and kOS parts.  If I have a craft that has both a SurfaceLights part and a kOS part, it will yaw slightly to the left (as I look at the YAW display) whenever SAS is off, building up rotational speed.  I noticed this on a small probe I’d built, and then on a large craft with a very different configuration.

I’ve launched variants of both craft with just SurfaceLights parts but no kOS parts; they did not yaw.  Then I sent up variants with kOS parts but no SurfaceLights parts; again, no yaw.  It’s only seen when both kinds of parts are on the same craft.  These tests were all done without any other non-Squad mods installed, so it really seems to be an interaction between these two mods.

Here’s a gist of the small probe that has the yaw problem: https://gist.github.com/meyerweb/b479f062b29266c2eb4b0f327bceaf5d .  Note that while this craft has the light atop the kOS processor part, I observed the same problem in another craft where the KAL9000 part was attached to the craft, and no lights were anywhere near it.  When I launched that same craft again without KAL9000, there was no yaw.

I’ll be reporting this over at the kOS thread as well, in case it’s their part and not the SurfaceLights part. 

 

Edited by meyerweb
Clarification that this is not a bug in SurfaceLights
Link to comment
Share on other sites

18 hours ago, meyerweb said:

I think I’ve found a fascinatingly weird interaction with Surface Mounted Lights parts and kOS parts.  If I have a craft that has both a SurfaceLights part and a kOS part, it will yaw slightly to the left (as I look at the YAW display) whenever SAS is off, building up rotational speed.  I noticed this on a small probe I’d built, and then on a large craft with a very different configuration.

I’ve launched variants of both craft with just SurfaceLights parts but no kOS parts; they did not yaw.  Then I sent up variants with kOS parts but no SurfaceLights parts; again, no yaw.  It’s only seen when both kinds of parts are on the same craft.  These tests were all done without any other non-Squad mods installed, so it really seems to be an interaction between these two mods.

Here’s a gist of the small probe that has the yaw problem: https://gist.github.com/meyerweb/b479f062b29266c2eb4b0f327bceaf5d .  Note that while this craft has the light atop the kOS processor part, I observed the same problem in another craft where the KAL9000 part was attached to the craft, and no lights were anywhere near it.  When I launched that same craft again without KAL9000, there was no yaw.

I’ll be reporting this over at the kOS thread as well, in case it’s their part and not the SurfaceLights part. 

 

These lights are physics parts so, technically they can affect craft behavior. Did you place the parts symmetrically?

Link to comment
Share on other sites

v1.2.3 alpha 2 is available

Cumulative updates from the stock version:

  • [Change] Minor code adjustments to compile under KSP 1.1
  • [Change] Disable animation on 4-way light since it doesn't work properly anyways.
  • [Change] Rename GUI action and event names in 4-way light to identify which light they control.
  • [Internal] Create a multipoint light module and use it in 4-way light.
  • [Internal] Migrate spot and omny lights to the stock LightModule.
  • [Internal] Drop incomplete SurfaceNavLight module.
  • [Internal] Drop unused SurfaceLight module.

In this state the mod provides all the functionality, is usable and looks stable. Though, I'll wait with the final release until animation issue in 4-way light is resolved. Luckily, @Shatten has offered his help in fixing the model.

 

Edited by IgorZ
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...