예제 #1
0
 /// <summary>
 /// Checks to see if the object that just got melted is a POI object.
 ///
 /// Destroys the object before returning.
 /// </summary>
 /// <param name="obj">The object that just melted, before the melt actually completes.</param>
 private static void CheckAndDestroy(GameObject obj)
 {
     if (obj != null)
     {
         if (Achievements.POI_PROPS.Contains(obj.PrefabID().Name))
         {
             AchievementStateComponent.Trigger(AchievementStrings.WATCHTHEWORLDBURN.ID);
         }
         Util.KDestroyGameObject(obj);
     }
 }
예제 #2
0
            /// <summary>
            /// Applied after Discover runs.
            /// </summary>
            internal static void Postfix(Tag tag)
            {
                var neutronium = ElementLoader.FindElementByHash(SimHashes.Unobtanium);

                if (neutronium != null && tag.Equals(neutronium.tag))
                {
                    // I See What You Did There
                    AchievementStateComponent.Trigger(AchievementStrings.ISEEWHATYOUDIDTHERE.
                                                      ID);
                }
            }
예제 #3
0
            /// <summary>
            /// Applied after OnStartWork runs.
            /// </summary>
            internal static void Postfix(Clinic __instance, Worker worker)
            {
                var building = __instance.gameObject.GetComponentSafe <Building>();
                var hp       = Db.Get().Amounts.HitPoints.Lookup(worker);

#if DEBUG
                if (hp != null)
                {
                    PUtil.LogDebug("Reached clinic with {0:F2} left".F(hp.value));
                }
#endif
                if (building != null && building.Def.PrefabID == MedicalCotConfig.ID && hp !=
                    null && hp.value <= AchievementStrings.SAVINGMEEP.THRESHOLD)
                {
                    AchievementStateComponent.Trigger(AchievementStrings.SAVINGMEEP.ID);
                }
            }
예제 #4
0
        /// <summary>
        /// Checks the remaining breath of the Duplicant when they reach oxygen.
        /// </summary>
        /// <param name="smi">The state machine instance controlling breath recovery.</param>
        private static void CheckBreath(RecoverBreathChore.StatesInstance smi)
        {
            var dupe = smi.sm.recoverer.Get(smi);

            if (dupe != null)
            {
                // How long until that dupe would have suffocated?
                var instance  = Db.Get().Amounts.Breath.Lookup(dupe);
                var breathSMI = dupe.GetSMI <SuffocationMonitor.Instance>();
                if (instance != null && breathSMI != null)
                {
                    float delta = instance.GetDelta();
#if DEBUG
                    PUtil.LogDebug("Reached air with {0:F2} left".F(instance.value));
#endif
                    if (delta != 0.0f && instance.value / Mathf.Abs(delta) <
                        AchievementStrings.FINALBREATH.THRESHOLD)
                    {
                        AchievementStateComponent.Trigger(AchievementStrings.FINALBREATH.
                                                          ID);
                    }
                }
            }
        }