Skip to content

Instantly share code, notes, and snippets.

@alxhub
Forked from anonymous/Solar Science
Last active August 29, 2015 14:08
Show Gist options
  • Save alxhub/bb009a1ee7761bbf460c to your computer and use it in GitHub Desktop.
Save alxhub/bb009a1ee7761bbf460c to your computer and use it in GitHub Desktop.
//Make sure we're using all available stuff
using System;
using UnityEngine;
namespace PraiseTheSun
{
//Inherit ModuleScienceExperiment stuff
public class SolarExperiment : ModuleScienceExperiment{
// Check if you're around the Sun, and check height from the Surface, then post the m
public bool checkBody() {
if (vessel.mainBody.name == "Sun" && vessel.heightFromSurface <= 10000000d)
return true;
ScreenMessages.PostScreenMessage("This experiment only operates around Kerbol!", 3, ScreenMessageStyle.UPPER_CENTER);
return false;
}
// If deploying an Experiment, check the boolean and act accordingly
new public void DeployExperiment() {
if(checkBody())
base.DeployExperiment();
}
// If doing an action, check the boolean and act accordingly
new public void DeployAction(KSPActionParam p) {
if(checkBody())
base.DeployAction(p);
}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment