Skip to content

Commit 9df6710

Browse files
committed
Pushing for release v1.0.2
1 parent d59e0cb commit 9df6710

File tree

8 files changed

+56
-4
lines changed

8 files changed

+56
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.2
2+
- Fixed an issue where looking straight up/down with the altitude locked would prevent movement forward.
3+
- Made it so duplicate camera controllers will destroy themselves (fixed a conflict with suitsTerminal).
4+
- Made the radar screen more consistent as a ghost.
15
# 1.0.1
26
- Resolved an issue where CullFactory would cause the ghost light to not work inside.
37
# 1.0.0

LethalCompanyTemplate/Patches.cs

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static class Patches
2020
public static bool vanillaMode = false;
2121
public static GrabbableObject ignoreObj = null;
2222
public static bool shouldGameOver = false;
23+
public static bool camControllerActive = false;
2324

2425
/////////////////////////////// Misc ///////////////////////////////
2526
/**
@@ -32,10 +33,49 @@ public static bool PreventSpiderBug(PlayerControllerB playerScript)
3233
return playerScript != null;
3334
}
3435

35-
/////////////////////////////// Needed to suppress certain base-game systems ///////////////////////////////
3636
/**
37-
* Prevents certain manipulations of the spectate camera that would interfere with the controls
37+
* Transpile to make ship monitors viewable as a ghost
3838
*/
39+
[HarmonyTranspiler]
40+
[HarmonyPatch(typeof(ManualCameraRenderer), "MeetsCameraEnabledConditions")]
41+
public static IEnumerable<CodeInstruction> MonitorDontCheckPlayerLocation(IEnumerable<CodeInstruction> instructions, ILGenerator il)
42+
{
43+
//First, load the list of instructions
44+
List<CodeInstruction> code = new List<CodeInstruction>(instructions);
45+
46+
//Find where we want to be inserting
47+
int insertIndex = -1;
48+
Label afterLabel = il.DefineLabel();
49+
for(int i = 0; i < code.Count; i++)
50+
{
51+
//Look for the "in hangar" check
52+
if (code[i].opcode == OpCodes.Ldfld && (FieldInfo)code[i].operand == AccessTools.Field(typeof(PlayerControllerB), nameof(PlayerControllerB.isInHangarShipRoom)))
53+
{
54+
Poltergeist.DebugLog("Found expected structure for monitor transpiler!");
55+
insertIndex = i - 1; //Actual insert is 1 line before
56+
code[i + 2].labels.Add(afterLabel);
57+
break;
58+
}
59+
}
60+
61+
//Make the new code to inject
62+
List<CodeInstruction> insertion = new List<CodeInstruction>();
63+
insertion.Add(new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Patches), nameof(Patches.camControllerActive))));
64+
insertion.Add(new CodeInstruction(OpCodes.Brtrue_S, afterLabel));
65+
66+
//Insert the code
67+
if (insertIndex != -1)
68+
{
69+
code.InsertRange(insertIndex, insertion);
70+
}
71+
72+
return code;
73+
}
74+
75+
/////////////////////////////// Needed to suppress certain base-game systems ///////////////////////////////
76+
/**
77+
* Prevents certain manipulations of the spectate camera that would interfere with the controls
78+
*/
3979
[HarmonyPrefix]
4080
[HarmonyPatch(typeof(StartOfRound), nameof(StartOfRound.SetSpectateCameraToGameOverMode))]
4181
public static bool PreventSpectateFollow(bool enableGameOver)

LethalCompanyTemplate/SpectatorCamController.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void EnableCam()
8383
Transform oldCam = StartOfRound.Instance.activeCamera.transform;
8484
transform.position = oldCam.position;
8585
transform.rotation = oldCam.rotation;
86+
Patches.camControllerActive = true;
8687
}
8788

8889
//If we don't have them, need to grab certain objects
@@ -115,6 +116,7 @@ public void DisableCam()
115116
enabled = false;
116117
light.enabled = false;
117118
Patches.vanillaMode = Poltergeist.Config.DefaultToVanilla.Value;
119+
Patches.camControllerActive = false;
118120
altitudeLock = false;
119121

120122
//If these aren't null, we moved them and need to put them back
@@ -271,12 +273,14 @@ private void SwitchModes(InputAction.CallbackContext context)
271273
currentGhostInteractible = null;
272274
clientPlayer.cursorTip.text = "";
273275
StartOfRound.Instance.SetSpectateCameraToGameOverMode(Patches.shouldGameOver, clientPlayer);
276+
Patches.camControllerActive = false;
274277
}
275278

276279
//Handle switching to modded
277280
else
278281
{
279282
transform.parent = null;
283+
Patches.camControllerActive = true;
280284
}
281285
}
282286

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Poltergeist",
3-
"version_number": "1.0.1",
3+
"version_number": "1.0.2",
44
"website_url": "https://github.com/coderCleric/Poltergeist",
55
"description": "Lets players freecam on death as a ghost and do various interactions.",
66
"dependencies": [ "BepInEx-BepInExPack-5.4.2100", "Rune580-LethalCompany_InputUtils-0.6.3", "Sigurd-CSync-4.1.0" ]
1 KB
Binary file not shown.

poltergeist_release/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.2
2+
- Fixed an issue where looking straight up/down with the altitude locked would prevent movement forward.
3+
- Made it so duplicate camera controllers will destroy themselves (fixed a conflict with suitsTerminal).
4+
- Made the radar screen more consistent as a ghost.
15
# 1.0.1
26
- Resolved an issue where CullFactory would cause the ghost light to not work inside.
37
# 1.0.0

poltergeist_release/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Poltergeist",
3-
"version_number": "1.0.1",
3+
"version_number": "1.0.2",
44
"website_url": "https://github.com/coderCleric/Poltergeist",
55
"description": "Lets players freecam on death as a ghost and do various interactions.",
66
"dependencies": [ "BepInEx-BepInExPack-5.4.2100", "Rune580-LethalCompany_InputUtils-0.6.3", "Sigurd-CSync-4.1.0" ]

0 commit comments

Comments
 (0)