pizzaoverhead

[1.0.x] BatteryIndicator (2015-02-09)

Recommended Posts

This is awesome! A quick question. In looking at the code, it seems that the plugin changes the color of ANY part that has a material with the string "light" in its name. Is that true, or is this somehow strictly limited to the Kerbal battery? If not, you may run into conflicts with other parts mods that happen to have that string in their material name. Thanks much for the mod,

Lee

Share this post


Link to post
Share on other sites
This is awesome! A quick question. In looking at the code, it seems that the plugin changes the color of ANY part that has a material with the string "light" in its name. Is that true, or is this somehow strictly limited to the Kerbal battery? If not, you may run into conflicts with other parts mods that happen to have that string in their material name. Thanks much for the mod,

Lee

It's a part module, so only to parts that have the part module added. :)

Share this post


Link to post
Share on other sites

any chance we will see this hosted on Kerbal Stuff in the future?

I was going to add this wonderful mod to the CKAN repository, But I got no clue what im doing and im not sure if you even can via the current hosts.

anyways just curious if that was something we may see in the future :P:)

Share this post


Link to post
Share on other sites
I was going to add this wonderful mod to the CKAN repository

Not for nothing, but from what I understand this basically sums up the intense love-hate thing that CKAN has inspired.

Share this post


Link to post
Share on other sites
Not for nothing, but from what I understand this basically sums up the intense love-hate thing that CKAN has inspired.

O.o I don't get it.

Apparently i have been away from the forums too long lol.

What is the issue with CKAN? It still credits authors, links directly to them, it just simplifies the process for everyone else? seems like a win win to me?

EDIT: Actually just PM me. Best to not hijack the thread with this :)

Edited by Trollsama
extra note

Share this post


Link to post
Share on other sites

IMHO, the only thing that could make this mod better, is if you could somehow add the same Light thing to all the other batteries. Sure, it might look weird sticking out of the inline ones, but that would be acceptable.. There are spots on the larger batteries, that would be perfect places to mount such a light. Of course doing that would probably require editing their models or something.. So no big deal for now.

Also, don't let the mod get bogged down by all sorts of in-game configurable settings.. The beauty of mods like this, is sometimes their simplicity. It's the reason I personally haven't used any other battery-mods, until this one.

If people REALLY want a color-blind option, it could simply be an option in the cfg file. Frankly, I REALLY like the current default colors, and wouldn't want it any other way. heh Just my opinion..

Share this post


Link to post
Share on other sites
IMHO, the only thing that could make this mod better, is if you could somehow add the same Light thing to all the other batteries. Sure, it might look weird sticking out of the inline ones, but that would be acceptable.. There are spots on the larger batteries, that would be perfect places to mount such a light. Of course doing that would probably require editing their models or something.. So no big deal for now.

Also, don't let the mod get bogged down by all sorts of in-game configurable settings.. The beauty of mods like this, is sometimes their simplicity. It's the reason I personally haven't used any other battery-mods, until this one.

If people REALLY want a color-blind option, it could simply be an option in the cfg file. Frankly, I REALLY like the current default colors, and wouldn't want it any other way. heh Just my opinion..

The Z-4K has a light. At the very least it should support that one too. Great mod!

Share this post


Link to post
Share on other sites

Just a heads up and a ~bump~ for a simple mod I can't seem to live without...

Working fine for 1.0!!

*goes forth creating resource scanners using lots of Z-100 batteries*

:sticktongue:

Share this post


Link to post
Share on other sites
Just a heads up and a ~bump~ for a simple mod I can't seem to live without...

Working fine for 1.0!!

*goes forth creating resource scanners using lots of Z-100 batteries*

:sticktongue:

Thanks! Enjoy!

Share this post


Link to post
Share on other sites

Another bump and rep from me. Cant believe this has sunk 3 pages overnight (apologies for necro'ing:D)

Seeing as charge drains equally from all batteries (still, I think) you can hide all the big ones and just have the Z-100 visible showing the charge for the whole craft.

Just saved me from an embarrassing episode with a plane on a looong re-entry glide under SAS. Managed to squirt the engines just long enough to generate some charge before it was too late.

Share this post


Link to post
Share on other sites

The Z-100 is a great indication of the status of your craft, particularly in 1.00. Their low heat tolerance means they'll let you know your craft is in danger by exploding before anything else can.

Share this post


Link to post
Share on other sites

Do you, good sir, plan to expand this, perhaps by overlaying a 2d emissive led-looking circle on the radial textures of inline batteries?

Share this post


Link to post
Share on other sites
Great idea! That was something I had no idea how to do until my recent work on Free IVA, so it's a possibility for future!

So a battery indicator is the humble beginning of FreeIVA? Wow, didn't realize :v

Share this post


Link to post
Share on other sites

Hi, I like this a lot. Great idea!

I have tweaked my version a bit to get a continuous colour change between 90% and 10%, so it fades through yellow and orange in tiny steps.

        public void FixedUpdate()
        {
            if (lightMat != null && electricCharge != null)
            {
                float percentRemaining = ((float)(electricCharge.amount / electricCharge.maxAmount) * 100);
                Color indicatorColour;

                if (percentRemaining > threshHigh)
                {
                    indicatorColour = new Color(0.098f, 0.961f, 0f, 1f); // Stock green.
                }
                else if (percentRemaining > threshLow)
                {
                    float fraction = percentRemaining / 100f;
                    indicatorColour = new Color(Mathf.Lerp(1.0f, 0.1f, fraction), Mathf.Lerp(0.1f, 0.96f, fraction), 0.0f, 1f);
                }
                else if (percentRemaining > 0.5) // The battery may not be able to be drained entirely.
                {
                    indicatorColour = Color.red;
                }
                else
                {
                    indicatorColour = Color.black;
                }

                lightMat.color = indicatorColour;
            }
        }

threshHigh and threshLow are 90 and 10, obvs.

Just putting it out there. :)

Share this post


Link to post
Share on other sites
On 15. 1. 2016 at 9:48 AM, Darkona said:

Hello all,

A little bit of necro posting just to let you know I made a little update to this mod:

Kerbalstuff

Hey, since Kerbalstuff is down, could you please reupload it somewhere else? :( Not even CKAN works (it tries to download from Kerbalstuff too)

Share this post


Link to post
Share on other sites

Excellent. Now if someone could alter the source and add the option to define the resource in the part.cfg, then it can work with everything.

MODULE
	{
		name = BatteryIndicator
		cautionPercentage = 40
		warnPercentage = 10
		ResourceName = MyFavouriteBeverage
	}	
RESOURCE
	{
		name = MyFavouriteBeverage
		amount = 100
		maxAmount = 100
	}
	

 

Edited by Azimech

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.