Exemplo n.º 1
0
 public static void FindKnockBackStrength_Postfix(float strength, ref float __result)
 {
     if (BMChallenges.IsChallengeFromListActive(cChallenge.Knockback))
     {
         __result *= BMCombat.GetGlobalKnockBackMultiplier();
     }
 }
Exemplo n.º 2
0
        public static bool RandomSelect_Prefix(string rName, string rCategory, ref string __result)
        {
            if (rName.StartsWith("FireSpewerSpawnChance") && BMChallenges.IsChallengeFromListActive(cChallenge.WallsFlammable))
            {
                __result = "No";

                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public static bool UpdateFire_Prefix(Fire __instance)
        {
            float lifetime      = 10f;
            float spreadTime    = 5f;
            float generationCap = 6;

            if (BMChallenges.IsChallengeFromListActive(cChallenge.AffectsFires))
            {
                if (GC.challenges.Contains(cChallenge.NapalmSprings))
                {
                    lifetime      = 20f;
                    spreadTime    = 15f;
                    generationCap = 99f;
                }
                else if (GC.challenges.Contains(cChallenge.Mildfire))
                {
                    lifetime      = 6f;
                    spreadTime    = 3f;
                    generationCap = 2;
                }

                if (GC.challenges.Contains(cChallenge.GasolineHumidity))
                {
                    spreadTime = lifetime - 2f;
                }
            }

            if (GC.serverPlayer)
            {
                if (!__instance.hasBurningObject && !__instance.noObject)
                {
                    __instance.timeLeft = 0f;

                    if (!__instance.destroying)
                    {
                        try
                        {
                            __instance.DestroyMe();
                        }
                        catch
                        {
                            Debug.LogError(string.Concat(new object[] { "Fire DestroyMe Error 1: ", __instance, " - ", __instance.UID }));
                        }
                    }
                }

                if (__instance.timeLeft <= 0f)
                {
                    goto IL_460;
                }

                if (__instance.burningObjectAgent && __instance.hasObjectAgent)
                {
                    try
                    {
                        __instance.objectAgent.tr.position = __instance.tr.position;
                    }
                    catch { }
                }

                __instance.timeLeft        -= Time.deltaTime;
                __instance.timeToOilSpread -= Time.deltaTime;

                if (__instance.timeLeft <= spreadTime && !__instance.fireHasSpread && __instance.canSpread)
                {
                    try
                    {
                        if (__instance.generation < generationCap && GC.serverPlayer)
                        {
                            __instance.StartCoroutine(__instance.FireSpread());
                        }

                        __instance.fireHasSpread = true;
                    }
                    catch
                    {
                        Debug.LogError(string.Concat(new object[] { "Fire Spread Error 1: ", __instance, " - ", __instance.UID }));
                    }
                }

                if (__instance.timeLeft <= spreadTime && __instance.neverGoOut)
                {
                    __instance.timeLeft = lifetime;
                }

                if (__instance.timeLeft <= spreadTime && __instance.oilFireTime > 0)
                {
                    __instance.oilFireTime--;
                    __instance.timeLeft = lifetime;
                }

                if (__instance.timeLeft <= 0f && !__instance.destroying)
                {
                    try
                    {
                        __instance.DestroyMe();

                        goto IL_460;
                    }
                    catch
                    {
                        Debug.LogError(string.Concat(new object[] { "Fire DestroyMe Error 2: ", __instance, " - ", __instance.UID }));

                        if (__instance.particles != null)
                        {
                            __instance.particles.GetComponent <ParticleSystem>().Stop();
                            __instance.particles.transform.SetParent(GC.particleEffectsNest.transform);
                        }

                        GC.firesList.Remove(__instance);
                        Object.Destroy(__instance.gameObject);

                        return(false);
                    }
                }

                if (__instance.timeToOilSpread > 0f || __instance.hasSpreadOil)
                {
                    goto IL_460;
                }

                try
                {
                    __instance.timeToOilSpread = __instance.timeToOilSpreadBase;
                    __instance.FireSpreadOil();
                    __instance.hasSpreadOil = true;

                    goto IL_460;
                }
                catch
                {
                    Debug.LogError(string.Concat(new object[] { "Fire Spread Error 2: ", __instance, " - ", __instance.UID }));

                    if (__instance.particles != null)
                    {
                        __instance.particles.GetComponent <ParticleSystem>().Stop();
                        __instance.particles.transform.SetParent(GC.particleEffectsNest.transform);
                    }

                    GC.firesList.Remove(__instance);
                    Object.Destroy(__instance.gameObject);

                    return(false);
                }
            }

            if (!__instance.clientDestroyed && __instance.destroying)
            {
                try
                {
                    __instance.clientDestroyed = true;
                    __instance.DestroyMe();

                    goto IL_460;
                }
                catch
                {
                    Debug.LogError(string.Concat(new object[] { "Fire DestroyMe Error 3: ", __instance, " - ", __instance.UID }));

                    goto IL_460;
                }
            }

            if (!GC.serverPlayer && !__instance.destroying && __instance.burningObject != null)
            {
                try
                {
                    if (__instance.burningObjectAgent || __instance.burningObjectItem)
                    {
                        __instance.tr.position = new Vector3(__instance.burningObject.transform.position.x,
                                                             __instance.burningObject.transform.position.y - 0.1f, __instance.burningObject.transform.position.z);
                    }
                    else
                    {
                        __instance.tr.position = __instance.burningObject.transform.position;
                    }
                }
                catch
                {
                    Debug.LogError(string.Concat(new object[] { "Fire Transform Error: ", __instance, " - ", __instance.burningObject }));
                }
            }

IL_460:
            if (__instance.tr.eulerAngles != Vector3.zero)
            {
                __instance.tr.eulerAngles = Vector3.zero;
            }

            return(false);
        }