Decompiled source of Hemorrhage v1.0.0
Mods/FordBlood.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib.BoneMenu; using FordBlood; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Core), "FordBlood", "1.0.0", "You", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("FordBlood")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FordBlood")] [assembly: AssemblyTitle("FordBlood")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FordBlood { internal class Stain { public GameObject go; public Transform tr; public MeshFilter mf; public MeshRenderer mr; public float born; public int stage; public Puddle owner; } internal class Puddle { public Vector3 c; public Vector3 n; public Vector3 px; public Vector3 py; public float area; public float probeR; public float off; public float[] noise = new float[16]; public float[] cur = new float[16]; public float[] lim = new float[16]; public float[] goal = new float[16]; public bool needProbe = true; public bool goalDirty = true; public bool dirty = true; public Stain st; public Mesh mesh; } internal class Pool { public int cap = 400; private readonly Queue<Stain> q = new Queue<Stain>(); public IEnumerable<Stain> All => q; public Stain Acquire(Mesh mesh, Material mat) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown Stain stain = null; while (q.Count >= cap && q.Count > 0) { Stain stain2 = q.Dequeue(); if (stain2.owner != null) { Core.puddles.Remove(stain2.owner); if ((Object)(object)stain2.owner.mesh != (Object)null) { Object.Destroy((Object)(object)stain2.owner.mesh); } stain2.owner = null; } if (!((Object)(object)stain2.go == (Object)null)) { if (stain == null) { stain = stain2; } else { Object.Destroy((Object)(object)stain2.go); } } } if (stain == null) { stain = new Stain(); stain.go = new GameObject("FB_stain"); stain.tr = stain.go.transform; stain.mf = stain.go.AddComponent<MeshFilter>(); stain.mr = stain.go.AddComponent<MeshRenderer>(); ((Renderer)stain.mr).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)stain.mr).receiveShadows = false; } stain.go.SetActive(true); stain.mf.sharedMesh = mesh; ((Renderer)stain.mr).sharedMaterial = mat; stain.born = Time.time; stain.stage = 0; q.Enqueue(stain); return stain; } public void Clear() { foreach (Stain item in q) { if ((Object)(object)item.go != (Object)null) { Object.Destroy((Object)(object)item.go); } } q.Clear(); } } internal class Wound { public Transform bone; public Rigidbody rb; public Vector3 lp; public Vector3 ln; public float life; public float lifeMax; public float acc; public float power = 1f; } internal class Victim { public Transform root; public List<Wound> wounds = new List<Wound>(); public Rigidbody[] bodies; public float[] wet; public Vector3[] lastG; public bool[] hasG; public float nextRefresh; public float lastHit; public float acc; public Vector3 lastHitPos; public Vector3 lastPos; public bool hasPos; } internal class Drop { public Vector3 p; public Vector3 v; public float area; public float age; public float size = 1f; public float chance = 1f; public bool spray; public Victim src; } internal class Kick { public Victim v; public Wound w; public Rigidbody rb; public Vector3 pre; public Vector3 d; public float t0; public float peak; } internal class Runner { public Stain streak; public Stain bulb; public Vector3 start; public Vector3 dir; public Vector3 n; public float len; public float maxLen; public float speed; public float width; public float area; public float off; } public class Core : MelonMod { private struct HitZone { public Vector3 pos; public float until; } internal const int PV = 16; private const int Mask = -1; private static readonly QueryTriggerInteraction Ign = (QueryTriggerInteraction)1; private static readonly float[] CosT = new float[16]; private static readonly float[] SinT = new float[16]; internal static Core I; internal static readonly List<Puddle> puddles = new List<Puddle>(); private static readonly List<Drop> drops = new List<Drop>(); private static readonly List<Runner> runners = new List<Runner>(); private static readonly Dictionary<int, Victim> victims = new Dictionary<int, Victim>(); private static readonly Pool splats = new Pool(); private static readonly Pool smears = new Pool { cap = 220 }; private static readonly List<Kick> kicks = new List<Kick>(); private const float ForceRef = 1.5f; private const float KickWindow = 0.08f; private static int kickLog; private static MelonPreferences_Category cat; private static MelonPreferences_Entry<bool> eOn; private static MelonPreferences_Entry<bool> eStock; private static MelonPreferences_Entry<bool> eWalls; private static MelonPreferences_Entry<bool> eSmear; private static MelonPreferences_Entry<bool> eAll; private static MelonPreferences_Entry<bool> eAging; private static MelonPreferences_Entry<string> eFilter; private static MelonPreferences_Entry<float> eBleed; private static MelonPreferences_Entry<float> eSpurt; private static MelonPreferences_Entry<float> ePudMax; private static MelonPreferences_Entry<float> eMax; private static MelonPreferences_Entry<float> eBright; private static readonly Material[] mats = (Material[])(object)new Material[3]; private static Material dropMat; private static Mesh[] blobs; private static Mesh streakMesh; private static Mesh dropMesh; private static bool ready; private static bool hooked; private static bool hookQueued; private static bool menuBuilt; private static int offCtr; private static int errCount; private static float ageTimer; private static float statusTimer; private static int landLog; private static int resetLog; private const BindingFlags BF = BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static float lastShotTime = -99f; private static Vector3 shotPos; private static Vector3 shotDir = Vector3.forward; private static int dbg; private static int dbgHit; private static int dbgNoShot; private static readonly List<Transform> stockCache = new List<Transform>(); private static float stockCacheTime = -99f; private static int cacheLog; private static int sweepLog; private static readonly List<HitZone> zones = new List<HitZone>(); private const float ZoneTime = 0.9f; private const float ZoneRadius2 = 2.25f; private const int MaxZones = 8; private static readonly Color[] palette = (Color[])(object)new Color[4] { new Color(0.25f, 0.005f, 0.007f), new Color(0.14f, 0.004f, 0.006f), new Color(0.07f, 0.008f, 0.006f), new Color(0.27f, 0.006f, 0.008f) }; private static readonly float[] gloss = new float[4] { 0.92f, 0.8f, 0.45f, 0.95f }; public override void OnInitializeMelon() { I = this; for (int i = 0; i < 16; i++) { float num = (float)i * ((float)Math.PI * 2f) / 16f; CosT[i] = Mathf.Cos(num); SinT[i] = Mathf.Sin(num); } cat = MelonPreferences.CreateCategory("FordBlood"); eOn = cat.CreateEntry<bool>("Enabled", true, "Enabled", (string)null, false, false, (ValueValidator)null, (string)null); eFilter = cat.CreateEntry<string>("NameFilter", "Ford", "Name filter (comma separated)", (string)null, false, false, (ValueValidator)null, (string)null); eAll = cat.CreateEntry<bool>("AllNpcs", false, "Affect every NPC", (string)null, false, false, (ValueValidator)null, (string)null); eStock = cat.CreateEntry<bool>("SuppressStockBlood", true, "Suppress stock blood", (string)null, false, false, (ValueValidator)null, (string)null); eWalls = cat.CreateEntry<bool>("WallBlood", true, "Blood on walls", (string)null, false, false, (ValueValidator)null, (string)null); eSmear = cat.CreateEntry<bool>("Smearing", true, "Smearing", (string)null, false, false, (ValueValidator)null, (string)null); eAging = cat.CreateEntry<bool>("ColorAging", true, "Blood color changes over time", (string)null, false, false, (ValueValidator)null, (string)null); eBleed = cat.CreateEntry<float>("BleedAmount", 1f, "Bleed amount", (string)null, false, false, (ValueValidator)null, (string)null); eSpurt = cat.CreateEntry<float>("SpurtStrength", 1f, "Spurt strength", (string)null, false, false, (ValueValidator)null, (string)null); ePudMax = cat.CreateEntry<float>("PuddleMaxRadius", 0.9f, "Puddle max radius (m)", (string)null, false, false, (ValueValidator)null, (string)null); eMax = cat.CreateEntry<float>("MaxStains", 700f, "Max stains", (string)null, false, false, (ValueValidator)null, (string)null); eBright = cat.CreateEntry<float>("BloodBrightness", 1f, "Blood brightness", (string)null, false, false, (ValueValidator)null, (string)null); } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { if (!hooked && !hookQueued) { hookQueued = true; MelonCoroutines.Start(DelayedHook()); } if (!menuBuilt) { TryMenu(); } MelonCoroutines.Start(PrewarmStock()); } private static IEnumerator PrewarmStock() { float t = 0f; while (t < 10f) { t += Time.deltaTime; yield return null; } try { if (eStock != null && eStock.Value) { RefreshStockCache(force: true); } } catch (Exception e) { Err("prewarm", e); } } private static IEnumerator DelayedHook() { float t = 0f; while (t < 8f) { t += Time.deltaTime; yield return null; } try { I.TryHook(unused: false); } catch (Exception e) { Err("delayed hook", e); } } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { ResetAll(); } private static void Log(string s) { try { ((MelonBase)I).LoggerInstance.Msg(s); } catch { } } private static void Err(string where, Exception e) { if (errCount++ < 25) { try { ((MelonBase)I).LoggerInstance.Warning("[" + where + "] " + e.GetType().Name + ": " + e.Message); } catch { } } } private void TryHook(bool unused) { try { int num = PatchHooks(); hooked = num >= 2; Log(hooked ? "Hooks ready." : ("Only " + num + "/2 hooks found. Send me this log.")); } catch (Exception e) { Err("hook", e); } } private int PatchHooks() { return 0 + PatchOne("Il2CppSLZ.Marrow.PuppetMasta.MuscleCollisionBroadcaster", "ReceiveAttack", 1, "OnHit", asPrefix: false) + PatchOne("Il2CppSLZ.Marrow.Gun", "Fire", 0, "OnFire", asPrefix: true); } private int PatchOne(string typeName, string method, int paramCount, string hookName, bool asPrefix) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown try { Type type = AccessTools.TypeByName(typeName); if (type == null) { Log("type not found: " + typeName); return 0; } MethodInfo methodInfo = null; MethodInfo[] methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo2 in methods) { if (methodInfo2.Name == method && !methodInfo2.IsAbstract && methodInfo2.GetParameters().Length == paramCount) { methodInfo = methodInfo2; break; } } if (methodInfo == null) { Log("method not found: " + typeName + "." + method); return 0; } HarmonyMethod val = new HarmonyMethod(typeof(Core).GetMethod(hookName, BindingFlags.Static | BindingFlags.NonPublic)); if (asPrefix) { ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Log("hooked " + typeName + "." + method); return 1; } catch (Exception e) { Err("patch " + typeName, e); return 0; } } private static object Get(object o, params string[] names) { if (o == null) { return null; } Type type = o.GetType(); foreach (string name in names) { try { FieldInfo field = type.GetField(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(o); } } catch { } try { PropertyInfo property = type.GetProperty(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.GetIndexParameters().Length == 0) { return property.GetValue(o); } } catch { } } return null; } private static void OnFire(Component __instance) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) try { if (eOn != null && eOn.Value && !((Object)(object)__instance == (Object)null)) { object obj = Get(__instance, "firePointTransform", "firePoint", "muzzle"); Transform val = (Transform)((obj is Transform) ? obj : null); if (dbg < 3) { dbg++; Log("shot seen, fire point " + (((Object)(object)val != (Object)null) ? "found" : "NOT found (using gun transform)")); } if ((Object)(object)val == (Object)null) { val = __instance.transform; } lastShotTime = Time.time; shotPos = val.position; shotDir = val.forward; } } catch (Exception e) { Err("OnFire", e); } } private static void Why(string s) { if (dbgHit <= 12) { Log(" skipped: " + s); } } private static void OnHit(Component __instance) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) try { if (eOn == null || !eOn.Value || (Object)(object)__instance == (Object)null) { return; } float num = Time.time - lastShotTime; if (num > 1.2f) { if (dbgNoShot < 3) { dbgNoShot++; Log("limb hit ignored (no shot in the last 1.2s)"); } return; } if (dbgHit < 12) { dbgHit++; Log("limb hit: " + PathOf(__instance.transform) + " | seconds since last shot: " + num.ToString("0.00")); } Transform val = FindRoot(__instance.transform); if ((Object)(object)val == (Object)null) { Why("name has no match for the filter '" + eFilter.Value + "'"); return; } Collider val2 = __instance.GetComponent<Collider>(); if ((Object)(object)val2 == (Object)null) { val2 = __instance.GetComponentInParent<Collider>(); } if ((Object)(object)val2 == (Object)null) { val2 = __instance.GetComponentInChildren<Collider>(); } if ((Object)(object)val2 == (Object)null) { Why("no collider on limb"); return; } Vector3 normalized = ((Vector3)(ref shotDir)).normalized; RaycastHit val3 = default(RaycastHit); Vector3 val4; Vector3 n; if (val2.Raycast(new Ray(shotPos, normalized), ref val3, 500f)) { val4 = ((RaycastHit)(ref val3)).point; n = ((RaycastHit)(ref val3)).normal; } else { Bounds bounds = val2.bounds; Vector3 center = ((Bounds)(ref bounds)).center; float num2 = Vector3.Dot(center - shotPos, normalized); if (num2 < -0.5f) { Why("limb is behind the shot"); return; } Vector3 val5 = shotPos + normalized * Mathf.Max(0f, num2); val4 = val2.ClosestPoint(val5); Vector3 val6 = val4 - val5; if (((Vector3)(ref val6)).magnitude > 0.6f) { val6 = val4 - val5; Why("shot path missed this limb by " + ((Vector3)(ref val6)).magnitude.ToString("0.00") + "m"); return; } val6 = val4 - center; n = ((Vector3)(ref val6)).normalized; if (((Vector3)(ref n)).sqrMagnitude < 1E-06f) { n = -normalized; } } if (dbgHit <= 12) { Log(" wound created"); } HandleHit(__instance, val, val2, val4, n, normalized); } catch (Exception e) { Err("OnHit", e); } } private static Transform FindRoot(Transform t) { if (eAll.Value) { return t.root; } string[] array = eFilter.Value.Split(','); Transform result = null; Transform val = t; while ((Object)(object)val != (Object)null) { string name = ((Object)val).name; string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i].Trim(); if (text.Length > 0 && name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { result = val; break; } } val = val.parent; } return result; } private static void HandleHit(Component comp, Transform root, Collider col, Vector3 p, Vector3 n, Vector3 d) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) BuildAssets(); int instanceID = ((Object)root).GetInstanceID(); if (!victims.TryGetValue(instanceID, out var value)) { value = new Victim(); value.root = root; victims[instanceID] = value; } if (Time.time - value.lastHit < 0.03f) { Vector3 val = p - value.lastHitPos; if (((Vector3)(ref val)).sqrMagnitude < 0.0004f) { return; } } value.lastHit = Time.time; value.lastHitPos = p; Transform bone = (((Object)(object)col != (Object)null) ? ((Component)col).transform : comp.transform); Wound w = AddWound(value, bone, p, n); Spray(value, p, n, d, 1f, bonus: false); QueueKick(value, w, d); if (eStock.Value) { OpenZone(p); } } private static Wound AddWound(Victim v, Transform bone, Vector3 p, Vector3 n) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (v.wounds.Count >= 24) { v.wounds.RemoveAt(0); } Wound wound = new Wound(); wound.bone = bone; wound.rb = ((Component)bone).GetComponent<Rigidbody>(); if ((Object)(object)wound.rb == (Object)null) { wound.rb = ((Component)bone).GetComponentInParent<Rigidbody>(); } wound.lp = bone.InverseTransformPoint(p); wound.ln = bone.InverseTransformDirection(n); wound.lifeMax = 28f * Mathf.Max(0.1f, eBleed.Value) * Rnd(0.8f, 1.25f); wound.life = wound.lifeMax; v.wounds.Add(wound); return wound; } private static void QueueKick(Victim v, Wound w, Vector3 d) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (w != null && !((Object)(object)w.rb == (Object)null) && kicks.Count < 24) { Kick kick = new Kick(); kick.v = v; kick.w = w; kick.rb = w.rb; kick.pre = w.rb.velocity; kick.d = d; kick.t0 = Time.time; kicks.Add(kick); } } private static void TickKicks() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) for (int num = kicks.Count - 1; num >= 0; num--) { Kick kick = kicks[num]; if ((Object)(object)kick.rb == (Object)null || kick.w == null || (Object)(object)kick.w.bone == (Object)null || !((Component)kick.w.bone).gameObject.activeInHierarchy) { kicks.RemoveAt(num); } else { float num2 = Time.time - kick.t0; Vector3 val = kick.rb.velocity - kick.pre - Physics.gravity * num2; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > kick.peak) { kick.peak = magnitude; } if (!(num2 < 0.08f)) { kicks.RemoveAt(num); float num3 = Mathf.Clamp(kick.peak / 1.5f, 0.6f, 3f); if (kickLog < 14) { kickLog++; Log("force sample: kick=" + kick.peak.ToString("0.00") + " m/s, limb mass=" + kick.rb.mass.ToString("0.0") + " -> force x" + num3.ToString("0.00")); } kick.w.power = num3; Vector3 val2 = kick.w.bone.TransformPoint(kick.w.lp); Vector3 val3 = kick.w.bone.TransformDirection(kick.w.ln); Spray(kick.v, val2 + val3 * 0.01f, val3, kick.d, num3, bonus: true); } } } } private static void Spray(Victim v, Vector3 p, Vector3 n, Vector3 d, float f, bool bonus) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) float value = eSpurt.Value; if (value <= 0.01f) { return; } float num = (bonus ? Mathf.Max(0f, f - 0.8f) : 1f); if (!(num <= 0.01f)) { if (drops.Count > 220) { num *= 0.5f; } float num2 = (bonus ? (0.8f + 0.5f * f) : 1f); float num3 = 0.35f + 0.08f * f; int num4 = Mathf.Clamp(Mathf.RoundToInt(12f * value * num), 0, 60); Vector3 val; for (int i = 0; i < num4; i++) { val = d + Random.insideUnitSphere * num3; Vector3 normalized = ((Vector3)(ref val)).normalized; float num5 = Rnd(0.8f, 1.5f); SpawnDrop(p + d * 0.02f, normalized * Rnd(1.5f, 5.5f) * num2, 0.0022f * num5, v, num5, 1f, spray: true); } int num6 = Mathf.Clamp(Mathf.RoundToInt(5f * value * num), 0, 25); for (int j = 0; j < num6; j++) { val = n + Random.insideUnitSphere * 0.55f; Vector3 normalized2 = ((Vector3)(ref val)).normalized; SpawnDrop(p + n * 0.02f, normalized2 * Rnd(0.6f, 2.6f) * num2, 0.0016f, v, 1f, 1f, spray: true); } int num7 = Mathf.Clamp(Mathf.RoundToInt(8f * value * num), 0, 40); for (int k = 0; k < num7; k++) { val = n * 0.6f + d * 0.4f + Random.insideUnitSphere * 0.9f; Vector3 normalized3 = ((Vector3)(ref val)).normalized; SpawnDrop(p + n * 0.02f, normalized3 * Rnd(0.8f, 3.5f) * num2, 0.0006f, v, 0.55f, 0.35f, spray: true); } } } private static void OpenZone(Vector3 p) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) HitZone item = new HitZone { pos = p, until = Time.time + 0.9f }; if (zones.Count >= 8) { zones.RemoveAt(0); } zones.Add(item); } private static bool IsDecalName(string nm) { if (!nm.StartsWith("Decal_Splat", StringComparison.OrdinalIgnoreCase) && !nm.StartsWith("Decal_SmallSplat", StringComparison.OrdinalIgnoreCase)) { return nm.StartsWith("AttackDecal", StringComparison.OrdinalIgnoreCase); } return true; } private static bool LooksBloody(Transform t) { int num = 0; Transform val = t; while ((Object)(object)val != (Object)null && num < 4) { string name = ((Object)val).name; if (name.StartsWith("FB_", StringComparison.Ordinal)) { return false; } if (IsDecalName(name) || name.IndexOf("Impact_Liquid", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("blood", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("gore", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("splat", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("squirt", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } val = val.parent; num++; } return false; } private static void RefreshStockCache(bool force) { if (!force && Time.time - stockCacheTime < 20f) { return; } stockCacheTime = Time.time; stockCache.Clear(); foreach (Renderer item in Object.FindObjectsOfType<Renderer>(true)) { if (!((Object)(object)item == (Object)null)) { Transform transform = ((Component)item).transform; if (LooksBloody(transform)) { stockCache.Add(transform); } } } if (cacheLog < 6) { cacheLog++; Log("stock blood objects tracked: " + stockCache.Count); } } private static void StockSweep() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (zones.Count == 0) { return; } float time = Time.time; for (int num = zones.Count - 1; num >= 0; num--) { if (zones[num].until < time) { zones.RemoveAt(num); } } if (zones.Count == 0) { return; } try { RefreshStockCache(force: false); int num2 = 0; for (int i = 0; i < stockCache.Count; i++) { Transform val = stockCache[i]; if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } Vector3 position = val.position; bool flag = false; for (int j = 0; j < zones.Count; j++) { Vector3 val2 = position - zones[j].pos; if (((Vector3)(ref val2)).sqrMagnitude <= 2.25f) { flag = true; break; } } if (!flag) { continue; } ParticleSystem component = ((Component)val).GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { if (component.isPlaying || component.particleCount > 0) { component.Stop(true, (ParticleSystemStopBehavior)0); num2++; } } else if (IsDecalName(((Object)val).name)) { ((Component)val).gameObject.SetActive(false); num2++; } } if (num2 > 0 && sweepLog < 8) { sweepLog++; Log("stock blood suppressed: " + num2 + " object(s)"); } } catch (Exception e) { Err("stock", e); } } private static Color Shade(int i) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp((eBright != null) ? eBright.Value : 1f, 0.1f, 2.5f); Color val = palette[i]; return new Color(val.r * num, val.g * num, val.b * num, 1f); } private static void Paint(Material m, Color c, float smooth) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (m.HasProperty("_Color")) { m.color = c; } if (m.HasProperty("_BaseColor")) { m.SetColor("_BaseColor", c); } if (m.HasProperty("_Smoothness")) { m.SetFloat("_Smoothness", smooth); } if (m.HasProperty("_Glossiness")) { m.SetFloat("_Glossiness", smooth); } if (m.HasProperty("_Metallic")) { m.SetFloat("_Metallic", 0f); } } private static Material Tint(Material src, Color c, float smooth) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Expected O, but got Unknown Material val = new Material(src) { hideFlags = (HideFlags)32 }; Paint(val, c, smooth); return val; } private static void ApplyColors() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) try { for (int i = 0; i < 3; i++) { if ((Object)(object)mats[i] != (Object)null) { Paint(mats[i], Shade(i), gloss[i]); } } if ((Object)(object)dropMat != (Object)null) { Paint(dropMat, Shade(3), gloss[3]); } } catch (Exception e) { Err("colors", e); } } private static bool AssetsAlive() { if (!ready || blobs == null) { return false; } if ((Object)(object)mats[0] == (Object)null || (Object)(object)mats[1] == (Object)null || (Object)(object)mats[2] == (Object)null) { return false; } if ((Object)(object)dropMat == (Object)null || (Object)(object)dropMesh == (Object)null || (Object)(object)streakMesh == (Object)null) { return false; } for (int i = 0; i < blobs.Length; i++) { if ((Object)(object)blobs[i] == (Object)null) { return false; } } return true; } private static void BuildAssets() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) if (AssetsAlive()) { return; } ready = false; string[] obj = new string[5] { "Sprites/Default", "Unlit/Color", "Universal Render Pipeline/Unlit", "Universal Render Pipeline/Lit", "Standard" }; Shader val = null; string[] array = obj; foreach (string text in array) { val = Shader.Find(text); if ((Object)(object)val != (Object)null) { Log("blood shader: " + text); break; } } Material src; if ((Object)(object)val != (Object)null) { src = new Material(val); } else { GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)5); obj2.SetActive(false); src = new Material(((Renderer)obj2.GetComponent<MeshRenderer>()).sharedMaterial); Object.Destroy((Object)(object)obj2); Log("blood shader: fallback to primitive default"); } mats[0] = Tint(src, Shade(0), gloss[0]); mats[1] = Tint(src, Shade(1), gloss[1]); mats[2] = Tint(src, Shade(2), gloss[2]); dropMat = Tint(src, Shade(3), gloss[3]); GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)0); obj3.SetActive(false); dropMesh = obj3.GetComponent<MeshFilter>().sharedMesh; Object.Destroy((Object)(object)obj3); blobs = (Mesh[])(object)new Mesh[8]; for (int j = 0; j < blobs.Length; j++) { Vector2[] array2 = (Vector2[])(object)new Vector2[14]; float[] array3 = new float[14]; float num = 1f; for (int k = 0; k < 14; k++) { num = (array3[k] = Mathf.Clamp(num + Rnd(-0.18f, 0.18f), 0.7f, 1.25f)); } array3[13] = (array3[13] + array3[0]) * 0.5f; for (int l = 0; l < 14; l++) { float num2 = (float)l * ((float)Math.PI * 2f) / 14f; array2[l] = new Vector2(Mathf.Cos(num2) * array3[l], Mathf.Sin(num2) * array3[l]); } blobs[j] = MakePoly(Vector2.zero, array2); } streakMesh = MakePoly(new Vector2(0f, 0.4f), (Vector2[])(object)new Vector2[5] { new Vector2(-0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0.9f), new Vector2(0f, 1f), new Vector2(-0.5f, 0.9f) }); ready = true; } private static Mesh MakePoly(Vector2 c, Vector2[] ring) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown int num = ring.Length; Vector3[] array = (Vector3[])(object)new Vector3[num + 1]; Vector3[] array2 = (Vector3[])(object)new Vector3[num + 1]; array[0] = new Vector3(c.x, c.y, 0f); array2[0] = new Vector3(0f, 0f, -1f); for (int i = 0; i < num; i++) { array[i + 1] = new Vector3(ring[i].x, ring[i].y, 0f); array2[i + 1] = array2[0]; } int[] array3 = new int[num * 6]; int num2 = 0; for (int j = 0; j < num; j++) { int num3 = (j + 1) % num; array3[num2++] = 0; array3[num2++] = num3 + 1; array3[num2++] = j + 1; array3[num2++] = 0; array3[num2++] = j + 1; array3[num2++] = num3 + 1; } Mesh val = new Mesh { hideFlags = (HideFlags)32, vertices = Il2CppStructArray<Vector3>.op_Implicit(array), normals = Il2CppStructArray<Vector3>.op_Implicit(array2), triangles = Il2CppStructArray<int>.op_Implicit(array3) }; val.RecalculateBounds(); return val; } private static float Rnd(float a, float b) { return Random.Range(a, b); } private static int RndI(int n) { return Random.Range(0, n); } private static float Off() { return 0.003f + (float)(offCtr++ % 9) * 0.0006f; } private static float Avg(float[] a) { float num = 0f; for (int i = 0; i < a.Length; i++) { num += a[i]; } return num / (float)a.Length; } private static Quaternion Face(Vector3 n, Vector3 up) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(up, n); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.ProjectOnPlane(Vector3.forward, n); } if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.ProjectOnPlane(Vector3.right, n); } return Quaternion.LookRotation(-n, ((Vector3)(ref val)).normalized); } private static bool Ignorable(Collider c, Transform vroot) { if ((Object)(object)c == (Object)null) { return true; } if ((Object)(object)vroot != (Object)null && ((Component)c).transform.IsChildOf(vroot)) { return true; } Rigidbody attachedRigidbody = c.attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic) { return true; } if (((Object)((Component)c).transform.root).name.IndexOf("RigManager", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } return false; } private static bool CastSkip(Vector3 o, Vector3 dir, float len, Transform vroot, out RaycastHit hit) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) hit = default(RaycastHit); float num = len; Vector3 val = o; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < 4; i++) { if (!(num > 0.0005f)) { break; } if (!Physics.Raycast(val, dir, ref val2, num, -1, Ign)) { return false; } if (!Ignorable(((RaycastHit)(ref val2)).collider, vroot)) { hit = val2; return true; } float num2 = ((RaycastHit)(ref val2)).distance + 0.004f; val += dir * num2; num -= num2; } return false; } private static void SpawnDrop(Vector3 p, Vector3 v, float area, Victim src, float size = 1f, float chance = 1f, bool spray = false) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (drops.Count < 380) { Drop drop = new Drop(); drop.p = p; drop.v = v; drop.area = area; drop.src = src; drop.size = size; drop.chance = chance; drop.spray = spray; drops.Add(drop); } } private static void EmitDrop(Wound w, Victim v) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = w.bone.TransformDirection(w.ln); Vector3 p = w.bone.TransformPoint(w.lp) + val * 0.01f; float num = Mathf.Exp((0f - (w.lifeMax - w.life)) / 0.7f) * eSpurt.Value * w.power; Vector3 val2 = val * (0.3f + 3.5f * num * Rnd(0.5f, 1f)) + Random.insideUnitSphere * (0.2f + 0.1f * num); if ((Object)(object)w.rb != (Object)null) { val2 += w.rb.velocity * 0.8f; } SpawnDrop(p, val2, 0.0042f * Rnd(0.7f, 1.4f), v, Rnd(0.9f, 1.4f)); } private static void TickDrops(float dt) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) Vector3 val4 = default(Vector3); for (int num = drops.Count - 1; num >= 0; num--) { Drop drop = drops[num]; drop.v += Vector3.down * 9.81f * dt; drop.age += dt; Vector3 val = drop.p + drop.v * dt; Vector3 val2 = val - drop.p; float magnitude = ((Vector3)(ref val2)).magnitude; bool flag = drop.age > 6f; if (!flag && magnitude > 1E-05f) { Transform vroot = ((drop.src != null) ? drop.src.root : null); if (CastSkip(drop.p, val2 / magnitude, magnitude, vroot, out var hit)) { Land(drop, hit); flag = true; } } if (flag) { drops[num] = drops[drops.Count - 1]; drops.RemoveAt(drops.Count - 1); } else { drop.p = val; float magnitude2 = ((Vector3)(ref drop.v)).magnitude; Quaternion val3 = Quaternion.LookRotation((magnitude2 > 0.01f) ? (drop.v / magnitude2) : Vector3.down); float num2 = 0.0065f * drop.size; ((Vector3)(ref val4))..ctor(num2, num2, Mathf.Clamp(num2 + magnitude2 * 0.004f, num2, 0.04f)); Graphics.DrawMesh(dropMesh, Matrix4x4.TRS(drop.p, val3, val4), dropMat, 0); } } } private static void Land(Drop d, RaycastHit h) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if (d.chance < 1f && Rnd(0f, 1f) > d.chance) { return; } Vector3 normal = ((RaycastHit)(ref h)).normal; Vector3 point = ((RaycastHit)(ref h)).point; float magnitude = ((Vector3)(ref d.v)).magnitude; if (landLog < 6) { landLog++; Log("drop landed on " + ((Object)((RaycastHit)(ref h)).collider).name + " normal.y=" + normal.y.ToString("0.00") + " speed=" + magnitude.ToString("0.0")); } if (normal.y >= 0.6f) { AddToPuddle(point, normal, d.area); if ((d.spray && magnitude > 2.5f) || (magnitude > 4.5f && Rnd(0f, 1f) < 0.4f)) { Vector3 val = Vector3.ProjectOnPlane(d.v, normal); Vector3 normalized = ((Vector3)(ref val)).normalized; int num = ((!d.spray) ? 1 : ((magnitude > 6f) ? 3 : 2)); for (int i = 0; i < num; i++) { Splat(point + normalized * Rnd(0.05f, 0.12f + magnitude * 0.03f) + Random.insideUnitSphere * 0.03f, normal, Rnd(0.008f, 0.02f) * d.size * (1f + magnitude * 0.06f), normalized, 1f + Mathf.Min(1.5f, magnitude * 0.2f)); } } } else if (eWalls.Value) { float num2 = Mathf.Min(0.1f, Mathf.Sqrt(d.area / (float)Math.PI) * Rnd(0.8f, 1.5f) * (1f + magnitude * 0.12f)); Vector3 along = Vector3.ProjectOnPlane(d.v, normal); Splat(point, normal, num2, along, 1f + Mathf.Min(1.5f, magnitude * 0.18f)); if (d.spray && magnitude > 4f) { Vector3 val2 = Vector3.ProjectOnPlane(Random.insideUnitSphere, normal) * 0.05f; Splat(point + val2, normal, num2 * 0.45f, along, 1.8f); } if (normal.y > -0.5f && Rnd(0f, 1f) < 0.4f) { StartRunner(point, normal, d.area); } } } private static void Splat(Vector3 p, Vector3 n, float r, Vector3 along, float stretch) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Stain stain = splats.Acquire(blobs[RndI(blobs.Length)], mats[0]); stain.tr.position = p + n * Off(); stain.tr.rotation = Face(n, (((Vector3)(ref along)).sqrMagnitude > 0.0001f) ? along : Random.onUnitSphere); stain.tr.localScale = new Vector3(r, r * stretch, 1f); } private static void StartRunner(Vector3 p, Vector3 n, float area) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (runners.Count < 48) { Vector3 val = Vector3.ProjectOnPlane(Vector3.down, n); if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { Runner runner = new Runner(); runner.dir = ((Vector3)(ref val)).normalized; runner.n = n; runner.start = p; runner.area = area; runner.maxLen = Rnd(0.1f, 0.45f) * Mathf.Clamp(Mathf.Sqrt(area / 0.003f), 0.6f, 1.8f); runner.speed = Rnd(0.04f, 0.09f); runner.width = Rnd(0.008f, 0.016f); runner.off = Off(); runner.streak = smears.Acquire(streakMesh, mats[0]); runner.bulb = smears.Acquire(blobs[RndI(blobs.Length)], mats[0]); runners.Add(runner); PlaceRunner(runner); } } } private static void PlaceRunner(Runner r) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)r.streak.go == (Object)null) && !((Object)(object)r.bulb.go == (Object)null)) { Quaternion rotation = Face(r.n, r.dir); r.streak.tr.position = r.start + r.n * r.off; r.streak.tr.rotation = rotation; r.streak.tr.localScale = new Vector3(r.width, Mathf.Max(0.002f, r.len), 1f); r.bulb.tr.position = r.start + r.dir * r.len + r.n * (r.off + 0.0004f); r.bulb.tr.rotation = rotation; r.bulb.tr.localScale = new Vector3(r.width * 0.9f, r.width * 0.9f, 1f); } } private static void TickRunners(float dt) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) for (int num = runners.Count - 1; num >= 0; num--) { Runner runner = runners[num]; bool flag = false; float num2 = runner.speed * (1f - 0.75f * Mathf.Clamp01(runner.len / runner.maxLen)) * dt; Vector3 val = runner.start + runner.dir * runner.len; bool flag2 = Physics.Raycast(val + runner.n * 0.02f + runner.dir * num2, -runner.n, 0.05f, -1, Ign); if (Physics.Raycast(val + runner.n * 0.02f, runner.dir, num2 + 0.01f, -1, Ign)) { flag = true; } else if (!flag2) { flag = true; SpawnDrop(val + runner.n * 0.01f, runner.dir * 0.2f, runner.area * 0.5f, null); } else { runner.len += num2; if (runner.len >= runner.maxLen) { flag = true; } } PlaceRunner(runner); if (flag) { runners[num] = runners[runners.Count - 1]; runners.RemoveAt(runners.Count - 1); } } } private static Puddle NewPuddle(Vector3 p, Vector3 n, float area) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) Puddle puddle = new Puddle(); puddle.c = p; puddle.n = n; puddle.area = area; puddle.off = Off(); puddle.py = Vector3.ProjectOnPlane(Vector3.forward, n); if (((Vector3)(ref puddle.py)).sqrMagnitude < 0.0001f) { puddle.py = Vector3.ProjectOnPlane(Vector3.right, n); } ((Vector3)(ref puddle.py)).Normalize(); puddle.px = Vector3.Cross(n, puddle.py); float num = Mathf.Sqrt(area / (float)Math.PI); Vector2[] array = (Vector2[])(object)new Vector2[16]; for (int i = 0; i < 16; i++) { puddle.noise[i] = Rnd(0.86f, 1.14f); puddle.cur[i] = num; puddle.lim[i] = 999f; puddle.goal[i] = num; array[i] = new Vector2(CosT[i] * num, SinT[i] * num); } puddle.mesh = MakePoly(Vector2.zero, array); puddle.st = splats.Acquire(puddle.mesh, mats[0]); puddle.st.owner = puddle; puddle.st.tr.position = p + n * puddle.off; puddle.st.tr.rotation = Face(n, puddle.py); puddle.st.tr.localScale = Vector3.one; puddles.Add(puddle); return puddle; } private static void AddToPuddle(Vector3 p, Vector3 n, float area) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) float num = (float)Math.PI * ePudMax.Value * ePudMax.Value; Puddle puddle = null; float num2 = 9f; for (int i = 0; i < puddles.Count; i++) { Puddle puddle2 = puddles[i]; if (Vector3.Dot(puddle2.n, n) < 0.95f) { continue; } Vector3 val = p - puddle2.c; if (!(Mathf.Abs(Vector3.Dot(val, n)) > 0.05f)) { float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < Avg(puddle2.cur) + 0.03f && magnitude < num2) { puddle = puddle2; num2 = magnitude; } } } if (puddle == null) { puddle = NewPuddle(p, n, area); } else { puddle.area = Mathf.Min(num, puddle.area + area); puddle.goalDirty = true; if (Mathf.Sqrt(puddle.area / (float)Math.PI) * 1.25f > puddle.probeR) { puddle.needProbe = true; } } Merge(puddle); } private static float FarT(Vector3 c, Vector3 dir, Vector3 cc, float rr) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Vector3 val = c - cc; float num = Vector3.Dot(val, dir); float num2 = num * num - (((Vector3)(ref val)).sqrMagnitude - rr * rr); if (num2 < 0f) { return 0f; } return Mathf.Max(0f, 0f - num + Mathf.Sqrt(num2)); } private static void Merge(Puddle a) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) float num = (float)Math.PI * ePudMax.Value * ePudMax.Value; for (int num2 = puddles.Count - 1; num2 >= 0; num2--) { if (num2 < puddles.Count) { Puddle puddle = puddles[num2]; if (puddle != a && !(Vector3.Dot(a.n, puddle.n) < 0.95f)) { Vector3 val = puddle.c - a.c; if (!(Mathf.Abs(Vector3.Dot(val, a.n)) > 0.05f)) { float num3 = Avg(a.cur); float num4 = Avg(puddle.cur); if (!(((Vector3)(ref val)).magnitude >= (num3 + num4) * 0.75f)) { Puddle puddle2 = ((a.area >= puddle.area) ? a : puddle); Puddle puddle3 = ((puddle2 == a) ? puddle : a); float area = puddle2.area; float area2 = puddle3.area; Vector3 val2 = (puddle2.c * area + puddle3.c * area2) / (area + area2); float rr = Avg(puddle2.cur); float rr2 = Avg(puddle3.cur); for (int i = 0; i < 16; i++) { Vector3 dir = puddle2.px * CosT[i] + puddle2.py * SinT[i]; puddle2.cur[i] = Mathf.Max(Mathf.Max(FarT(val2, dir, puddle2.c, rr), FarT(val2, dir, puddle3.c, rr2)), 0.015f); } puddle2.c = val2; puddle2.area = Mathf.Min(num, area + area2); puddle2.needProbe = true; puddle2.goalDirty = true; puddle2.dirty = true; if (puddle2.st != null && (Object)(object)puddle2.st.go != (Object)null) { puddle2.st.tr.position = val2 + puddle2.n * puddle2.off; } puddles.Remove(puddle3); if (puddle3.st != null) { puddle3.st.owner = null; if ((Object)(object)puddle3.st.go != (Object)null) { puddle3.st.mf.sharedMesh = null; puddle3.st.go.SetActive(false); } } if ((Object)(object)puddle3.mesh != (Object)null) { Object.Destroy((Object)(object)puddle3.mesh); } if (puddle3 == a) { break; } } } } } } } private static bool IsStaticSurface(Collider c) { return !Ignorable(c, null); } private static void Probe(Puddle p) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) float num = (p.probeR = Mathf.Min(ePudMax.Value, Mathf.Sqrt(p.area / (float)Math.PI) * 1.5f + 0.12f)); Vector3 val = p.c + p.n * 0.04f; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < 16; i++) { Vector3 val2 = p.px * CosT[i] + p.py * SinT[i]; float num2 = 999f; if (Physics.Raycast(val, val2, ref val3, num, -1, Ign) && IsStaticSurface(((RaycastHit)(ref val3)).collider)) { num2 = Mathf.Max(0.02f, ((RaycastHit)(ref val3)).distance - 0.015f); } for (int j = 1; j <= 4; j++) { float num3 = num * (float)j / 4f; if (num3 >= num2) { break; } bool flag = Physics.Raycast(p.c + val2 * num3 + p.n * 0.06f, -p.n, ref val3, 0.14f, -1, Ign); if ((!flag || IsStaticSurface(((RaycastHit)(ref val3)).collider)) && (!flag || Mathf.Abs(Vector3.Dot(((RaycastHit)(ref val3)).point - p.c, p.n)) > 0.03f || Vector3.Dot(((RaycastHit)(ref val3)).normal, p.n) < 0.9f)) { num2 = Mathf.Max(0.02f, num * (float)(j - 1) / 4f + 0.01f); break; } } p.lim[i] = num2; } p.needProbe = false; p.goalDirty = true; } private static float AreaOf(Puddle p, float[] bs, float tr, float s) { float num = 0f; float num2 = 0.5f * Mathf.Sin((float)Math.PI / 8f); for (int i = 0; i < 16; i++) { int num3 = (i + 1) % 16; float num4 = Mathf.Min(bs[i] * tr * s, p.lim[i]); float num5 = Mathf.Min(bs[num3] * tr * s, p.lim[num3]); num += num2 * num4 * num5; } return num; } private static void ComputeGoals(Puddle p) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sqrt(p.area / (float)Math.PI); float num2 = Mathf.Clamp01((1f - p.n.y) * 8f); Vector3 val = Vector3.ProjectOnPlane(Vector3.down, p.n); val = ((((Vector3)(ref val)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref val)).normalized : Vector3.zero); float[] array = new float[16]; for (int i = 0; i < 16; i++) { Vector3 val2 = p.px * CosT[i] + p.py * SinT[i]; array[i] = p.noise[i] * (1f + 0.7f * num2 * Mathf.Clamp(Vector3.Dot(val2, val), -0.3f, 1f)); } float num3 = 1f; if (AreaOf(p, array, num, 1f) < p.area * 0.99f) { float num4 = 1f; float num5 = 4f; for (int j = 0; j < 7; j++) { float num6 = (num4 + num5) * 0.5f; if (AreaOf(p, array, num, num6) < p.area) { num4 = num6; } else { num5 = num6; } } num3 = num5; } for (int k = 0; k < 16; k++) { p.goal[k] = Mathf.Max(0.012f, Mathf.Min(array[k] * num * num3, p.lim[k])); } p.goalDirty = false; } private static void PushMesh(Puddle p) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[17] { Vector3.zero, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3) }; for (int i = 0; i < 16; i++) { array[i + 1] = new Vector3(CosT[i] * p.cur[i], SinT[i] * p.cur[i], 0f); } p.mesh.vertices = Il2CppStructArray<Vector3>.op_Implicit(array); p.mesh.RecalculateBounds(); p.dirty = false; } private static void TickPuddles(float dt) { int num = 3; int num2 = 10; for (int i = 0; i < puddles.Count; i++) { Puddle puddle = puddles[i]; if (puddle.st == null || (Object)(object)puddle.st.go == (Object)null) { continue; } if (puddle.needProbe && num > 0) { Probe(puddle); num--; } if (puddle.goalDirty) { ComputeGoals(puddle); } bool flag = false; for (int j = 0; j < 16; j++) { float num3 = puddle.goal[j] - puddle.cur[j]; if (!(Mathf.Abs(num3) < 0.0005f)) { float num4 = dt * (0.04f + 0.6f * Mathf.Abs(num3)); puddle.cur[j] += Mathf.Clamp(num3, 0f - num4, num4); flag = true; } } if ((flag || puddle.dirty) && num2 > 0) { PushMesh(puddle); num2--; } else if (flag) { puddle.dirty = true; } } } private static void RefreshBodies(Victim v) { if (v.bodies == null || !(Time.time < v.nextRefresh)) { v.nextRefresh = Time.time + 4f; Il2CppArrayBase<Rigidbody> componentsInChildren = ((Component)v.root).GetComponentsInChildren<Rigidbody>(true); int length = componentsInChildren.Length; if (v.bodies == null || v.bodies.Length != length) { v.bodies = (Rigidbody[])(object)new Rigidbody[length]; v.wet = new float[length]; v.lastG = (Vector3[])(object)new Vector3[length]; v.hasG = new bool[length]; } for (int i = 0; i < length; i++) { v.bodies[i] = componentsInChildren[i]; } } } private static float MaxWet(Victim v) { float num = 0f; if (v.wet != null) { for (int i = 0; i < v.wet.Length; i++) { if (v.wet[i] > num) { num = v.wet[i]; } } } return num; } private static void TickVictims(float dt) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (victims.Count == 0) { return; } List<int> list = null; foreach (KeyValuePair<int, Victim> victim in victims) { Victim value = victim.Value; if ((Object)(object)value.root == (Object)null) { if (list == null) { list = new List<int>(); } list.Add(victim.Key); continue; } bool flag = !((Component)value.root).gameObject.activeInHierarchy; if (!flag) { Vector3 position = value.root.position; if (value.hasPos) { Vector3 val = position - value.lastPos; if (((Vector3)(ref val)).sqrMagnitude > 9f) { flag = true; } } value.lastPos = position; value.hasPos = true; } if (flag) { if (resetLog < 6) { resetLog++; Log("body despawned or respawned elsewhere: wounds cleared (" + ((Object)value.root).name + ")"); } if (list == null) { list = new List<int>(); } list.Add(victim.Key); continue; } bool flag2 = false; for (int num = value.wounds.Count - 1; num >= 0; num--) { Wound wound = value.wounds[num]; if ((Object)(object)wound.bone == (Object)null) { value.wounds.RemoveAt(num); } else if (!(wound.life <= 0f)) { flag2 = true; wound.life -= dt; float num2 = 14f * Mathf.Pow(Mathf.Max(0f, wound.life) / wound.lifeMax, 1.1f) * (0.6f + 0.4f * eBleed.Value) * Mathf.Clamp(wound.power, 0.8f, 2f); wound.acc += num2 * dt; int num3 = 0; while (wound.acc >= 1f && num3++ < 4) { wound.acc -= 1f; EmitDrop(wound, value); } if (wound.acc > 2f) { wound.acc = 0f; } } } value.acc += dt; if (value.acc >= 0.05f) { float acc = value.acc; value.acc = 0f; SmearTick(value, acc); } if (!flag2 && Time.time - value.lastHit > 45f && MaxWet(value) < 0.02f) { if (list == null) { list = new List<int>(); } list.Add(victim.Key); } } if (list == null) { return; } foreach (int item in list) { victims.Remove(item); } } private static void SmearTick(Victim v, float dt) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) RefreshBodies(v); Vector3 val2; foreach (Wound wound in v.wounds) { if (wound.life <= 0f || (Object)(object)wound.bone == (Object)null) { continue; } Vector3 val = wound.bone.TransformPoint(wound.lp); for (int i = 0; i < v.bodies.Length; i++) { if (!((Object)(object)v.bodies[i] == (Object)null)) { val2 = v.bodies[i].position - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude < 0.45f) { v.wet[i] = Mathf.Min(1f, v.wet[i] + dt * 0.9f * (1f - magnitude / 0.45f)); } } } } for (int j = 0; j < v.bodies.Length; j++) { Rigidbody val3 = v.bodies[j]; if ((Object)(object)val3 == (Object)null) { continue; } v.wet[j] = Mathf.Max(0f, v.wet[j] - 0.01f * dt); if (!CastSkip(val3.position + Vector3.up * 0.08f, Vector3.down, 0.3f, v.root, out var hit) || ((RaycastHit)(ref hit)).normal.y < 0.5f) { v.hasG[j] = false; continue; } Vector3 point = ((RaycastHit)(ref hit)).point; Vector3 normal = ((RaycastHit)(ref hit)).normal; val2 = Vector3.ProjectOnPlane(val3.velocity, normal); float magnitude2 = ((Vector3)(ref val2)).magnitude; for (int k = 0; k < puddles.Count; k++) { Puddle puddle = puddles[k]; if (Vector3.Dot(puddle.n, normal) < 0.9f || Mathf.Abs(Vector3.Dot(point - puddle.c, normal)) > 0.05f) { continue; } val2 = point - puddle.c; if (!(((Vector3)(ref val2)).magnitude > Avg(puddle.cur) * 0.9f)) { v.wet[j] = Mathf.Min(1f, v.wet[j] + dt * 1.2f); if (magnitude2 > 0.15f) { puddle.area = Mathf.Max(0.004f, puddle.area - 0.0008f * dt); puddle.goalDirty = true; } break; } } if (!v.hasG[j]) { v.lastG[j] = point; v.hasG[j] = true; continue; } Vector3 val4 = point - v.lastG[j]; float magnitude3 = ((Vector3)(ref val4)).magnitude; if (!(magnitude3 < 0.07f)) { if (eSmear.Value && magnitude3 < 0.7f && magnitude2 > 0.25f && v.wet[j] > 0.04f) { AddSmear(v.lastG[j], point, normal, Mathf.Lerp(0.03f, 0.15f, v.wet[j])); v.wet[j] = Mathf.Max(0f, v.wet[j] - magnitude3 * 0.45f); } v.lastG[j] = point; } } } private static void AddSmear(Vector3 a, Vector3 b, Vector3 n, float width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL