Jump to content

(Drop Support)[1.6.1] Crew Light : An Automatic Light Manager [v1.19] (29 Jan 2019)


Li0n

Recommended Posts

Ok, thanks it's working. I found more parts:

"PPD-20 Jumbo Kerbal Can"

"IKU-01 Kerbal Safety Bubble"

"IKU-02 Kerbal Safety Bubble"

"IKU-03 Kerbal Safety Bubble".

Look's like lights already working on those parts.

Edited by robson1000
Link to comment
Share on other sites

@Li0n, are you having to tweak the actual code, to add support for these latest mods?... or is it ALL done thru MM patching?
I ask, becuase you have notes on the source in Git for the additions... ??

I'd like to add support for the DeadSkins for AviationLights mod... (I've changed part names and stuff from the original AL mod, but it still (currently) uses the AL .dll and the ModuleNavLights...)

Edited by Stone Blue
Link to comment
Share on other sites

1 hour ago, Stone Blue said:

@Li0n, are you having to tweak the actual code, to add support for these latest mods?... or is it ALL done thru MM patching?
I ask, becuase you have notes on the source in Git for the additions... ??

Both code and MM. Mostly it's coding to add new PartModule to the checklist but for the Toggle Lights on EVA I need MM to add my own PartModule to the relevant parts.

1 hour ago, Stone Blue said:

I'd like to add support for the DeadSkins for AviationLights mod... (I've changed part names and stuff from the original AL mod, but it still (currently) uses the AL .dll and the ModuleNavLights...)

It is this mod ? For what I see you only add a module to switch texture and new texture, so the part has still the same name. It should already be working. If you do change name I'll have to make an update for the special behavior on AviationLights to work with your version.

:rolleyes: ... Well, I've just checked a few things and it appears I've forgot to compile the PartModule for the beacon light to flash when the throttle is up... So I'll made an update soon

Link to comment
Share on other sites

5 hours ago, Li0n said:

It is this mod ? For what I see you only add a module to switch texture and new texture, so the part has still the same name. It should already be working. If you do change name I'll have to make an update for the special behavior on AviationLights to work with your version.

Thanx for the response.
Yes, thats it... I have a "beta" version, where I've remodeled a new part, and instead of texture switching, I use mesh switching instead. So internal part names are changed as well. Its basically a whole different mod now, except still using the AviationLights.dll
I'm looking into support for other mods' plugins as well... So no need to worry about adding support for this yet, if it requires you to edit code.

Link to comment
Share on other sites

Version 1.9 is up ! On SpaceDock and Github

Quote

**Fixes for Aviation Lights :**

* The beacon lights flashing when the throttle is up is working again
* AviationLights lights can now be toggle on EVA, no blinking option tho, they'll use the blinking preset defined in the settings.cfg
* Fail-safe for part using AviationLights module with a different name than in the original mod

This version is relevant only if you use AviationLights alongside CrewLight.

@Stone Blue Let me know when you update DeadSkins and I'll update CrewLight to recognize your parts and make them blink the way you want it. In the meantime every part with a "ModuleNavLight" should work a "normal" lightning (no blinking).

Have fun :)

Link to comment
Share on other sites

  • 4 weeks later...

Hello @Li0n, I need your help. I'm Trying to make last builds of CrewLight work on 1.2.2, particularly for AviationLights and Ven's Revamp support, but nothing seems to be working.
First of all:
Released 1.9 loads normally and does it's job but when I switch to vessel I get TypeLoadException in logs(full trace in spoiler).
1.9 recompiled with 1.2.2 libraries works but shows the same exception.
Released 1.5 works as intended. No exceptions.
Recompiled 1.5(without any changes in code) shows the same exception anyway.
Error in question:
 

Spoiler

At first time:
TypeLoadException: Could not load type 'System.Runtime.CompilerServices.IteratorStateMachineAttribute' from assembly 'CrewLight'.
    System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
    System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
    System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit)
    UnityEngine.AttributeHelperEngine.GetParentTypeDisallowingMultipleInclusion (System.Type type)
    UnityEngine.GameObject:AddComponent(Type)
    AddonLoader:StartAddon(LoadedAssembly, Type, KSPAddon, Startup)
    AddonLoader:StartAddons(Startup)
    AddonLoader:OnLevelLoaded(Int32)
    AddonLoader:OnSceneLoaded(Scene, LoadSceneMode)
    UnityEngine.SceneManagement.SceneManager:Internal_SceneLoaded(Scene, LoadSceneMode)

Later:
TypeLoadException: Could not load type 'System.Runtime.CompilerServices.IteratorStateMachineAttribute' from assembly 'CrewLight'.
    System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
    System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
    System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit)
    UnityEngine.AttributeHelperEngine.GetParentTypeDisallowingMultipleInclusion (System.Type type)
    UnityEngine.GameObject:AddComponent()
    GameObjectExtension:AddOrGetComponent(GameObject)
    CrewLight.LightDirector:SunLightAddVessel(Vessel)
    EventData`1:Fire(Vessel)
    Vessel:GoOffRails()
    OrbitPhysicsManager:LateUpdate()

 

Which makes me think I'm doing something wrong with rebuilding. But the thing is that I've took your project from guthub as is, just fixed .cs file path and reference issues and built it. And it still shows that exception. Am I missing something?
Btw, why was ModuleBeaconLightEngine.cs never included in CrewLight.csproj?

And second:
Looks like SunLight logic ain't doing well. Not only due to that LightDirector.SunLightAddVessel(Vessel) issue, but even on released 1.5 build tested on stock 1.2.2 KSP setup. I saw no exceptions in logs, light switching worked good, but when I warped till sunset lights did not turn on. I guess they just blinked for a moment at some point, but it is hard to notice during warp. I used stock lights and some parts from surface lights mod. Again, nothing related was found in logs.

Link to comment
Share on other sites

@KvaNTy here is the version 1.9 recompiled for KSP 1.2.2, just the .dll.

1 hour ago, KvaNTy said:

Released 1.9 loads normally and does it's job but when I switch to vessel I get TypeLoadException in logs(full trace in spoiler).
1.9 recompiled with 1.2.2 libraries works but shows the same exception.
Released 1.5 works as intended. No exceptions.
Recompiled 1.5(without any changes in code) shows the same exception anyway.
Error in question:

I don't get those exceptions, tell me if you see them again with the new .dll

 

1 hour ago, KvaNTy said:

Which makes me think I'm doing something wrong with rebuilding. But the thing is that I've took your project from guthub as is, just fixed .cs file path and reference issues and built it. And it still shows that exception. Am I missing something?
Btw, why was ModuleBeaconLightEngine.cs never included in CrewLight.csproj?

Mostly likely my fault, when I start using GitHub I must have done something wrong as I realize I got my C# project on two location :confused: I'll clean that. For the ModuleBeaconLightEngine I removed it from the project by mistake, it was re-introduced in 1.9.

 

1 hour ago, KvaNTy said:

And second:

Looks like SunLight logic ain't doing well. Not only due to that LightDirector.SunLightAddVessel(Vessel) issue, but even on released 1.5 build tested on stock 1.2.2 KSP setup. I saw no exceptions in logs, light switching worked good, but when I warped till sunset lights did not turn on. I guess they just blinked for a moment at some point, but it is hard to notice during warp. I used stock lights and some parts from surface lights mod. Again, nothing related was found in logs.

Can't confirm that either. Two things : SunLight is disabled at high time-wrap (10 000, I think) and stock light eats a lot of EC, try again with a RTG :wink:

Thanks for the interest and tell me how it goes with the new .dll

 

To everyone :

CrewLight v1.9 works fine with KSP 1.3.1 as far as I have test. I haven't released a recompiled version yet as I wait on ModuleManager to be officially compatible with KSP 1.3.1

Link to comment
Share on other sites

@Li0n Thank you, now everything works like a charm! And logs are clear.
And I confirm lights turning on after sunset. Actually that could be my bad - I forgot that all those light are added to default action group. Once I removed them from AG CrewLight began to do its magic with all stock, aviation lights and surface lights.
Can you show content of your actual working CrewLight.csproj? So we, or someone who might be reading this topic later, could figure out what was the problem?

Link to comment
Share on other sites

@KvaNTy that's good to hear :)

I've reset my GitHub repo/solution option, hopefully I got it right this time. If you want to try to compile it yourself it is on the DEV branch. It make me realize I got the same kind of mess on my RealTimeClock repo too... thanks for the heads up.

As for action group I recently found a nice mod that let you add/remove part from them in flight, with less/different option than ActionGroupExtended :

 

Link to comment
Share on other sites

So it goes like this:
Last DEV build recompiled against 1.2.2. On First flight scene:
 

Spoiler

[LOG 17:42:36.367] [AddonLoader]: Instantiating addon 'LightDirector' from assembly 'CrewLight'
[EXC 17:42:36.368] TypeLoadException: Could not load type 'System.Runtime.CompilerServices.IteratorStateMachineAttribute' from assembly 'CrewLight'.
	System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
	System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
	System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit)
	UnityEngine.AttributeHelperEngine.GetParentTypeDisallowingMultipleInclusion (System.Type type)
	UnityEngine.GameObject:AddComponent(Type)
	AddonLoader:StartAddon(LoadedAssembly, Type, KSPAddon, Startup)
	AddonLoader:StartAddons(Startup)
	AddonLoader:OnLevelLoaded(Int32)
	AddonLoader:OnSceneLoaded(Scene, LoadSceneMode)
	UnityEngine.SceneManagement.SceneManager:Internal_SceneLoaded(Scene, LoadSceneMode)

 

On somewhere closer to sunset:
 

Spoiler

[EXC 17:42:46.163] TypeLoadException: Could not load type 'System.Runtime.CompilerServices.IteratorStateMachineAttribute' from assembly 'CrewLight'.
	System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
	System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
	System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit)
	UnityEngine.AttributeHelperEngine.GetParentTypeDisallowingMultipleInclusion (System.Type type)
	UnityEngine.GameObject:AddComponent()
	GameObjectExtension:AddOrGetComponent(GameObject)
	CrewLight.LightDirector:SunLightAddVessel(Vessel)
	EventData`1:Fire(Vessel)
	Vessel:GoOffRails()
	OrbitPhysicsManager:LateUpdate()

 

Later on each scene change to VAB:
 

Spoiler

[EXC 17:43:55.432] NullReferenceException: Object reference not set to an instance of an object
	CrewLight.ModuleBeaconLightEngine.FixedUpdate ()
[EXC 17:43:55.433] NullReferenceException: Object reference not set to an instance of an object
	CrewLight.ModuleBeaconLightEngine.FixedUpdate ()

 

Also noticed that after sunset CL turned on only stock and surface light but ignored 2 of 4 aviation lights for some strange reason.

As for AGM, it looks usefull, thanks for the tip. But no chance it can be easily backported to 1.2.2.:(

UPD:
Damn, those two not working AL lights were beacons.
So basically everything seems to be working as it should. The only thing is that light error spam.

Edited by KvaNTy
More testing results
Link to comment
Share on other sites

@KvaNTy thanks for the detailed bug report.

I can't reproduce the issues you have in flight, my github repo (DEV branch at least) is up to date with my local source and I don't have enough knowledge about compiling and C# solution option to troubleshoot this...

For the ModuleBeaconLightEngine bug in the VAB I got it, I used the Start() method instead of the OnStart(), as it should be for a PartModule. I've updated a fix on the DEV branch and will make a release soon.

Here is a dll of CrewLight v1.9, with the fix for the beacon light, for KSP 1.2.2.

Link to comment
Share on other sites

@Li0n, oh thanks for dll. But the thing is that your previous 1.2.2 build doesn't have any of those issues. I've just double checked - no exceptions in ModuleBeaconLightEngine on entering VAB.
Loos like it was somehow related to other problems with my local builds. Maybe the problem is only on my side, idk. Maybe something is just not right in my VS environment or in some settings.

Link to comment
Share on other sites

11 hours ago, KvaNTy said:

@Li0n, oh thanks for dll. But the thing is that your previous 1.2.2 build doesn't have any of those issues. I've just double checked - no exceptions in ModuleBeaconLightEngine on entering VAB.

Weird, the issue is on CrewLight v1.9 with KSP 1.3.1. To replicate it I'd build a craft with a beacon light. Exist the VAB. Enter it again so the previous craft is auto-loaded then the error appear.

 

12 hours ago, KvaNTy said:

Loos like it was somehow related to other problems with my local builds. Maybe the problem is only on my side, idk. Maybe something is just not right in my VS environment or in some settings.

I use MonoDevelop to write my plugin, the version that came with Unity 5.4.0p4. I think the only setting I've changed is the output directory.

Link to comment
Share on other sites

Version 1.10 is up ! On SpaceDock and Github

Quote

* recompile for KSP 1.3.1
* fix a bug with beacon light from Aviation Lights becoming inoperable in the VAB

The ModuleManager.dll I bundle with this release was build for KSP 1.3, it works good but expect some NyanCat frenzy :wink:

Link to comment
Share on other sites

is it possible to disable the blinking approach light feature. i like the idea of it but personally was looking just for the quality of life perks form the automated lights.   and if not, If i edit the config o have just a blank space as the moris code message would that functionally do the same thing?

Link to comment
Share on other sites

12 hours ago, Trollsama said:

is it possible to disable the blinking approach light feature. i like the idea of it but personally was looking just for the quality of life perks form the automated lights.   and if not, If i edit the config o have just a blank space as the moris code message would that functionally do the same thing?

Absolutely, set the line "use_morse_code" to "False" in the file "GameData/CrewLight/PluginData/Settings.cfg" (you need to run KSP with CrewLight installed at least once for the file to be created).

The morse code thingy is fully customizable, you can change the message, the distance at which it begin and the duration of the dit, dah etc...

Edited by Li0n
Link to comment
Share on other sites

  • 1 month later...

Hey guys

I got an idea for a new feature for Crew Light : light with motion detector. When you walk close to them they turn on ! The inspiration for it came from the hard time I have when trying to right click on a light stashed behind a bunch of battery and mystery goo in a service bay :huh:

Code wise I think I know how to do it. The dilemma is : so far all the function of Crew Light work without a GUI, but for this one I don't see how I can do without it. In order to minimize the number of button on the right click menu I was thinking about adding a single button that bring a little window with the settings, this window will be centered on the mouse pointer and it will vanish when the pointer moves away. This is the less intrusive way I can think of.

As for the settings there would be a slider to change the distance at which the light is triggered and another to choose how long the light stays on when there is no more kerbal in range.

I'd like suggestion about this new functionality, specially about how to deal with the UI :wink:

Link to comment
Share on other sites

6 hours ago, Li0n said:

Hey guys

I got an idea for a new feature for Crew Light : light with motion detector. When you walk close to them they turn on ! [...]

but you already have lights on your helmet  in stock KSP ( with U or L key, don't remenber which one).  but why not!

Link to comment
Share on other sites

  • 4 weeks later...
On 12/12/2017 at 6:14 PM, Skalou said:

but you already have lights on your helmet  in stock KSP ( with U or L key, don't remenber which one).  but why not!

I need MOAR lights !

Version 1.11 is up ! On SpaceDock and Github

Quote

* New function : Lights can have a motion detector set to them, turning the light on when a Kerbal is near by
* fix : add ModuleBeaconLightEngine to the KIS white-list
* bundle ModuleManager 3.0.1

M0n02ZM.gif

MmYwl2Y.gif

 

Easy to use : right-click on the light you want, click the "Motion Detector" button, click on ON. Any Kerbal who walk inside the yellow sphere will trigger the light :) Optionally you can change the range at which the light gets trigger and for how long it stays on when there's nobody inside the sphere.

As every other functionlity in this mod it can be disabled in the settings file (GameData/CrewLight/PluginData/Settings.cfg).

It works for stock light (obviously), Surface Mounted Stock-Alike Lights, Kerbal Electric light and any part from mod that use the stock ModuleLight.

As you see in the gif above, the range sphere is offset from the light so it mimic the light cone, this apply only to the two stock light, for lights from mod the sphere center is at the light position.

Enjoy :)

Edited by Li0n
Link to comment
Share on other sites

Congratulation for this new feature, the new moon rocket is ready to launch!

LtXbOJq.jpg

:D

I'm still amazed to see what you and other modders can add to this game, what is the next step?

Edited by Skalou
edit link
Link to comment
Share on other sites

37 minutes ago, Skalou said:

Congratulation for this new feature, the new moon rocket is ready to launch!

Noel-2013-Disneyland-Paris-11.jpg

:D

I'm still amazed to see what you and other modders can add to this game, what is the next step?

Thx. Your picture isn't showing tho.

Link to comment
Share on other sites

  • 1 month later...
2 hours ago, b0ss said:

Awesome! Any way to make it so that cabin and control pod lights automatically turn off during daytime?

Yes and no : if you set "use_cabin_crew_lightning = False" in "GameData/CrewLight/PluginData/Settings.cfg" the lights on pods and cabin will have their lights responding to the sun light but it will applied to all pods and cabins, not only the ones that are manned.

I may remade how this works, I also like to move all the settings to the stock, in-game, settings. But that's unlikely to happen anytime soon...

Link to comment
Share on other sites

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