Skip to content

Commit

Permalink
1.7.1 - more scans, escape pod righting itself, not aggressive vs non…
Browse files Browse the repository at this point in the history
…-piloted vehicles
  • Loading branch information
Cattlesquat committed Dec 27, 2020
1 parent e52ec64 commit 07737fd
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 17 deletions.
45 changes: 45 additions & 0 deletions DeathRun/DeathRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ public static void Patch()
}
}
};

PDAHandler.EditFragmentsToScan(TechType.Seamoth, 10);
PDAHandler.EditFragmentsToScan(TechType.Exosuit, 30);
PDAHandler.EditFragmentsToScan(TechType.Seaglide, 4);
}
else if (Config.HARD_VEHICLES.Equals(DeathRun.config.vehicleCosts))
{
Expand Down Expand Up @@ -491,6 +495,9 @@ public static void Patch()
}

};
PDAHandler.EditFragmentsToScan(TechType.Seamoth, 7);
PDAHandler.EditFragmentsToScan(TechType.Exosuit, 25);
PDAHandler.EditFragmentsToScan(TechType.Seaglide, 3);
}

if (techChanges != null)
Expand Down Expand Up @@ -552,6 +559,25 @@ public static void Patch()
// }
//}
};


PDAHandler.EditFragmentsToScan(TechType.Beacon, 4);
PDAHandler.EditFragmentsToScan(TechType.Gravsphere, 4);
PDAHandler.EditFragmentsToScan(TechType.StasisRifle, 4);
PDAHandler.EditFragmentsToScan(TechType.PropulsionCannon, 4);
PDAHandler.EditFragmentsToScan(TechType.LaserCutter, 5);
PDAHandler.EditFragmentsToScan(TechType.Welder, 5);
PDAHandler.EditFragmentsToScan(TechType.BatteryCharger, 6);
PDAHandler.EditFragmentsToScan(TechType.PowerCellCharger, 6);
PDAHandler.EditFragmentsToScan(TechType.Constructor, 10);
PDAHandler.EditFragmentsToScan(TechType.BaseBioReactor, 5);
PDAHandler.EditFragmentsToScan(TechType.BaseNuclearReactor, 5);
PDAHandler.EditFragmentsToScan(TechType.ThermalPlant, 5);
PDAHandler.EditFragmentsToScan(TechType.BaseMoonpool, 5);
PDAHandler.EditFragmentsToScan(TechType.PowerTransmitter, 2);
PDAHandler.EditFragmentsToScan(TechType.BaseMapRoom, 5);
//PDAHandler.EditFragmentsToScan(TechType.BaseWaterPark, 4);
PDAHandler.EditFragmentsToScan(TechType.Spotlight, 3);
}
else if (Config.HARD.Equals(DeathRun.config.builderCosts))
{
Expand Down Expand Up @@ -587,6 +613,25 @@ public static void Patch()
}
}
};

PDAHandler.EditFragmentsToScan(TechType.Beacon, 3);
PDAHandler.EditFragmentsToScan(TechType.Gravsphere, 3);
PDAHandler.EditFragmentsToScan(TechType.StasisRifle, 3);
PDAHandler.EditFragmentsToScan(TechType.PropulsionCannon, 3);
PDAHandler.EditFragmentsToScan(TechType.RepulsionCannon, 3);
PDAHandler.EditFragmentsToScan(TechType.LaserCutter, 4);
PDAHandler.EditFragmentsToScan(TechType.Welder, 4);
PDAHandler.EditFragmentsToScan(TechType.BatteryCharger, 4);
PDAHandler.EditFragmentsToScan(TechType.PowerCellCharger, 4);
PDAHandler.EditFragmentsToScan(TechType.Constructor, 6);
PDAHandler.EditFragmentsToScan(TechType.BaseBioReactor, 4);
PDAHandler.EditFragmentsToScan(TechType.BaseNuclearReactor, 4);
PDAHandler.EditFragmentsToScan(TechType.ThermalPlant, 4);
PDAHandler.EditFragmentsToScan(TechType.BaseMoonpool, 4);
PDAHandler.EditFragmentsToScan(TechType.PowerTransmitter, 2);
PDAHandler.EditFragmentsToScan(TechType.BaseMapRoom, 4);
//PDAHandler.EditFragmentsToScan(TechType.BaseWaterPark, 3);
PDAHandler.EditFragmentsToScan(TechType.Spotlight, 2);
}

if (techChanges != null)
Expand Down
46 changes: 45 additions & 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.6.1 - Best Scores");
highScoreLabel.ShowMessage("Death Run 1.7.1 - Best Scores");
highScoreTag.setAlign(TextAnchor.MiddleCenter);

int pick;
Expand Down Expand Up @@ -442,6 +442,14 @@ public class RunData
public const int FLAG_CYCLOPS = 0x08;
public const int FLAG_HABITAT = 0x10;
public const int FLAG_CURE = 0x20;
public const int FLAG_BEACON = 0x40;
public const int FLAG_DIVEREEL = 0x80;
public const int FLAG_REINFORCED = 0x100;
public const int FLAG_RADIATION = 0x200;
public const int FLAG_LASERCUTTER = 0x400;
public const int FLAG_ULTRAGLIDE = 0x800;
public const int FLAG_DOUBLETANK = 0x1000;
public const int FLAG_PLASTEEL_TANK = 0x2000;

public RunData()
{
Expand Down Expand Up @@ -570,6 +578,42 @@ public int calcScore()
vehicleVal += 25000;
}

if ((VehicleFlags & FLAG_BEACON) != 0)
{
vehicleVal += 200;
}

if ((VehicleFlags & FLAG_DIVEREEL) != 0)
{
vehicleVal += 400;
}

if ((VehicleFlags & FLAG_REINFORCED) != 0)
{
vehicleVal += 1500;
}

if ((VehicleFlags & FLAG_RADIATION) != 0)
{
vehicleVal += 300;
}

if ((VehicleFlags & FLAG_ULTRAGLIDE) != 0)
{
vehicleVal += 500;
}

if ((VehicleFlags & FLAG_DOUBLETANK) != 0)
{
vehicleVal += 250;
}

if ((VehicleFlags & FLAG_PLASTEEL_TANK) != 0)
{
vehicleVal += 1000;
}


float victoryVal = 0;
if (Victory)
{
Expand Down
6 changes: 3 additions & 3 deletions DeathRun/Patchers/AggressionPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static void Postfix(GameObject target, AggressiveWhenSeeTarget __instance
}
}

if ((((target != Player.main.gameObject) || Player.main.IsInside()) && !target.GetComponent<Vehicle>()) || // Must be player or vehicle
if ((((target != Player.main.gameObject) || Player.main.IsInside()) && (!target.GetComponent<Vehicle>() || (target.GetComponent<Vehicle>() != Player.main.currentMountedVehicle))) || // Must be player or vehicle
(Ocean.main.GetDepthOf(target) <= 5) || // Keeps reapers from eating us up on land
(!Config.EXORBITANT.Equals(DeathRun.config.creatureAggression) && !Config.DEATHRUN.Equals(DeathRun.config.creatureAggression)) || // Only on maximum aggression mode
(DayNightCycle.main.timePassedAsFloat < DeathRun.MORE_AGGRESSION) || // Not at very beginning of game
Expand Down Expand Up @@ -188,9 +188,9 @@ public static void PostFix(EcoRegion __instance, EcoTargetType type, Vector3 wsP
{
float sqrMagnitude = (wsPos - ecoTarget.GetPosition()).sqrMagnitude;

if (((ecoTarget.GetGameObject() == Player.main.gameObject) && !Player.main.IsInside()) || (ecoTarget.GetGameObject().GetComponent<Vehicle>()))
if (((ecoTarget.GetGameObject() == Player.main.gameObject) && !Player.main.IsInside()) ||
(ecoTarget.GetGameObject().GetComponent<Vehicle>() && (ecoTarget.GetGameObject().GetComponent<Vehicle>() == Player.main.currentMountedVehicle)))
{

bool feeding = false;
if (ecoTarget.GetGameObject() == Player.main.gameObject)
{
Expand Down
56 changes: 49 additions & 7 deletions DeathRun/Patchers/EscapePodPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public class PodSaveData
public int prevSecs { get; set; } // Previous integer "secs" time.
public bool spotPicked { get; set; } // Spot picked?

public bool podRepaired { get; set; } // Pod has been repaired
public float podRepairTime { get; set; } // Pod repair time
public float podRightingTime { get; set; } // Pod flipping back over begins
public bool podRighted { get; set; } // Pod has straightened out.

public PodSaveData()
{
podTransform = new Trans();
Expand All @@ -50,6 +55,11 @@ public void setDefaults()
lastDepth = 0;
prevSecs = 0;
spotPicked = false;

podRepaired = false;
podRighted = false;
podRepairTime = 0;
podRightingTime = 0;
}
}

Expand Down Expand Up @@ -132,7 +142,8 @@ public static bool Prefix(EscapePod __instance)
float depth = Ocean.main.GetDepthOf(__instance.gameObject);

// Copy our current transform
if (!DeathRun.saveData.podSave.podAnchored)
if (!DeathRun.saveData.podSave.podAnchored ||
(DeathRun.saveData.podSave.podRepaired && !DeathRun.saveData.podSave.podRighted && !DeathRun.config.podStayUpright))
{
DeathRun.saveData.podSave.podTransform.copyFrom(__instance.transform);
}
Expand Down Expand Up @@ -187,7 +198,7 @@ public static bool Prefix(EscapePod __instance)
}

// Check when pod hits bottom so we can stop processing it.
if ((DeathRun.saveData.podSave.prevSecs > 0) && (secs - frozenSecs > 2) && (depth > 20))
if (!DeathRun.saveData.podSave.podRepaired && (DeathRun.saveData.podSave.prevSecs > 0) && (secs - frozenSecs > 2) && (depth > 20))
{
float dist = Vector3.Distance(DeathRun.saveData.podSave.podPrev.position, DeathRun.saveData.podSave.podTransform.position);
if (!DeathRun.saveData.podSave.podAnchored && (dist < 0.5))
Expand Down Expand Up @@ -260,10 +271,11 @@ public static bool Prefix(EscapePod __instance)
}
DeathRun.saveData.podSave.prevSecs = secs;
DeathRun.saveData.podSave.podPrev.copyFrom(DeathRun.saveData.podSave.podTransform);
}
}

// If player is away from the pod, stop gravity so that it doesn't fall through the world when the geometry unloads
frozen = DeathRun.saveData.podSave.podAnchored || (Vector3.Distance(__instance.transform.position, Player.main.transform.position) > 20);
frozen = (Vector3.Distance(__instance.transform.position, Player.main.transform.position) > 20) ||
(DeathRun.saveData.podSave.podAnchored && !(DeathRun.saveData.podSave.podRepaired && !DeathRun.saveData.podSave.podRighted && !DeathRun.config.podStayUpright));
if (frozen)
{
wf.underwaterGravity = 0.0f;
Expand All @@ -273,6 +285,16 @@ public static bool Prefix(EscapePod __instance)
wf.underwaterGravity = 9.81f;
}

// Once pod is repaired, we give it a little time to right itself and then restore kinematic mode "for safety"
if (DeathRun.saveData.podSave.podRepaired && !DeathRun.saveData.podSave.podRighted && !DeathRun.config.podStayUpright)
{
if ((DeathRun.saveData.podSave.podRightingTime > 0) && (DayNightCycle.main.timePassedAsFloat > DeathRun.saveData.podSave.podRightingTime + 15))
{
DeathRun.saveData.podSave.podRighted = true;
__instance.rigidbodyComponent.isKinematic = true;
}
}

DeathRun.saveData.podSave.lastDepth = depth;
return true;
}
Expand All @@ -287,7 +309,7 @@ public static void Postfix(EscapePod __instance)
return;
}

if (DeathRun.saveData.podSave.podAnchored || !DeathRun.saveData.podSave.podGravity)
if (!DeathRun.saveData.podSave.podGravity || (DeathRun.saveData.podSave.podAnchored && !(DeathRun.saveData.podSave.podRepaired && !DeathRun.saveData.podSave.podRighted && !DeathRun.config.podStayUpright)))
{
__instance.rigidbodyComponent.isKinematic = true; // Make sure pod stays in place (turns off physics effects)
}
Expand Down Expand Up @@ -421,6 +443,26 @@ public static bool Prefix()
[HarmonyPostfix]
public static void Postfix()
{
// Check if we've repaired the pod
if (!EscapePod.main.damageEffectsShowing && !DeathRun.saveData.podSave.podRepaired)
{
DeathRun.saveData.podSave.podRepaired = true;
DeathRun.saveData.podSave.podRepairTime = DayNightCycle.main.timePassedAsFloat;
}

// If we've repaired the pod but it hasn't right itself yet, let it off the kinematic leash to turn itself upright
if (DeathRun.saveData.podSave.podRepaired && !DeathRun.saveData.podSave.podRighted && !DeathRun.config.podStayUpright)
{
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;
}
}

EscapePod_FixedUpdate_Patch.CheckSolarCellRate();
if (damaged != EscapePod.main.damageEffectsShowing)
{
Expand Down Expand Up @@ -474,7 +516,7 @@ public static void Postfix()
{
content = content.Replace("Flotation Devices: DEPLOYED", "Flotation Devices: FAILED");

if (DeathRun.config.podStayUpright)
if (DeathRun.config.podStayUpright || DeathRun.saveData.podSave.podRepaired)
{
content = content.Replace("Hull Integrity: OK", "Inertial Stabilizers: DEPLOYED");
}
Expand Down Expand Up @@ -547,7 +589,7 @@ public static void Postfix()
{
content = content.Replace("Flotation Devices: DEPLOYED", "Flotation Devices: FAILED");

if (DeathRun.config.podStayUpright)
if (DeathRun.config.podStayUpright || DeathRun.saveData.podSave.podRepaired)
{
content = content.Replace("Hull Integrity: OK", "Inertial Stabilizers: DEPLOYED");
} else
Expand Down
43 changes: 43 additions & 0 deletions DeathRun/Patchers/VehiclePatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,49 @@ public static void Postfix(GhostCrafter __instance)
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_CURE);
}

if (__instance.logic.craftingTechType == TechType.Beacon)
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_BEACON);
}

if (__instance.logic.craftingTechType == TechType.DiveReel)
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_DIVEREEL);
}

if (__instance.logic.craftingTechType == TechType.RadiationSuit)
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_RADIATION);
}

if (__instance.logic.craftingTechType == TechType.ReinforcedDiveSuit)
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_REINFORCED);
}

if (__instance.logic.craftingTechType == TechType.LaserCutter)
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_LASERCUTTER);
}

if ((__instance.logic.craftingTechType == TechType.UltraGlideFins) || (__instance.logic.craftingTechType == TechType.SwimChargeFins))
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_ULTRAGLIDE);
}


if (__instance.logic.craftingTechType == TechType.DoubleTank)
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_DOUBLETANK);
}

if ((__instance.logic.craftingTechType == TechType.HighCapacityTank) || (__instance.logic.craftingTechType == TechType.PlasteelTank))
{
DeathRun.saveData.runData.updateVehicle(0, RunData.FLAG_PLASTEEL_TANK);
}



}
}

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.6.1.0")]
[assembly: AssemblyFileVersion("1.6.1.0")]
[assembly: AssemblyVersion("1.7.1.0")]
[assembly: AssemblyFileVersion("1.7.1.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.6.1 - by Cattlesquat "standing on the shoulders of giants"
DEATH RUN - 1.7.1 - 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 @@ -39,6 +39,10 @@ Turns Subnautica into a "roguelike" where everything is harder and the only real
• 1.6 - Continued improvement of Escape Pod's data display
• 1.6 - Misc tuning and improvements of nitrogen model. Display shows blue when bonus from pipe, etc.
-------------------------------------------------------------------------------------------------------------
• 1.7 - Vehicles and certain other items require more "scans" to research
• 1.7 - Escape Pod will now "right itself" when repaired
• 1.7 - Enhanced aggression no longer applies to vehicles you aren't currently piloting
-------------------------------------------------------------------------------------------------------------

:: GENERAL OTHER STUFF ::
• Option to make water murky
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.6.1",
"Version": "1.7.1",
"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.6.1 - by Cattlesquat "standing on the shoulders of giants"
DEATH RUN - 1.7.1 - 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 @@ -39,6 +39,10 @@ Turns Subnautica into a "roguelike" where everything is harder and the only real
• 1.6 - Continued improvement of Escape Pod's data display
• 1.6 - Misc tuning and improvements of nitrogen model. Display shows blue when bonus from pipe, etc.
-------------------------------------------------------------------------------------------------------------
• 1.7 - Vehicles and certain other items require more "scans" to research
• 1.7 - Escape Pod will now "right itself" when repaired
• 1.7 - Enhanced aggression no longer applies to vehicles you aren't currently piloting
-------------------------------------------------------------------------------------------------------------

:: GENERAL OTHER STUFF ::
• Option to make water murky
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.6.1",
"Version": "1.7.1",
"Enable": true,
"AssemblyName": "DeathRun.dll",
"EntryMethod": "DeathRun.DeathRun.Patch",
Expand Down

0 comments on commit 07737fd

Please sign in to comment.