Skip to content

Commit

Permalink
Fix ratchet set after saving and reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
Horsey4 committed Mar 5, 2024
1 parent 2842fe1 commit 9a31479
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Bolt.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using HutongGames.PlayMaker;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using MSCLoader;
using System;
Expand Down Expand Up @@ -37,6 +37,7 @@ public int tightness

static readonly FsmFloat wrenchSize = FsmVariables.GlobalVariables.FindFsmFloat("ToolWrenchSize");
static readonly FsmBool usingRatchet = FsmVariables.GlobalVariables.FindFsmBool("PlayerHasRatchet");
static Transform spanner;
static Material highlightMaterial;
static FsmBool ratchetSwitch;

Expand Down Expand Up @@ -81,9 +82,9 @@ public void Awake()
transform.localPosition += transform.localRotation * positionStep * -maxTightness;
transform.localRotation *= Quaternion.Euler(rotationStep * -maxTightness);

if (!highlightMaterial)
if (!spanner)
{
var spanner = GameObject.Find("PLAYER/Pivot/AnimPivot/Camera/FPSCamera").transform.Find("2Spanner");
spanner = GameObject.Find("PLAYER/Pivot/AnimPivot/Camera/FPSCamera").transform.Find("2Spanner");

var fsm = spanner.Find("Pivot/Ratchet").GetComponent<PlayMakerFSM>();
fsm.InitializeFSM();
Expand Down Expand Up @@ -118,4 +119,4 @@ void tryResetMaterial()
}
}
}
}
}

0 comments on commit 9a31479

Please sign in to comment.