Glowing plants

Started by Igabod, December 31, 2014, 07:14:32 PM

Previous topic - Next topic

Igabod

I was considering doing a plant that has a slight bio-luminescent glow. Unfortunately the compGlower thing doesn't seem to work on a plant object. I was wondering if one of the C# wizards running around these forums could find a way to make plants glow. It might be a fun little project to do and it would make my day. Plus I could put glowing plants in my Xtra Plants mod for all of you folks to play with.

Berengar

I see an jungle, with never ending night.. but glowing plants... and small biests that creeps around in the shadows... :D


Igabod

Hmm it seems my programmer trap isn't working. I need better bait. I will send a shiny new American nickel in the mail to any programmer who takes up this challenge!

skullywag

If its just a terrain gen thing why not just use a building? Do you NEED it to be a plant is basically what im asking? Do they need to be plantable?
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Igabod

#4
Quote from: skullywag on January 02, 2015, 12:17:57 PM
If its just a terrain gen thing why not just use a building? Do you NEED it to be a plant is basically what im asking? Do they need to be plantable?

It would be preferable to be an actual plant that spawns and grows and dies and could be harvested. That way it leaves the possibility of a plant that provides some sort of resource being a glowing plant. The omni-gel plant in Miscellaneous in particular would be neat to see emitting a small faint glow. Pretty much any plant that isn't exactly a copy of an earth-born plant would be more interesting if it glowed. I would also like to maybe do a complete overhaul of the plants (including grass) that turns Rimworld into Gloworld. That would of course be a separate mod from my Xtra Plants mod and would purely be aesthetic. But it's something I've thought about a lot lately.

[edit to add] Also, maybe it could find some use in your Purple Ivy mod.

unifex

Tried and failed to get any kind of glow on my fungi. Perhaps an addition might be a PlantWithComps that supported the CompGlower and integrated with the GlowerGrid stuff. I tried to hack around it all but ended up not getting anywhere (well, I made some fungi that wave in the wind).

Rikiki

Work in progress but shhh, it's a secret 8)
Thanks for the ideaIgabod! :D


Igabod

awesome! and they are actual working plants that grow and die and can be harvested? Can't wait to see it and use it on my xtra plants mod!

Rikiki

In fact, I am working on my own small mod. ;)
I will provide you the way to design your own glowing plants in it (a small dll is necessary as usual). :)

unifex

#9
I've gone with a little kludge for now:


public class GlowingFungi : Fungi {

    protected Thing blankGlower;

    public override void SpawnSetup()
    {
    base.SpawnSetup();
    blankGlower = GenSpawn.Spawn(ThingDef.Named("BlankGlower"), this.Position);
    }
   
public override void DeSpawn()
{
base.DeSpawn();
if (blankGlower != null) {
blankGlower.Destroy(DestroyMode.Vanish);
}
}
}


and the blank glower looks like:


    <ThingDef>
        <defName>BlankGlower</defName>
        <category>Ethereal</category>
        <selectable>false</selectable>
        <drawerType>MapMeshAndRealTime</drawerType>
        <eType>BuildingComplex</eType>
        <label></label>
        <description></description>
        <thingClass>Building</thingClass>
        <graphicPath>Items/Blank</graphicPath>
        <graphicClass>Graphic_Single</graphicClass>
        <altitudeLayer>Floor</altitudeLayer>
        <statBases>
            <MaxHealth>50</MaxHealth>
        </statBases>
        <graphicOverdraw>false</graphicOverdraw>
        <menuHidden>True</menuHidden>
        <passability>Standable</passability>
        <hasInteractionCell>False</hasInteractionCell>
        <itemSurface>False</itemSurface>
        <rotatable>False</rotatable>
        <comps>
            <li>
                <compClass>CompGlower</compClass>
                <glowRadius>2</glowRadius>
                <glowColor>(64,64,64,0)</glowColor>
            </li>
        </comps>
    </ThingDef>


I might just go with defining different blank glowers and using as needed. Mine's got the particular side effect atm that the fungi won't grow now as its no longer in darkness, but the little fungi bud still provides light.

[attachment deleted due to age]

Rikiki

I used the same principle but with a custom glower component which does not need power.
Have you tried to plant your fungi away from a power net? ;)

Igabod

Quote from: Rikiki on January 05, 2015, 02:45:07 AM
In fact, I am working on my own small mod. ;)
I will provide you the way to design your own glowing plants in it (a small dll is necessary as usual). :)

That's cool, I'm glad I could inspire you to make a glowing plants mod. Even if I wasn't planning on snagging your code and having my way with it I'd be excited that someone is making glowing plants. Every alien planet needs at least some sort of glowing flora and fauna or it just isn't alien enough.

unifex

Quote from: Rikiki on January 05, 2015, 07:12:07 AM
I used the same principle but with a custom glower component which does not need power.
Have you tried to plant your fungi away from a power net? ;)

Yep seems to work fine, I think a CompGlower will default to 'Lit' in the absence of a CompPower thing. I haven't tried lobbing a grenade on it though to see if the invisible glowers can be destroyed.

Rikiki

Just add this line to your glower building def <useStandardHealth>False</useStandardHealth> and it will not be destructible. :)

You are right for the parent:

if (this.parent.TryGetComp<CompPower>() == null)
{
   this.Lit = true;
}

unifex

Did the trick thanks (I thought that might make the code start to look for body parts and healthdiffs so I haven't played with that).