Jump to content

Anyone know hoto get the status of the EVA headlamp?


Recommended Posts

So has anyone messed with kerbalEVA and know about the headlamp.

Trying to get the headlamp status but can't seem to get it to work.

I found a gameobject headlamp

and

a bool lampOn

Just can't figure out how to use them.....

Link to comment
Share on other sites

What's the problem, exactly? KerbalEVA.lampOn seems to work exactly as you'd expect. Here's a snippet:

[KSPAddon(KSPAddon.Startup.Flight, false)]
public class LightChecker : MonoBehaviour
{
private bool lastStatus = false;

void Update()
{
if (FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel.isEVA)
{
KerbalEVA evaPm = FlightGlobals.ActiveVessel.FindPartModulesImplementing<KerbalEVA>().Single();

if (evaPm.lampOn != lastStatus)
{
lastStatus = evaPm.lampOn;

ScreenMessages.PostScreenMessage(string.Format("You turned {0} the lights!", evaPm.lampOn ? "on" : "off"), 3f, ScreenMessageStyle.LOWER_CENTER);
}
}
}
}

Link to comment
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.

×
×
  • Create New...