public static bool Prefix(ref string message) { if (Language.main.Get("SwimToSurface").Equals(message)) { if (BreathingPatcher.isSurfaceAirPoisoned() || (Ocean.main.GetDepthOf(Player.main.gameObject) > 100)) { message = "Out of Air!"; if (hinter != null) { hinter.messageHash = message.GetHashCode(); // This is so the hinter will clear the message eventually } } else { if (hinter != null) { hinter.messageHash = hinter.message.GetHashCode(); // Put hinter back to its own hashcode. } } } return(true); }
public static void Postfix() { // Check if we've repaired the pod if (!EscapePod.main.damageEffectsShowing && !DeathRun.saveData.podSave.podRepaired) { if (EscapePod.main.liveMixin.GetHealthFraction() > 0.99f) { DeathRun.saveData.podSave.podRepaired = true; DeathRun.saveData.podSave.podRepairTime = DayNightCycle.main.timePassedAsFloat; } } // This just fixes a situation that 1.7.1 screwed up for some people if (EscapePod.main.damageEffectsShowing && DeathRun.saveData.podSave.podRepaired) { DeathRun.saveData.podSave.podRepaired = false; DeathRun.saveData.podSave.podRepairTime = 0; } // If we've repaired the pod but it hasn't right itself yet, let it off the kinematic leash to turn itself upright if (EscapePod_FixedUpdate_Patch.isRighting()) { if (Vector3.Distance(EscapePod.main.transform.position, Player.main.transform.position) < 15) { if (DeathRun.saveData.podSave.podRightingTime <= 0) { DeathRun.saveData.podSave.podRightingTime = DayNightCycle.main.timePassedAsFloat; } EscapePod.main.rigidbodyComponent.isKinematic = false; WorldForces wf = EscapePod.main.GetComponent <WorldForces>(); wf.underwaterGravity = 0.0f; } } EscapePod_FixedUpdate_Patch.CheckSolarCellRate(); if (damaged != EscapePod.main.damageEffectsShowing) { if (!EscapePod.main.damageEffectsShowing) { // At repair, give a one-time "full recharge" RegeneratePowerSource[] cells = EscapePod.main.gameObject.GetAllComponentsInChildren <RegeneratePowerSource>(); if (cells != null) { foreach (RegeneratePowerSource cell in cells) { float chargeable = cell.powerSource.GetMaxPower() - cell.powerSource.GetPower(); cell.powerSource.ModifyPower(chargeable, out _); } } } } else { if ((lastBlink == 0) || (lastBlink > Time.time)) { lastBlink = Time.time; } else if (Time.time >= lastBlink + 0.5) { lastBlink = Time.time; blinkOn = !blinkOn; } bool radioFound = false; bool radioWorks = false; if (EscapePod.main.radioSpawner != null && EscapePod.main.radioSpawner.spawnedObj != null) { LiveMixin component = EscapePod.main.radioSpawner.spawnedObj.GetComponent <LiveMixin>(); if (component) { radioFound = true; if (component.IsFullHealth()) { radioWorks = true; } } } if (damaged) { string content = Language.main.Get("IntroEscapePod3Content"); string bonus; if (DeathRun.saveData.podSave.podAnchored || Config.BASIC_GAME.Equals(DeathRun.config.startLocation)) { if (!Config.BASIC_GAME.Equals(DeathRun.config.startLocation)) { content = content.Replace("Flotation Devices: DEPLOYED", "Flotation Devices: FAILED"); if (DeathRun.config.podStayUpright || DeathRun.saveData.podSave.podRepaired) { content = content.Replace("Hull Integrity: OK", "Inertial Stabilizers: DEPLOYED"); } else { content = content.Replace("Hull Integrity: OK", "Inertial Stabilizers: " + (blinkOn ? "FAILED" : "")); } } } else { content = content.Replace("Flotation Devices: DEPLOYED", "Flotation Devices: " + (blinkOn ? "FAILED" : "")); } if (radioWorks) { content = content.Replace("Radio: OFFLINE", "Radio: INCOMING ONLY"); } if (!Config.NORMAL.Equals(DeathRun.config.creatureAggression)) { content = content.Replace("Uncharted ocean planet 4546B", "Planet 4546B: HOSTILE FAUNA"); } if (BreathingPatcher.isSurfaceAirPoisoned()) { content = content.Replace("Oxygen/nitrogen atmosphere", "Atmosphere: requires filtration"); } bonus = ""; if (BreathingPatcher.isSurfaceAirPoisoned()) { bonus += "\n\n- Atmosphere: " + (blinkOn ? "NOT BREATHABLE" : "") + "\n- Recommend Air Pumps to Filter Oxygen"; } if (DeathRunUtils.isExplosionClockRunning()) { bonus += "\n\n" + (blinkOn ? "- QUANTUM EXPLOSION WARNING" : ""); } if (RadiationUtils.isRadiationActive()) { bonus += "\n\n" + (blinkOn ? "- EXTREME RADIATION HAZARD" : ""); } uGUI_EscapePod.main.SetHeader(Language.main.Get("IntroEscapePod3Header"), new Color32(243, 201, 63, byte.MaxValue), 2f); uGUI_EscapePod.main.SetContent(content + bonus, new Color32(233, 63, 27, byte.MaxValue)); } else { string content = Language.main.Get("IntroEscapePod4Content"); if (radioFound && !radioWorks) { content = content.Replace("Incoming radio communication: ONLINE", "Incoming radio communication: OFFLINE"); } if (!Config.NORMAL.Equals(DeathRun.config.creatureAggression)) { content = content.Replace("Uncharted ocean planet 4546B", (blinkOn ? "Planet 4546B: HOSTILE FAUNA" : "Planet 4546B: ")); } if (BreathingPatcher.isSurfaceAirPoisoned()) { content = content.Replace("Oxygen/nitrogen atmosphere", "Atmosphere: requires filtration"); } if (!Config.BASIC_GAME.Equals(DeathRun.config.startLocation)) { content = content.Replace("Flotation Devices: DEPLOYED", "Flotation Devices: FAILED"); if (DeathRun.config.podStayUpright || DeathRun.saveData.podSave.podRepaired) { content = content.Replace("Hull Integrity: OK", "Inertial Stabilizers: DEPLOYED"); } else { content = content.Replace("Hull Integrity: OK", "Inertial Stabilizers: FAILED"); } } if (BreathingPatcher.isSurfaceAirPoisoned()) { content = content.Replace("Oxygen/nitrogen atmosphere", "Atmosphere: requires filtration"); } string bonus = ""; if (DeathRunUtils.isExplosionClockRunning()) { bonus += "\n " + (blinkOn ? "- QUANTUM EXPLOSION WARNING" : ""); } if (RadiationUtils.isRadiationActive()) { if (Config.NORMAL.Equals(DeathRun.config.radiationDepth)) { bonus += "\n - Radiation Hazard: Aurora"; } else { bonus += "\n " + (blinkOn ? "- EXTREME RADIATION HAZARD" : ""); } } uGUI_EscapePod.main.SetHeader(Language.main.Get("IntroEscapePod4Header"), new Color32((byte)(blinkOn ? 243 : 223), (byte)(blinkOn ? 243 : 223), 63, byte.MaxValue)); //, 2f); uGUI_EscapePod.main.SetContent(content + bonus, new Color32((byte)(blinkOn ? 243 : 223), (byte)(blinkOn ? 243 : 223), 63, byte.MaxValue)); } } }