Skip to content

Commit

Permalink
1.9.8 optional radiation FX, tweak nitrogen on hard, hold first aid i…
Browse files Browse the repository at this point in the history
…n quickslot
  • Loading branch information
Cattlesquat committed Jan 21, 2021
1 parent b7aa658 commit d56e941
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 49 deletions.
3 changes: 3 additions & 0 deletions DeathRun/DeathRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,9 @@ public static void Patch()
KnownTechHandler.Main.UnlockOnStart(TechType.Copper);
}

CraftDataHandler.SetQuickSlotType(TechType.FirstAidKit, QuickSlotType.Selectable);
CraftDataHandler.SetEquipmentType(TechType.FirstAidKit, EquipmentType.Hand);

Console.WriteLine("[DeathRun] Patched");

}
Expand Down
12 changes: 12 additions & 0 deletions DeathRun/DeathRunConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public class Config : ConfigFile
public const string MURK_DARKEST = "Darkest";
public const string MURK_CLEAR = "Crazy Clear";

public const string FX_CHERNOBYL = "Aurora-as-Chernobyl";
public const string FX_REMINDER = "Mild Reminder";
public const string FX_NORMAL = "Disable";

public const string WHENEVER = "Whenever Encountered";
public const string OCCASIONAL = "Occasional Reminders (> 5 min)";
public const string INTRODUCTORY = "Introducing Concept Only";
Expand Down Expand Up @@ -157,6 +161,9 @@ public class Config : ConfigFile
[Choice("Water Murkiness (Optional)", new string[] { MURK_NORMAL, MURK_DARK, MURK_DARKER, MURK_DARKEST, MURK_CLEAR }), OnChange(nameof(ChangedMurkiness))]
public string murkiness = MURK_NORMAL;

[Choice("Radiation FX if Immune (Optional)", new string[] { FX_CHERNOBYL, FX_REMINDER, FX_NORMAL }), OnChange(nameof(ChangedChoice))]
public string radiationFX = FX_CHERNOBYL;

[Choice("Food From Island (Optional)", new string[] { ALWAYS, BEFORE_AND_AFTER, AFTER, NEVER })]
public string islandFood = ALWAYS;

Expand Down Expand Up @@ -357,6 +364,11 @@ public int countDeathRunBonuses()
bonuses++;
}

if (FX_CHERNOBYL.Equals(radiationFX))
{
bonuses++;
}

if (MURK_DARK.Equals(murkiness))
{
bonuses++;
Expand Down
4 changes: 2 additions & 2 deletions DeathRun/DeathRunUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace DeathRun

public class DeathRunUtils
{
public const string VERSION = "1.9.7";
public const string VERSION = "1.9.8";

public static CenterText[] centerMessages = new CenterText[] {
new CenterText(250f, true),
Expand Down Expand Up @@ -286,7 +286,7 @@ public static void ShowHighScores(bool should)
}

highScoreLabel.setAlign(TextAnchor.MiddleCenter);
highScoreLabel.ShowMessage("Death Run 1.9.7 - Best Scores");
highScoreLabel.ShowMessage("Death Run 1.9.8 - Best Scores");
highScoreTag.setAlign(TextAnchor.MiddleCenter);

int pick;
Expand Down
1 change: 1 addition & 0 deletions DeathRun/Patchers/BreathingPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private static bool isAirPoisoned(Player player)
{
if (LeakingRadiation.main.GetNumLeaks() == 0)
{
if (Config.IRRADIATED.Equals(DeathRun.config.surfaceAir)) return false;
string LDBiome = TerrainDebugGUI.main.CalculateRawBiome(Player.main);
if (LDBiome.Contains("CrashedShip_Interior"))
{
Expand Down
42 changes: 42 additions & 0 deletions DeathRun/Patchers/MainMenuPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,46 @@ private static void Postfix(string slotName, UserStorageUtils.LoadOperation load
}
}
}

/**
* Allows using a first aid it from "held in the hand" mode (so it can be in a quick slot)
*/
[HarmonyPatch(typeof(QuickSlots))]
[HarmonyPatch("Drop")]
internal class DropToolPatcher
{
[HarmonyPrefix]
public static bool Prefix(QuickSlots __instance)
{
if (__instance._heldItem == null)
{
return true;
}

Pickupable item = __instance._heldItem.item;

if (item.GetTechType() != TechType.FirstAidKit)
{
return true;
}

Survival component = Player.main.GetComponent<Survival>();
if (component != null)
{
if (component.Use(item.gameObject))
{
__instance.refillTechType = item.GetTechType();
__instance.refillSlot = __instance.GetSlotByItem(__instance._heldItem);
__instance.desiredSlot = __instance.refillSlot;

UnityEngine.Object.Destroy(item.gameObject);
return false;
}
}

return false;
}
}


}
17 changes: 13 additions & 4 deletions DeathRun/Patchers/NitroLevPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,14 @@ public static bool Prefix (ref NitrogenLevel __instance)
if (Config.DEATHRUN.Equals(DeathRun.config.nitrogenBends))
{
baselineSafe = (depth < 0) ? 0 : depth * 3 / 4; // At any given depth our safe equilibrium gradually approaches 3/4 of current depth
} else
}
else
{
baselineSafe = ((depth < 0) || !isSwimming) ? 0 : depth / 2; // At any given depth our safe equilibrium gradually approaches 1/2 of current depth
baselineSafe = ((depth < 0) || !isSwimming) ? 0 : depth * 3 / 4; // At any given depth our safe equilibrium gradually approaches 3/4 of current depth
}

// Better dissipation when we're breathing through a pipe, or in a vehicle/base, or riding Seaglide, or wearing Rebreather
if (DeathRun.saveData.nitroSave.atPipe || !isSwimming || isSeaglide || (headSlot == TechType.Rebreather))
if ((baselineSafe > 0) && (DeathRun.saveData.nitroSave.atPipe || !isSwimming || isSeaglide || (headSlot == TechType.Rebreather)))
{
float adjustment = depth * (2 + (!isSwimming ? 1 : 0) + (isSeaglide ? 1 : 0)) / 8;

Expand Down Expand Up @@ -212,7 +213,7 @@ public static bool Prefix (ref NitrogenLevel __instance)

// This little % buffer helps introduce the concept of N2 (both initially and as a positive feedback reminder)
float target;
if (Player.main.precursorOutOfWater)
if (Player.main.precursorOutOfWater || (baselineSafe <= 0))
{
target = 0;
} else if ((DeathRun.saveData.nitroSave.safeDepth > 10f) || (depth >= 20)) {
Expand Down Expand Up @@ -379,6 +380,14 @@ public static bool Prefix (ref NitrogenLevel __instance)
}

HUDController(__instance, false); // (DeathRun.saveData.nitroSave.ascentRate >= 5) && (DeathRun.saveData.nitroSave.ascentWarning >= 30));
} else
{
if (Time.timeScale > 0f)
{
__instance.nitrogenLevel = 0;
DeathRun.saveData.nitroSave.safeDepth = 0;
BendsHUDController.SetActive(false, false);
}
}

return false;
Expand Down
96 changes: 59 additions & 37 deletions DeathRun/Patchers/RadiationPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public class RadiationFXPatcher
[HarmonyPrefix]
private static bool Update(RadiationsScreenFXController __instance)
{
if ((Player.main == null) || (LeakingRadiation.main == null))
if ((Player.main == null) || (LeakingRadiation.main == null) || Config.FX_NORMAL.Equals(DeathRun.config.radiationFX))
{
DeathRun.saveData.playerSave.backgroundRads = 0;
return true;
Expand Down Expand Up @@ -256,6 +256,7 @@ private static bool Update(RadiationsScreenFXController __instance)
}
DeathRun.saveData.playerSave.backgroundRads = backgroundRads;


// In the moments right after we fix the leaks, the visible radiation fades back a bit.
float fixFactor = 1.0f;
if (LeakingRadiation.main.GetNumLeaks() == 0)
Expand All @@ -277,54 +278,75 @@ private static bool Update(RadiationsScreenFXController __instance)
// If we're inside the ship (or near it), and radiation leaks aren't fixed yet, we show quite a bit more radiation effects
if (fixFactor > 0)
{
if (LDBiome.Contains("CrashedShip")) {
if (LDBiome.Contains("Interior_Power") && !LDBiome.Contains("Corridor"))
if (Config.FX_CHERNOBYL.Equals(DeathRun.config.radiationFX))
{
if (LDBiome.Contains("CrashedShip"))
{
if (Player.main.IsSwimming())
if (LDBiome.Contains("Interior_Power") && !LDBiome.Contains("Corridor"))
{
backgroundRads = 2.0f;
if (Player.main.IsSwimming())
{
backgroundRads = 2.0f;
}
else
{
backgroundRads = 1.6f;
}
}
else
else if (LDBiome.Contains("PowerCorridor"))
{
if (distance <= 32)
{
backgroundRads = 1.4f;
}
else
{
backgroundRads = 1.2f;
}
}
else if (LDBiome.Contains("Elevator") || LDBiome.Contains("Locker") || LDBiome.Contains("Seamoth"))
{
backgroundRads = 1.0f;
}
else if (LDBiome.Contains("Exo") || LDBiome.Contains("Living") || LDBiome.Contains("Cargo"))
{
backgroundRads = 1.6f;
backgroundRads = 0.8f;
}
else if (LDBiome.Contains("Entrance_03") || LDBiome.Contains("Entrance_01_01"))
{
backgroundRads = 0.7f;
}
else if (LDBiome.Contains("THallway_Lower") || LDBiome.Contains("Entrance_01"))
{
backgroundRads = 0.6f;
}
else if (LDBiome.Contains("THallway") || LDBiome.Contains("Entrance"))
{
backgroundRads = 0.5f;
}
else if (PlayerBiome.Contains("crashedShip") || PlayerBiome.Contains("generatorRoom"))
{
backgroundRads = 0.4f;
}
else if (PlayerBiome.Contains("CrashZone") || PlayerBiome.Contains("crashZone"))
{
backgroundRads = 0.3f;
}
}
else if (LDBiome.Contains("PowerCorridor"))
}
else
{
if (LDBiome.Contains("Interior_Power") && !LDBiome.Contains("Corridor"))
{
if (distance <= 32)
if (Player.main.IsSwimming())
{
backgroundRads = 1.4f;
backgroundRads = 0.5f;
}
else
{
backgroundRads = 1.2f;
backgroundRads = 0.4f;
}
}
else if (LDBiome.Contains("Elevator") || LDBiome.Contains("Locker") || LDBiome.Contains("Seamoth"))
{
backgroundRads = 1.0f;
}
else if (LDBiome.Contains("Exo") || LDBiome.Contains("Living") || LDBiome.Contains("Cargo"))
{
backgroundRads = 0.8f;
}
else if (LDBiome.Contains("Entrance_03") || LDBiome.Contains("Entrance_01_01"))
{
backgroundRads = 0.7f;
}
else if (LDBiome.Contains("THallway_Lower") || LDBiome.Contains("Entrance_01"))
{
backgroundRads = 0.6f;
}
else if (LDBiome.Contains("THallway") || LDBiome.Contains("Entrance"))
{
backgroundRads = 0.5f;
}
else if (PlayerBiome.Contains("crashedShip") || PlayerBiome.Contains("generatorRoom"))
{
backgroundRads = 0.4f;
}
else if (PlayerBiome.Contains("CrashZone") || PlayerBiome.Contains("crashZone"))
} else if (PlayerBiome.Contains("CrashZone") || PlayerBiome.Contains("crashZone") || PlayerBiome.Contains("crashedShip") || PlayerBiome.Contains("generatorRoom"))
{
backgroundRads = 0.3f;
}
Expand Down
4 changes: 2 additions & 2 deletions DeathRun/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.9.7.0")]
[assembly: AssemblyFileVersion("1.9.7.0")]
[assembly: AssemblyVersion("1.9.8.0")]
[assembly: AssemblyFileVersion("1.9.8.0")]
6 changes: 5 additions & 1 deletion DeathRun/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEATH RUN - 1.9.7 - by Cattlesquat "standing on the shoulders of giants"
DEATH RUN - 1.9.8 - by Cattlesquat "standing on the shoulders of giants"

Turns Subnautica into a "roguelike" where everything is harder and the only real question is how LONG you can survive.

Expand All @@ -19,6 +19,10 @@ Turns Subnautica into a "roguelike" where everything is harder and the only real
• Vehicles and the Habitat Builder much more expensive

-------------------------------------------------------------------------------------------------------------
• 1.9.8 - First Aid Kits can be placed in a Quick Slot, and when "held" can be "used" instead of "dropped"
• 1.9.8 - "Chernobyl" Aurora interior FX moved to an optional setting, w/ scoring adjustments.
• 1.9.8 - When repair Aurora and "Surface Air" set to "Hard", all surface air immediately breathable.
• 1.9.8 - Tweaks to "Hard" setting for Nitrogen.
• 1.9.7 - Aurora interior is more Chernobyl-ish before repair, but AFTER repair the air inside it works again
• 1.9.7 - Nitrogen/Bends on "Hard" level falls toward 0 when you go inside a base/vehicle
• 1.9.7 - Setting Batteries to "Worse than Deathrun" gives appropriate scoring credit
Expand Down
2 changes: 1 addition & 1 deletion DeathRun/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Id": "DeathRun",
"DisplayName": "DeathRun",
"Author": "Cattlesquat",
"Version": "1.9.6",
"Version": "1.9.8",
"Enable": true,
"AssemblyName": "DeathRun.dll",
"EntryMethod": "DeathRun.DeathRun.Patch",
Expand Down
6 changes: 5 additions & 1 deletion QMods/DeathRun/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEATH RUN - 1.9.7 - by Cattlesquat "standing on the shoulders of giants"
DEATH RUN - 1.9.8 - by Cattlesquat "standing on the shoulders of giants"

Turns Subnautica into a "roguelike" where everything is harder and the only real question is how LONG you can survive.

Expand All @@ -19,6 +19,10 @@ Turns Subnautica into a "roguelike" where everything is harder and the only real
• Vehicles and the Habitat Builder much more expensive

-------------------------------------------------------------------------------------------------------------
• 1.9.8 - First Aid Kits can be placed in a Quick Slot, and when "held" can be "used" instead of "dropped"
• 1.9.8 - "Chernobyl" Aurora interior FX moved to an optional setting, w/ scoring adjustments.
• 1.9.8 - When repair Aurora and "Surface Air" set to "Hard", all surface air immediately breathable.
• 1.9.8 - Tweaks to "Hard" setting for Nitrogen.
• 1.9.7 - Aurora interior is more Chernobyl-ish before repair, but AFTER repair the air inside it works again
• 1.9.7 - Nitrogen/Bends on "Hard" level falls toward 0 when you go inside a base/vehicle
• 1.9.7 - Setting Batteries to "Worse than Deathrun" gives appropriate scoring credit
Expand Down
2 changes: 1 addition & 1 deletion QMods/DeathRun/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Id": "DeathRun",
"DisplayName": "DeathRun",
"Author": "Cattlesquat",
"Version": "1.9.6",
"Version": "1.9.8",
"Enable": true,
"AssemblyName": "DeathRun.dll",
"EntryMethod": "DeathRun.DeathRun.Patch",
Expand Down

0 comments on commit d56e941

Please sign in to comment.