Example #1
0
        void VesselRecovered(ProtoVessel pv, bool b)
        {
            // note: this is called multiple times when a vessel is recovered

            // for each crew member
            foreach (ProtoCrewMember c in pv.GetVesselCrew())
            {
                // avoid creating kerbal data in db again,
                // as this function may be called multiple times
                if (!DB.ContainsKerbal(c.name))
                {
                    continue;
                }

                // set roster status of eva dead kerbals
                if (DB.Kerbal(c.name).eva_dead)
                {
                    c.rosterStatus = ProtoCrewMember.RosterStatus.Dead;
                }

                // reset kerbal data of recovered kerbals
                DB.RecoverKerbal(c.name);
            }

            // purge the caches
            ResourceCache.Purge(pv);
            Cache.PurgeVesselCaches(pv);
        }
Example #2
0
 // disable or re-enable all rules for the specified kerbal
 public static void DisableKerbal(string k_name, bool disabled)
 {
     if (!DB.ContainsKerbal(k_name))
     {
         return;
     }
     DB.Kerbal(k_name).disabled = disabled;
 }
Example #3
0
 // kill a kerbal, even an EVA one
 public static void Kill(Vessel v, ProtoCrewMember c)
 {
     if (!v.KerbalismData().IsSimulated)
     {
         return;
     }
     if (!DB.ContainsKerbal(c.name))
     {
         return;
     }
     Misc.Kill(v, c);
 }
Example #4
0
 // trigger an undesiderable event for the kerbal specified
 public static void Breakdown(Vessel v, ProtoCrewMember c)
 {
     if (!Cache.VesselInfo(v).is_valid)
     {
         return;
     }
     if (!DB.vessels.ContainsKey(Lib.RootID(v)))
     {
         return;
     }
     if (!DB.ContainsKerbal(c.name))
     {
         return;
     }
     Misc.Breakdown(v, c);
 }
Example #5
0
        // inject instant radiation dose to the specified kerbal (can use negative amounts)
        public static void InjectRadiation(string k_name, double amount)
        {
            if (!DB.ContainsKerbal(k_name))
            {
                return;
            }
            KerbalData kd = DB.Kerbal(k_name);

            foreach (Rule rule in Profile.rules)
            {
                if (rule.modifiers.Contains("radiation"))
                {
                    RuleData rd = kd.rules[rule.name];
                    rd.problem = Math.Max(rd.problem + amount, 0.0);
                }
            }
        }