[B18] [KV] Adjustable Colored Lights [ModSync]

Started by Kiame, November 11, 2017, 02:19:52 AM

Previous topic - Next topic

Kiame

Change the color of any light once "Colored Lights" is researched.

Legend:
R - Red
G - Green
B - Blue
H - Hue
S - Saturation
L - Luminosity

For modders:
To have this work with your mod, include "CompProperties_Glower" in <comps> and have the defName contain either "Lamp" or "Light" in the string (case-sensitive)


Steam:
A17
A18

Direct Download:
A17
A18


Github



Like my mods? Consider supporting me!









Kiame

Update:
All lights can have their color adjusted after Colored Lights is researched

Steam and direct downloads have been updated

Crow_T

Damn you are fast, people were just talking about this :D Awesome!
(regarding dead man's apparel)
"I think, at the very least, the buff should go away for jackets so long as you're wearing the former owner's skin as a shirt."
-Condaddy20

Nightinggale

#3
Quote from: Kiame on November 11, 2017, 02:19:52 AMFor modders:
To have this work with your mod, include "CompProperties_Glower" in <comps> and have the defName contain either "Lamp" or "Light" in the string (case-sensitive)
For those, who haven't noticed yet, it's possible to add this to your mod only if the user has loaded this mod. Add this if you use ModCheck:
<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="ModCheck.isModLoaded">
<modName>Adjustable Colored Lights - A17</modName>
<yourMod>name of your mod</yourMod>
</li>
<li Class="PatchOperationAdd">
<xpath>*/ThingDef[defName = "whatever"]/comps</xpath>
<value>
<CompProperties_Glower>
        <glowRadius>12</glowRadius>
  <glowColor>(217,217,208,0)</glowColor>
</CompProperties_Glower>
</value>
</li>
</operations>
</Operation>

I haven't tested this specific use (I just wrote it on the forum), but I think that's the code to make your thing glow, but only if Adjustable Colored Lights is loaded. I'm not saying it would always make sense to do this, but I say that you do have the option to do this. It's up to you to figure out if it makes sense for your specific mod.

Quote from: Kiame on November 11, 2017, 02:19:52 AMGuthub
New server name  ::)
ModCheck - boost your patch loading times and include patchmods in your main mod.

Kiame

Quote from: Nightinggale on November 11, 2017, 03:32:09 PM
Quote from: Kiame on November 11, 2017, 02:19:52 AMFor modders:
To have this work with your mod, include "CompProperties_Glower" in <comps> and have the defName contain either "Lamp" or "Light" in the string (case-sensitive)
For those, who haven't noticed yet, it's possible to add this to your mod only if the user has loaded this mod. Add this if you use ModCheck:
(code example)
I haven't tested this specific use (I just wrote it on the forum), but I think that's the code to make your thing glow, but only if Adjustable Colored Lights is loaded. I'm not saying it would always make sense to do this, but I say that you do have the option to do this. It's up to you to figure out if it makes sense for your specific mod.

Quote from: Kiame on November 11, 2017, 02:19:52 AMGuthub
New server name  ::)

Thanks for the Guthub corrected!

As for the listed operation it's not quite what I was aiming for because unless the base object's def's defName has either "Lamp" or "Light" it will not work. Also if the object in question is either a Lamp or Light it will already include CompProperties_Glower in it.

Here's an example from a LED-Light mod:

<Defs>
<ThingDef ParentName="LEDLampBase" >
<defName>LEDLamp</defName>
<label>LED Lamp</label>
<description>Standing lamp that lights an area, uses a LED Bulb.</description>
<designationHotKey>Misc11</designationHotKey>
<comps>
<li Class="CompProperties_Glower">
<glowRadius>12</glowRadius>
<glowColor>(217,217,208,0)</glowColor>
</li>
</comps>
<researchPrerequisites><li>LEDBulbs</li></researchPrerequisites>
</ThingDef>
<Defs>


This will work with this mod since the defName "LEDLamp" has "Lamp" in it and it includes the comp CompProperties_Glower

Kiame

#5
It looks like in one of the last revisions of B18 there was a change in wihch all the lights of a certain type will share one glow color. This is for space reasons i'm sure but it breaks this mod to an extent.
When adjusting one type of light's color, ALL lights of that same type will change color too. I'm going to look into a way to revert the change to allow individual lights, no matter the type, have a custom color.

Update B18
Updated to fix a bug where modded lights' colors would not be persisted when loading a saved game

Kiame