Exemplo n.º 1
0
    // Simple system to prevent some experiments from being run in places they can't be ran.
    public bool canrunexperiment(Vessel vessel, SkyLabExperimentData node, ref string msg)
    {
        msg = "Vessel must be (one of): ";
        if (node.landed)
        {
            if (vessel.situation == Vessel.Situations.LANDED)
            {
                return(true);
            }
            msg += "landed, ";
        }

        if (node.splashed)
        {
            if (vessel.situation == Vessel.Situations.SPLASHED)
            {
                return(true);
            }
            msg += "splashed down, ";
        }

        if (node.flying)
        {
            if (vessel.altitude <= vessel.orbit.referenceBody.atmosphereDepth)
            {
                return(true);
            }
            msg += "flying, ";
        }

        if (node.space)
        {
            if (vessel.altitude > vessel.orbit.referenceBody.atmosphereDepth)
            {
                return(true);
            }
            msg += "in space, ";
        }
        msg = msg.Remove(msg.Length - 2);
        return(false);
    }
Exemplo n.º 2
0
        public void DoScienceThing(SkyLabExperimentData node)
        {
            string msg = "";

            if (CheckBoring(vessel, true))
            {
                return;
            }

            if (!CanRunExperiment(vessel, node, ref msg))
            {
                Util.DisplayScreenMsg("You can't run that experiment right now!\n" + msg);
                return;
            }

            if (LtsUseResources("Insight", node.ReqInsight))
            {
                if (LtsUseResources(node.ReqResource, node.ReqAmount))
                {
                    experimentID  = node.Id;
                    experiment.id = node.Id;
                    experiment.experimentTitle = specialExperimentTitle.Replace("#Exp#", node.Name);
                    experiment.baseValue       = node.ScienceValue;
                    experiment.scienceCap      = node.ScienceCap;
                    experiment.dataScale       = node.DataScale;
                    base.DeployExperiment();
                }
                else
                {
                    Util.DisplayScreenMsg("Need " + node.ReqAmount + " " + node.ReqResource + "!");
                }
            }
            else
            {
                Util.DisplayScreenMsg("Need " + node.ReqInsight + " Insight!");
            }
        }
Exemplo n.º 3
0
    public void DoScienceThing(SkyLabExperimentData node)
    {
        string msg = "";

        if (checkBoring(vessel, true))
        {
            return;
        }

        if (!canrunexperiment(vessel, node, ref msg))
        {
            ScreenMessages.PostScreenMessage("You can't run that experiment right now!\n" + msg, 6, ScreenMessageStyle.UPPER_CENTER);
            return;
        }

        if (LTSUseResources("Insight", node.ReqInsight))
        {
            if (LTSUseResources(node.ReqResource, node.ReqResAmount))
            {
                base.experimentID  = specialExperimentName + node.Name;
                base.experiment.id = specialExperimentName + node.Name;
                base.experiment.experimentTitle = specialExperimentTitle.Replace("#Exp#", node.DisplayName);
                base.experiment.baseValue       = node.ScienceVal;
                base.experiment.dataScale       = node.DataScale;
                base.DeployExperiment();
            }
            else
            {
                ScreenMessages.PostScreenMessage("Need: " + node.ReqResAmount + " of " + node.ReqResource + "!", 6, ScreenMessageStyle.UPPER_CENTER);
            }
        }
        else
        {
            ScreenMessages.PostScreenMessage("Need: " + node.ReqInsight + " of Insight!", 6, ScreenMessageStyle.UPPER_CENTER);
        }
    }