Im kinda stuck on light problem cant get it to lit , i always get this error " 'CompGlower.Lit.set': cannot explicitly call operator or accessor ". Im new to c# soo what did i miss this time :D ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace PowerGenerator
{
public class Building_Plasma : Building
{
private int time = 80;
private int phase = 0;
private CompGlower glowerComp;
private CompPowerTrader powerComp;
private static readonly SoundDef SoundBurn = SoundDef.Named("PowerOn");
public override void SpawnSetup()
{
base.SpawnSetup();
this.powerComp = base.GetComp<CompPowerTrader>();
this.glowerComp = base.GetComp<CompGlower>();
}
public override void TickRare()
{
base.TickRare();
this.time --;
if (this.time <= 80 && this.time >= 77 && this.phase == 0)
{
this.powerComp.powerOutput = -30f;
this.phase = 1;
}
if (this.time <= 45 && this.time >= 42 && this.phase == 1)
{
this.powerComp.powerOutput = -10f;
this.phase = 2;
}
else if (this.time <= 20 && this.time >= 17 && this.phase == 2)
{
this.powerComp.powerOutput = 0f;
this.phase = 3;
}
else if (this.time <= 8 && this.time >= 5 && this.phase == 3)
{
this.powerComp.powerOutput = 100000f;
this.phase = 4;
this.glowerComp.set_Lit = true;
}
else if (this.time <= 1 && this.phase == 4)
{
this.glowerComp.set_Lit = false;
this.time = 80;
this.phase = 0;
}
}
}
}
try this.glowerComp.Lit instead of this.glowerComp.set_Lit
Wow it worked thanks !
Do you know maybe if i can change the light settings like a color in the code ?
I have no idea, but the GlowFlooder class seems to have a function that takes a colour as an argument (AddFloodGlowFor)
Quote from: mrofa on April 27, 2014, 11:29:23 AM
Wow it worked thanks !
Do you know maybe if i can change the light settings like a color in the code ?
If you can I'd surely like to know, its been the biggest pain in my ass for the longest of times with my emergency lighting stuff XD
You can overwrite the glower def. That way the glower will always have your colors.
BUT if you do that, EVERY glower of that type will be changed as you overwrite the base definition with this.
E.g. every standing light has the color red if you overwrite the def of the standing light glower.
public override void SpawnSetup()
...
glower.def.glowColor = new ColorInt(255,0,0,255); // Red
Normally it's easier and less problematic to just set the color via XML.
Quote from: Haplo on April 27, 2014, 04:33:44 PM
You can overwrite the glower def. That way the glower will always have your colors.
BUT if you do that, EVERY glower of that type will be changed as you overwrite the base definition with this.
E.g. every standing light has the color red if you overwrite the def of the standing light glower.
public override void SpawnSetup()
...
glower.def.glowColor = new ColorInt(255,0,0,255); // Red
Normally it's easier and less problematic to just set the color via XML.
Actually, for me this is perfect to change all instances :D
Honestly, I've never tried, what happends when you change the def on one thing only. It should change every instance of the glower, but I'm unsure about glowers already glowing. They should change their color instantly, but if the calculation is done with changes only, it may be that only one changes, even if the def is changed.
If you do it, can you tell us how it goes?
I'm a bit curious too ;)
Quote from: Haplo on April 27, 2014, 04:52:00 PM
Honestly, I've never tried, what happends when you change the def on one thing only. It should change every instance of the glower, but I'm unsure about glowers already glowing. They should change their color instantly, but if the calculation is done with changes only, it may be that only one changes, even if the def is changed.
If you do it, can you tell us how it goes?
I'm a bit curious too ;)
My to do list is a bit long, and I dont think reworking the emergency lighting is until about half way down it. However as soon as I do it, you'll know about it :P
Fair enough ;)
I'll await your find patiently. 8)
Quote from: Haplo on April 27, 2014, 04:33:44 PM
You can overwrite the glower def. That way the glower will always have your colors.
BUT if you do that, EVERY glower of that type will be changed as you overwrite the base definition with this.
E.g. every standing light has the color red if you overwrite the def of the standing light glower.
public override void SpawnSetup()
...
glower.def.glowColor = new ColorInt(255,0,0,255); // Red
Normally it's easier and less problematic to just set the color via XML.
That works perfect thanks alot !
No problem, glad I could help. :)
Whats the fourth number there for? I never know, its R,G,B,? to me XD
It is the alpha channel.
255 is fully visible, while 0 is invisible. Or something like that. :)
I see. I always just leave it at 0 in my light stuff :/
Alpha isn't used in lighting calculations. But it's part of a standard 32-bit color value.
And yes, I'm sorry that, for now, light color is fixed in the def and not dynamically modifiable. I didn't really design for much in the way of dynamic lighting, though I have ways to do it in mind now.
So i should start making disco floor :D
Quote from: mrofa on April 27, 2014, 05:31:11 PM
So i should start making disco floor :D
Please do ;)
1. Make disco floor
2. Make all your colonists dance by putting them on fire
3. Capture it
4. Add the song I will survive by Gloria Gaynor to it and upload to youtube
5. ???
6. PROFIT!!!