Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
made escape spawn possible
Browse files Browse the repository at this point in the history
  • Loading branch information
KirisameSoup committed Apr 6, 2024
1 parent a06b896 commit 7acaab8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
46 changes: 37 additions & 9 deletions reversed/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ void Start()
{
harmony = Harmony.CreateAndPatchAll(typeof(Rev), "com.kirisoup.hff.reversed");

harmony.PatchAll(typeof(Rev.MakeClimb));

Cmds.RegCmds();
}

Expand Down Expand Up @@ -77,21 +79,13 @@ void FixedUpdate()

print($"d {h} vy {vy} desiredVy {desiredVy} vy < desiredVy {vy < desiredVy} acc {acc}");

if (vy < desiredVy)
if (vy + acc < desiredVy)

foreach (Rigidbody rigidbody in player.human.rigidbodies)
rigidbody.velocity += new Vector3(0, acc, 0);

}





}



}

static void ThrowPlayer(string input = null)
Expand Down Expand Up @@ -196,6 +190,7 @@ static void SetPosition(ref Vector3 spawnPos)
if (!enabledRev) return;
if (!executingSpawnAt) return;
if (Game.instance.currentCheckpointNumber != 0) return;
if (Game.instance.currentLevelNumber == -1) return;

redrock = lvltype == WorkshopItemSource.EditorPick && lvlnum == 7;

Expand All @@ -221,6 +216,39 @@ static void SetPosition(ref Vector3 spawnPos)

print($"Human.instance.velocity {Human.instance.velocity}");
}

[HarmonyPatch(typeof(Human), "FixedUpdate")]
public static class MakeClimb
{
static bool justSpawed;
static bool keepGrabbing;

static void Prefix()
{
if (Game.instance.currentCheckpointNumber != 0) return;

print($"justSpawed {justSpawed} keepGrabbing {keepGrabbing}");

if (Human.instance.state == HumanState.Spawning) justSpawed = true;
}

static void Postfix()
{
if (Game.instance.currentCheckpointNumber != 0) return;

if (!justSpawed && !keepGrabbing) return;

if (Human.instance.hasGrabbed) keepGrabbing = false;

if (Human.instance.state == HumanState.Spawning || Human.instance.state == HumanState.Unconscious) return;

justSpawed = false;
if (!Human.instance.hasGrabbed) keepGrabbing = true;

if (keepGrabbing) Human.instance.state = HumanState.Climb;
}

}
}

static LevelPassTrigger FindClosestFinish(LevelPassTrigger[] origFinishes)
Expand Down
4 changes: 2 additions & 2 deletions reversed/reversed.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<AssemblyName>reversed</AssemblyName>
<Description>reversed</Description>
<Version>0.0.1</Version>
<Description>revphysics queriesersed</Description>
<Version>0.0.0.2</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down

0 comments on commit 7acaab8

Please sign in to comment.