Skip to content

Commit

Permalink
1.8.2 - elevator/teleporter bends, containment facility crush/energy,…
Browse files Browse the repository at this point in the history
… swim charge fins rebalance, rocket launch saves high scores
  • Loading branch information
Cattlesquat committed Jan 4, 2021
1 parent cd93a5c commit 4dac907
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 38 deletions.
2 changes: 1 addition & 1 deletion DeathRun/DeathRunUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public static void ShowHighScores(bool should)
}

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

int pick;
Expand Down
2 changes: 1 addition & 1 deletion DeathRun/Patchers/BreathPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class BreathPatcher
[HarmonyPrefix]
public static bool Prefix(ref NitrogenLevel __instance, Player player)
{
if (GameModeUtils.RequiresOxygen())
if (GameModeUtils.RequiresOxygen() && !PrisonManager.IsInsideAquarium(player.gameObject.transform.position))
{
float depthOf = Ocean.main.GetDepthOf(player.gameObject);

Expand Down
2 changes: 1 addition & 1 deletion DeathRun/Patchers/BreathingPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static bool isSurfaceAirPoisoned ()
private static bool isAirPoisoned(Player player)
{
if (!isSurfaceAirPoisoned()) return false;
if (player.IsInside()) return false;
if (player.IsInside() || player.precursorOutOfWater) return false;
float depth = Ocean.main.GetDepthOf(player.gameObject);
if (depth > 5) return false;
return true;
Expand Down
37 changes: 37 additions & 0 deletions DeathRun/Patchers/NitroLevPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,4 +592,41 @@ public static bool Prefix(ref Bubble __instance, Collision collisionInfo)
return true;
}
}


/**
* When player uses the funky elevator in the Precursor base, don't give him bends.
*/
[HarmonyPatch(typeof(PrecursorElevator))]
[HarmonyPatch("Update")]
internal class PrecursorElevatorPatcher
{
[HarmonyPrefix]
public static bool Prefix(ref PrecursorElevator __instance)
{
if (__instance.elevatorPointIndex != -1)
{
DeathRun.saveData.nitroSave.safeDepth = 10;
}
return true;
}
}

/**
* When player teleports, don't give him bends.
*/
[HarmonyPatch(typeof(PrecursorTeleporter))]
[HarmonyPatch("BeginTeleportPlayer")]
internal class PrecursorTeleporterPatcher
{
[HarmonyPrefix]
public static bool Prefix(ref PrecursorTeleporter __instance)
{
if (DeathRun.saveData.nitroSave.safeDepth > 10)
{
DeathRun.saveData.nitroSave.safeDepth = 10;
}
return true;
}
}
}
69 changes: 41 additions & 28 deletions DeathRun/Patchers/PlayerPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,38 +490,45 @@ internal class PlayerKillPatcher
[HarmonyPrefix]
public static bool Prefix(DamageType damageType)
{
setCauseOfDeath(damageType);
try
{
setCauseOfDeath(damageType);

DeathRun.saveData.playerSave.numDeaths++;
DeathRun.saveData.playerSave.numDeaths++;

DeathRun.saveData.playerSave.timeOfDeath = DayNightCycle.main.timePassedAsFloat;
DeathRun.saveData.playerSave.spanAtDeath = DeathRun.saveData.playerSave.allLives;
DeathRun.saveData.playerSave.timeOfDeath = DayNightCycle.main.timePassedAsFloat;
DeathRun.saveData.playerSave.spanAtDeath = DeathRun.saveData.playerSave.allLives;

TimeSpan timeSpan = TimeSpan.FromSeconds((double)DeathRun.saveData.playerSave.currentLife);
TimeSpan timeSpan = TimeSpan.FromSeconds((double)DeathRun.saveData.playerSave.currentLife);

string text = "Time of Death";
if (DeathRun.saveData.playerSave.numDeaths > 1)
{
text += " #" + DeathRun.saveData.playerSave.numDeaths;
}
text += ": ";
string text = "Time of Death";
if (DeathRun.saveData.playerSave.numDeaths > 1)
{
text += " #" + DeathRun.saveData.playerSave.numDeaths;
}
text += ": ";

text += DeathRunUtils.sayTime(timeSpan);
text += DeathRunUtils.sayTime(timeSpan);

DeathRunUtils.CenterMessage(text, 10);
CattleLogger.Message(text);
DeathRunUtils.CenterMessage(text, 10);
CattleLogger.Message(text);

text = "Cause of Death: " + DeathRun.cause;
DeathRunUtils.CenterMessage(text, 10, 1);
text = "Cause of Death: " + DeathRun.cause;
DeathRunUtils.CenterMessage(text, 10, 1);

//ErrorMessage.AddMessage(text);
//ErrorMessage.AddMessage(text);

DeathRun.saveData.playerSave.killOpening = true;
DeathRun.saveData.runData.updateVitals(false);
DeathRun.saveData.playerSave.killOpening = true;
DeathRun.saveData.runData.updateVitals(false);

DeathRun.saveData.nitroSave.setDefaults(); // Reset all nitrogen state
DeathRun.saveData.nitroSave.setDefaults(); // Reset all nitrogen state

DeathRun.playerIsDead = true;
DeathRun.playerIsDead = true;
}
catch (Exception ex)
{
CattleLogger.GenericError("During Player.OnKill - ", ex);
}

return true;
}
Expand Down Expand Up @@ -594,7 +601,7 @@ static void setCauseOfDeath (DamageType damageType)
}
else
{
CattleLogger.Message("(Couldn't find creature that cause player death)");
CattleLogger.Message("(Couldn't find creature that caused player death) - ");
}
}
}
Expand Down Expand Up @@ -638,7 +645,7 @@ public static bool Prefix (Player __instance)
{
Vehicle vehicle = __instance.GetVehicle();

if ((vehicle == null) || !(vehicle.gameObject.transform.position.y < vehicle.worldForces.waterDepth + 2f) || vehicle.precursorOutOfWater)
if ((vehicle == null) || !(vehicle.gameObject.transform.position.y < vehicle.worldForces.waterDepth + 2f) || vehicle.precursorOutOfWater || vehicle.IsInsideAquarium())
{
return true;
}
Expand Down Expand Up @@ -751,24 +758,30 @@ internal class LaunchRocketPatcher
[HarmonyPrefix]
public static void Prefix(uGUI_HardcoreGameOver __instance)
{
TimeSpan timeSpan = TimeSpan.FromSeconds((double)DeathRun.saveData.playerSave.allLives);
DeathRun.setCause("Victory");
DeathRun.saveData.runData.updateVitals(true);
DeathRun.statsData.SaveStats();

TimeSpan timeSpan = TimeSpan.FromSeconds((double)DeathRun.saveData.playerSave.allLives);
string text = "Victory! In " + DeathRunUtils.sayTime(timeSpan) + " (" + (DeathRun.saveData.playerSave.numDeaths + 1) + " ";
if (DeathRun.saveData.playerSave.numDeaths == 0)
{
text += "life";
} else
}
else
{
text += "lives";
}

text += ")";

DeathRun.setCause("Victory");
DeathRun.saveData.runData.updateVitals(true);

DeathRunUtils.CenterMessage(text, 10);
CattleLogger.Message(text);

string text2 = "Score: " + DeathRun.saveData.runData.Score;
DeathRunUtils.CenterMessage(text, 10, 1);
CattleLogger.Message(text);

//ErrorMessage.AddMessage(text);
}
}
Expand Down
2 changes: 1 addition & 1 deletion DeathRun/Patchers/PowerPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static void ConsumeEnergyTool(ref float amount)
[HarmonyPrefix]
public static void AddEnergyTool(ref float amount)
{
amount = AdjustAddEnergy(amount, isTransformInRadiation(Player.main.transform));
amount = AdjustAddEnergy(amount * 2, isTransformInRadiation(Player.main.transform));
}

/**
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.8.2.0")]
[assembly: AssemblyFileVersion("1.8.2.0")]
[assembly: AssemblyVersion("1.8.3.0")]
[assembly: AssemblyFileVersion("1.8.3.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.8.2 - by Cattlesquat "standing on the shoulders of giants"
DEATH RUN - 1.8.3 - 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 Down Expand Up @@ -49,6 +49,10 @@ Turns Subnautica into a "roguelike" where everything is harder and the only real
• 1.8.2 - Alternative "Death Run Costs" for Vehicles available
• 1.8.2 - Fixed lack of bends damage w/ warnings turned off
• 1.8.2 - Spotlights back to only requiring one scan (since they don't despawn when you scan them, no point)
• 1.8.3 - Elevator and Teleporters should no longer give you The Bends
• 1.8.3 - "Primary Containment Facility" no longer causes crush depth damage, nor exit-vehicle energy costs.
• 1.8.3 - Launching Rocket now saves the score
• 1.8.3 - Swim Charge Fins charging penalty reduced
-------------------------------------------------------------------------------------------------------------

:: GENERAL OTHER STUFF ::
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.8.2",
"Version": "1.8.3",
"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.8.2 - by Cattlesquat "standing on the shoulders of giants"
DEATH RUN - 1.8.3 - 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 Down Expand Up @@ -49,6 +49,10 @@ Turns Subnautica into a "roguelike" where everything is harder and the only real
• 1.8.2 - Alternative "Death Run Costs" for Vehicles available
• 1.8.2 - Fixed lack of bends damage w/ warnings turned off
• 1.8.2 - Spotlights back to only requiring one scan (since they don't despawn when you scan them, no point)
• 1.8.3 - Elevator and Teleporters should no longer give you The Bends
• 1.8.3 - "Primary Containment Facility" no longer causes crush depth damage, nor exit-vehicle energy costs.
• 1.8.3 - Launching Rocket now saves the score
• 1.8.3 - Swim Charge Fins charging penalty reduced
-------------------------------------------------------------------------------------------------------------

:: GENERAL OTHER STUFF ::
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.8.2",
"Version": "1.8.3",
"Enable": true,
"AssemblyName": "DeathRun.dll",
"EntryMethod": "DeathRun.DeathRun.Patch",
Expand Down

0 comments on commit 4dac907

Please sign in to comment.