Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use external camera #419

Open
wants to merge 234 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
a1861e7
use external camera
xAstroBoy Feb 23, 2024
458a952
Remove stuff
xAstroBoy Feb 23, 2024
1514ccc
Merge branch 'main' into New-Camera
xAstroBoy Feb 23, 2024
17be599
style: format scripts
github-actions[bot] Feb 23, 2024
954733d
Update LcHaxCamera.cs
xAstroBoy Feb 23, 2024
4ac4d9c
Update lc-hax/Scripts/Helpers/Players.cs
xAstroBoy Feb 23, 2024
8c6421e
Remove pepega moment
xAstroBoy Feb 23, 2024
60dab09
style: format scripts
github-actions[bot] Feb 23, 2024
319a5ba
Update LcHaxCamera.cs
xAstroBoy Feb 23, 2024
774a57a
style: format scripts
github-actions[bot] Feb 23, 2024
65ae816
Discard changes to lc-hax/Scripts/Modules/Possession/Controllers/Brac…
xAstroBoy Feb 23, 2024
3547b79
Merge branch 'main' into New-Camera
winstxnhdw Feb 23, 2024
dffa8e3
Update LcHaxCamera.cs
xAstroBoy Feb 23, 2024
68ac2d4
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 23, 2024
9380d0d
Update LcHaxCamera.cs
xAstroBoy Feb 23, 2024
7fa117c
Update LcHaxCamera.cs
xAstroBoy Feb 23, 2024
e9fc937
Update LcHaxCamera.cs
xAstroBoy Feb 23, 2024
df7bcba
Fixes
xAstroBoy Feb 23, 2024
2a3101f
style: format scripts
github-actions[bot] Feb 23, 2024
454adb4
Fix jester not killing & bugfixes
xAstroBoy Feb 23, 2024
d2566ff
style: format scripts
github-actions[bot] Feb 23, 2024
e1b2689
Update JesterEnemyController.cs
xAstroBoy Feb 23, 2024
54fa508
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 23, 2024
e539a31
style: format scripts
github-actions[bot] Feb 23, 2024
2d21d4a
Update MaskedController.cs
xAstroBoy Feb 23, 2024
a50f661
style: format scripts
github-actions[bot] Feb 23, 2024
7a0314c
Update MaskedController.cs
xAstroBoy Feb 23, 2024
b0e046d
Minor fixes and call collision of enemies that aren't supposed to be …
xAstroBoy Feb 23, 2024
5f3365a
foward collision with player to enemy collision detection.
xAstroBoy Feb 23, 2024
b0e7bd9
Update SandSpiderController.cs
xAstroBoy Feb 23, 2024
6ea97a9
foward collision with player to enemy collision detection.
xAstroBoy Feb 23, 2024
7688b39
Update PossessionMod.cs
xAstroBoy Feb 23, 2024
5be2bac
Update PossessionMod.cs
xAstroBoy Feb 23, 2024
a5030d6
Add Kills for inside enemies if they are outside
xAstroBoy Feb 23, 2024
10c543d
style: format scripts
github-actions[bot] Feb 23, 2024
36c49bf
fixes
xAstroBoy Feb 23, 2024
5056eb9
style: format scripts
github-actions[bot] Feb 23, 2024
2593e7b
fixes
xAstroBoy Feb 23, 2024
4f5a716
Update PhantomMod.cs
xAstroBoy Feb 24, 2024
f90fdc6
Final Fixes
xAstroBoy Feb 24, 2024
fd8f417
style: format scripts
github-actions[bot] Feb 24, 2024
f90153a
thans @D1GQ
xAstroBoy Feb 24, 2024
4bc7d3b
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 24, 2024
cf268c4
Update HoardingBugController.cs
xAstroBoy Feb 24, 2024
8d842a9
Make Lc-Hax camera a core module.
xAstroBoy Feb 24, 2024
c494225
style: format scripts
github-actions[bot] Feb 24, 2024
3d7311d
dont spawn it , only phantom can spawn the hax camera.
xAstroBoy Feb 24, 2024
93d884c
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 24, 2024
f65f3a9
apply @D1GQ Changes
xAstroBoy Feb 24, 2024
65a14c5
Update JesterEnemyController.cs
xAstroBoy Feb 24, 2024
99eb129
remove killAnimation Check.
xAstroBoy Feb 24, 2024
c0301a8
Fix Jester & Spider
xAstroBoy Feb 24, 2024
fae48cb
Fix ClientID
xAstroBoy Feb 24, 2024
33ecfad
style: format scripts
github-actions[bot] Feb 24, 2024
e6cff54
Merge branch 'main' into New-Camera
winstxnhdw Feb 24, 2024
c1e31ab
Apply suggestions from code review
xAstroBoy Feb 24, 2024
0b2bd7a
Update JesterEnemyController.cs
xAstroBoy Feb 24, 2024
3595251
Fix Kill Animation
xAstroBoy Feb 24, 2024
21ebf09
Merge branch 'main' into New-Camera
winstxnhdw Feb 25, 2024
132c33b
style: format scripts
github-actions[bot] Feb 25, 2024
ca4a607
refactor: use actual enemy names
winstxnhdw Feb 25, 2024
924c36a
Added camera offsets to all enemies
D1GQ Feb 25, 2024
b417761
Added old enemy rotation back for no clip.
D1GQ Feb 25, 2024
ea177a1
Update BaboonHawkController.cs
xAstroBoy Feb 25, 2024
db6718e
Update BrackenController.cs
xAstroBoy Feb 25, 2024
50f0094
Merge pull request #2 from D1GQ/main
xAstroBoy Feb 25, 2024
8817478
Update BaboonHawkController.cs
xAstroBoy Feb 25, 2024
c436282
style: format scripts
github-actions[bot] Feb 25, 2024
0c92940
add treshold back
xAstroBoy Feb 25, 2024
1d9dda1
Update SandSpiderController.cs
xAstroBoy Feb 25, 2024
70fd167
Get rid of OnPlayerCollision, just patch PlayerTargetable
xAstroBoy Feb 25, 2024
e4993db
restore chqnges
xAstroBoy Feb 25, 2024
149d153
restore chqnges
xAstroBoy Feb 25, 2024
a1fff9f
Get rid of OnPlayerCollision, just patch PlayerTargetable
xAstroBoy Feb 25, 2024
b5671ab
style: format scripts
github-actions[bot] Feb 25, 2024
6b40084
style: format scripts
github-actions[bot] Feb 25, 2024
94e7ebc
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 25, 2024
039ae74
Update HoardingBugController.cs
xAstroBoy Feb 25, 2024
233a6b9
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 25, 2024
69f2fea
Merge pull request #3 from D1GQ/main
xAstroBoy Feb 25, 2024
f6067ff
Renaming
xAstroBoy Feb 25, 2024
cbb85bc
Fix Spider rotation for good
xAstroBoy Feb 25, 2024
6fee407
Better approach for Cam & Position offsets
xAstroBoy Feb 26, 2024
e738e67
cleanup
xAstroBoy Feb 26, 2024
40a54b4
style: format scripts
github-actions[bot] Feb 26, 2024
ae0cf5f
add X offset for camera (if needed)
xAstroBoy Feb 26, 2024
4e95328
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 26, 2024
69ab3a4
style: format scripts
github-actions[bot] Feb 26, 2024
f9bfe92
Update EyelessDogController.cs
xAstroBoy Feb 26, 2024
b39b3f0
style: format scripts
github-actions[bot] Feb 26, 2024
0e99a59
Merge branch 'main' into New-Camera
winstxnhdw Feb 26, 2024
19a1624
Merge branch 'main' into New-Camera
winstxnhdw Feb 26, 2024
ae7a8ca
Merge branch 'main' into New-Camera
winstxnhdw Feb 26, 2024
20f6256
perf(reflector): add caching capability
winstxnhdw Feb 26, 2024
1a9812f
Merge branch 'main' into New-Camera
xAstroBoy Feb 26, 2024
afb6219
Merge branch 'main' into New-Camera
winstxnhdw Feb 27, 2024
e5e91a7
style: format scripts
github-actions[bot] Feb 27, 2024
512b32d
Dont destroy camera anymore
xAstroBoy Feb 27, 2024
95975f3
style: format scripts
github-actions[bot] Feb 27, 2024
3cef6b7
Attempt to make camera exactly where player is looking at.
xAstroBoy Feb 27, 2024
719426e
style: format scripts
github-actions[bot] Feb 27, 2024
80dd516
Update HaxCamera.cs
xAstroBoy Feb 27, 2024
b7cfd37
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 27, 2024
0090eb6
style: format scripts
github-actions[bot] Feb 27, 2024
c7abbb4
Minor fixes
xAstroBoy Feb 27, 2024
d67f9e6
Update HaxCamera.cs
xAstroBoy Feb 27, 2024
7fb3bfc
Update HaxCamera.cs
xAstroBoy Feb 27, 2024
b6e27c7
turn gameobject directly than component.
xAstroBoy Feb 27, 2024
9140e5c
Update HaxCamera.cs
xAstroBoy Feb 27, 2024
2ec1877
style: format scripts
github-actions[bot] Feb 27, 2024
7b0ba13
Merge branch 'main' into New-Camera
xAstroBoy Feb 27, 2024
fbf9c6d
Update PhantomMod.cs
xAstroBoy Feb 27, 2024
3e709bc
style: format scripts
github-actions[bot] Feb 27, 2024
077794b
Update HaxCamera.cs
xAstroBoy Feb 27, 2024
73c5157
style: format scripts
github-actions[bot] Feb 27, 2024
c6e3996
Fix camera not deactivating
xAstroBoy Feb 27, 2024
bea15e1
Update Camera.cs
xAstroBoy Feb 27, 2024
99a8c56
style: format scripts
github-actions[bot] Feb 27, 2024
6d6d8fb
Bring camera disabler again
xAstroBoy Feb 27, 2024
3507722
Since we are not setting the parent, we copy the camera properties
xAstroBoy Feb 27, 2024
d0d8231
use ActiveCamera from now on
xAstroBoy Feb 27, 2024
5e3f31b
style: format scripts
github-actions[bot] Feb 27, 2024
7da9d91
Update PlayerIsTargetablePatch.cs
xAstroBoy Feb 28, 2024
3f7f038
Merge pull request #4 from D1GQ/main
xAstroBoy Feb 28, 2024
7b830ac
style: format scripts
github-actions[bot] Feb 28, 2024
b698f3a
Update PossessionPatch.cs
xAstroBoy Feb 28, 2024
235fb20
style: format scripts
github-actions[bot] Feb 28, 2024
d9ebb82
Update PossessionPatch.cs
xAstroBoy Feb 28, 2024
b5029a0
style: format scripts
github-actions[bot] Feb 28, 2024
2f90006
Update PossessionPatch.cs
xAstroBoy Feb 28, 2024
92278ba
Fixed 9967d56c6ef19af86424e8ed04459a42df6aac24 change that broke Cent…
xAstroBoy Feb 28, 2024
0d78be7
style: format scripts
github-actions[bot] Feb 28, 2024
e927bdc
Update PlayerIsTargetablePatch.cs
xAstroBoy Feb 28, 2024
4c5a8c1
style: format scripts
github-actions[bot] Feb 28, 2024
71b50f9
Update PlayerIsTargetablePatch.cs
xAstroBoy Feb 28, 2024
e42bab4
style: format scripts
github-actions[bot] Feb 28, 2024
f47199b
Update PlayerIsTargetablePatch.cs
xAstroBoy Feb 28, 2024
cee2348
Remove Ghost Girl WIP Controller
xAstroBoy Feb 28, 2024
38cae27
Update PossessionMod.cs
xAstroBoy Feb 28, 2024
f7a6c88
Update PlayerIsTargetablePatch.cs
xAstroBoy Feb 28, 2024
b458261
Merge branch 'winstxnhdw:main' into New-Camera
xAstroBoy Feb 28, 2024
085467e
use the right states
xAstroBoy Feb 28, 2024
1969e2e
style: format scripts
github-actions[bot] Feb 28, 2024
8142955
Fixes
xAstroBoy Feb 28, 2024
75095a4
style: format scripts
github-actions[bot] Feb 28, 2024
bbf7282
Have a longer delay if in SENTRY mode
D1GQ Feb 28, 2024
3625403
Merge pull request #5 from D1GQ/main
xAstroBoy Feb 28, 2024
62543d7
Fixes
xAstroBoy Feb 28, 2024
8648749
Fixes
xAstroBoy Feb 28, 2024
fbfdcf5
style: format scripts
github-actions[bot] Feb 28, 2024
e301cde
Fixed issues with spider nesting.
D1GQ Feb 29, 2024
533f547
Merge branch 'main' of https://github.com/D1GQ/lc-hax-small-controlle…
D1GQ Feb 29, 2024
a4add73
Fixed reoccurring IsAbleToMove issues
D1GQ Feb 29, 2024
e8f8d21
Hoarder Bug special ability, Play chitterSFX, if Modded Yippee.
D1GQ Feb 29, 2024
e0eda9c
Merge pull request #6 from D1GQ/main
xAstroBoy Feb 29, 2024
7c98630
Overhaul of PossessionMod
xAstroBoy Feb 29, 2024
2db69ea
Overhaul of PossessionMod
xAstroBoy Feb 29, 2024
acd5961
style: format scripts
github-actions[bot] Feb 29, 2024
611c85d
Update HoardingBugController.cs
xAstroBoy Feb 29, 2024
b45bb2d
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 29, 2024
9610d11
Update PossessionMod.cs
xAstroBoy Feb 29, 2024
b0654fb
style: format scripts
github-actions[bot] Feb 29, 2024
2935fef
Discard changes to lc-hax/Scripts/Commands/Mod Toggles/SanityToggle.cs
xAstroBoy Feb 29, 2024
c1f1618
Discard changes to lc-hax/Scripts/Commands/UnlimitedJumpCommand.cs
xAstroBoy Feb 29, 2024
86cee92
Discard changes to lc-hax/Scripts/Modules/SaneMod.cs
xAstroBoy Feb 29, 2024
a42d507
Update HoardingBugController.cs
xAstroBoy Feb 29, 2024
6494b09
Disable certain keys if typing.
xAstroBoy Feb 29, 2024
a27616b
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 29, 2024
95c3873
Update PossessionPatch.cs
xAstroBoy Feb 29, 2024
3c42f4a
block possession movement if typing.
xAstroBoy Feb 29, 2024
5fd264c
style: format scripts
github-actions[bot] Feb 29, 2024
7d4a270
Update HudPatch.cs
xAstroBoy Feb 29, 2024
bd2f85f
Update HudPatch.cs
xAstroBoy Feb 29, 2024
5a900e7
Update HudPatch.cs
xAstroBoy Feb 29, 2024
1986b27
style: format scripts
github-actions[bot] Feb 29, 2024
bc2b2bd
Update PossessionMod.cs
xAstroBoy Feb 29, 2024
cc27f5a
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 29, 2024
fa8fdac
Remove cooldown, use E to interact
xAstroBoy Feb 29, 2024
a9013b3
make instead interact than just move
xAstroBoy Feb 29, 2024
37a22bd
style: format scripts
github-actions[bot] Feb 29, 2024
2322737
allow enemies to open/close doors.
xAstroBoy Feb 29, 2024
bad384b
Merge branch 'New-Camera' of https://github.com/xAstroBoy/lc-hax into…
xAstroBoy Feb 29, 2024
9459239
allow enemies to open/close doors.
xAstroBoy Feb 29, 2024
da39153
style: format scripts
github-actions[bot] Feb 29, 2024
420f678
Merge branch 'main' into New-Camera
winstxnhdw Feb 29, 2024
e21d88f
Fixes and allow interaction with E on doors for enemies.
xAstroBoy Feb 29, 2024
253592c
Fixes and allow interaction with E on doors for enemies.
xAstroBoy Feb 29, 2024
443b5b6
style: format scripts
github-actions[bot] Feb 29, 2024
7887539
Cleanup and prevent raycast if maxrange is 0
xAstroBoy Feb 29, 2024
384c7b0
style: format scripts
github-actions[bot] Feb 29, 2024
3c7d15a
Cleanup
xAstroBoy Feb 29, 2024
0ce5e0f
style: format scripts
github-actions[bot] Feb 29, 2024
40f2c00
Update MaskedController.cs
xAstroBoy Feb 29, 2024
69b6a17
Merge branch 'main' into New-Camera
xAstroBoy Mar 1, 2024
4d7200c
feat: introduce experimental `fall` command
winstxnhdw Mar 4, 2024
5ed85de
Merge branch 'main' into New-Camera
winstxnhdw Mar 4, 2024
1d2724c
Merge branch 'main' into New-Camera
xAstroBoy Mar 5, 2024
aba1218
Discard changes to lc-hax/Scripts/Commands/FallCommand.cs
xAstroBoy Mar 5, 2024
1672df3
Merge branch 'main' into New-Camera
winstxnhdw Mar 5, 2024
554d813
Merge branch 'main' into New-Camera
winstxnhdw Mar 7, 2024
02318b2
refactor: remove redundant conditionals
winstxnhdw Mar 7, 2024
62d10aa
Merge branch 'main' into New-Camera
winstxnhdw Mar 16, 2024
8e890d7
style: fix whitespaces and indentation
winstxnhdw Mar 16, 2024
d85b4b2
refactor: cheat-relevant code should not be coupled with generic list…
winstxnhdw Mar 16, 2024
40eca1b
refactor/perf: infinitely cleaner and some perf wins
winstxnhdw Mar 16, 2024
2b0dd62
style: format scripts
github-actions[bot] Mar 16, 2024
2c7809b
feat: add `space` event
winstxnhdw Mar 16, 2024
756ad78
refactor: clean up baboon and bracken controllers
winstxnhdw Mar 16, 2024
e2ef82f
Merge branch 'main' into New-Camera
winstxnhdw Mar 17, 2024
90e5057
refactor: clean up controllers
winstxnhdw Mar 17, 2024
16b32a7
Merge branch 'main' into New-Camera
winstxnhdw Mar 17, 2024
48602a2
style: use full name consistently
winstxnhdw Mar 17, 2024
c93264b
fix: properly toggle sprinting
winstxnhdw Mar 17, 2024
90c60c7
feat: nobody asked for this
winstxnhdw Mar 17, 2024
0bc6215
refactor: bring back possession patch
winstxnhdw Mar 17, 2024
c875fee
chore: revert HUDPatch
winstxnhdw Mar 17, 2024
94286d6
refactor: light clean up
winstxnhdw Mar 17, 2024
729dc6e
refactor: abstract long condition into method
winstxnhdw Mar 17, 2024
1d93b7f
feat: allow enemies to attack outside
winstxnhdw Mar 17, 2024
275daeb
style: rearrange and rename
winstxnhdw Mar 17, 2024
778dc4a
Merge branch 'main' into New-Camera
winstxnhdw Mar 17, 2024
c5b9e83
refactor: massively cleaner HaxCamera
winstxnhdw Mar 17, 2024
b39c60e
refactor: certain things need not be copied
winstxnhdw Mar 17, 2024
2a365f3
refactor: no longer necessary to disable kb and mouse
winstxnhdw Mar 17, 2024
eb7c0f4
refactor: remove unnecessary internal
winstxnhdw Mar 17, 2024
75eb030
feat/docs: set all placeable objects upright
winstxnhdw Mar 19, 2024
cd1881a
Merge branch 'main' into New-Camera
winstxnhdw Mar 19, 2024
f32b719
Merge branch 'main' into New-Camera
winstxnhdw Mar 19, 2024
9720f2a
Merge branch 'main' into New-Camera
winstxnhdw Mar 25, 2024
6bf31e5
Merge branch 'main' into New-Camera
winstxnhdw Apr 10, 2024
88768fb
Merge branch 'main' into New-Camera
winstxnhdw Apr 14, 2024
70bbbd8
Merge branch 'main' into New-Camera
winstxnhdw Apr 20, 2024
1bdbf05
Merge branch 'main' into New-Camera
xAstroBoy Apr 28, 2024
31e830b
Merge branch 'main' into New-Camera
winstxnhdw Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lc-hax/Scripts/Helpers/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ namespace Hax;

internal static partial class Helper {
internal static Camera? CurrentCamera =>
Helper.LocalPlayer?.gameplayCamera is Camera { enabled: true } gameplayCamera
? gameplayCamera
: Helper.StartOfRound?.spectateCamera;
Setting.EnablePhantom
? GetCustomCamera()
: Helper.LocalPlayer?.gameplayCamera is Camera { enabled: true } gameplayCamera
? gameplayCamera
: Helper.StartOfRound?.spectateCamera;


internal static Vector3 WorldToEyesPoint(this Camera camera, Vector3 worldPosition) {
Vector3 screen = camera.WorldToViewportPoint(worldPosition);
Expand Down
12 changes: 10 additions & 2 deletions lc-hax/Scripts/Helpers/Enemies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@ internal static void Kill(this EnemyAI enemy, ulong actualClientId) {
}
}

internal static void SetOutsideStatus(this EnemyAI enemy, bool isOutside) {
if (enemy.isOutside == isOutside) return;
internal static bool SetOutsideStatus(this EnemyAI enemy, bool isOutside) {
if (enemy.isOutside == isOutside) return false;

enemy.isOutside = isOutside;
enemy.allAINodes = GameObject.FindGameObjectsWithTag(enemy.isOutside ? "OutsideAINode" : "AINode");
Transform closestNodePos = enemy.ChooseClosestNodeToPosition(enemy.transform.position, false, 0);
_ = enemy.SetDestinationToPosition(closestNodePos.position, true);
_ = enemy.agent.Warp(enemy.transform.position);
enemy.SyncPositionToClients();
enemy.agent.ResetPath();
enemy.EnableEnemyMesh(true, false);
enemy.StopSearch(enemy.currentSearch, true);
return true;
}

internal static void Kill(EnemyAI enemy) {
Expand Down
87 changes: 87 additions & 0 deletions lc-hax/Scripts/Helpers/LcHaxCamera.cs
Copy link
Owner

@winstxnhdw winstxnhdw Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this a Hax GameObject instead? I can do it but I won’t be able to work on this until sometime next week.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the intention is to stop using the player's stock camera, and use one of our own for Phantom and the rest, because it will not influence enemies's AIs , as they mostly target the .GamePlayCamera.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Since it’s a core feature, I want it to be added to Loader.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Since it’s a core feature, I want it to be added to Loader.

Go ahead, there's no more changes to add to this mod, the camera is stable with @D1GQ 's changes, just sometimes when you die under noclip it breaks, but i haven't figured how to completely kill this bug,

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can’t merge with such a bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can’t merge with such a bug.

is rare but happens, i haven't got this bug, but i think if we make a core mod out of this, we can sync it with player's death and switch the default camera to activate when the LC-Hax camera is destroyed.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is always been a problem just never caused issues with noclip, the problem is when you come back from phantom mode while dead there is a chance to start spectating someone that is dead, and for some reason nocliping breaks with it now.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

#pragma warning disable CS8603 // Possible null reference return.

namespace Hax;

internal static partial class Helper {

internal static Camera? GameCamera =>
Helper.LocalPlayer?.gameplayCamera is Camera { enabled: true } gameplayCamera
? gameplayCamera
: Helper.StartOfRound?.spectateCamera;

static GameObject? CustomCameraObj = null;

static Camera? CustomCamera;

internal static void DestroyCustomCam() {
if (CustomCameraObj != null) {
Object.DestroyImmediate(CustomCameraObj);
}

CustomCameraObj = null;
CustomCamera = null;
if (!Helper.LocalPlayer.IsDead()) {
if (Helper.LocalPlayer?.gameplayCamera is Camera camData) {
camData.enabled = true;
}
}
}

internal static Camera GetCustomCamera() {
if (Helper.LocalPlayer?.gameplayCamera is not Camera camData) return null;
if (CustomCamera is not null) return CustomCamera;
CustomCameraObj ??= new GameObject("lc-hax Camera");

Camera? newCam = CustomCameraObj.AddComponent<Camera>();
if (newCam is null) return null;
newCam.transform.position = camData.transform.position;
newCam.transform.rotation = camData.transform.rotation;

// Copy camera settings
newCam.CopyFrom(camData);

// Ensure the custom camera has the same culling mask as the original camera
newCam.cullingMask = camData.cullingMask;

// Copy other relevant properties
newCam.clearFlags = camData.clearFlags;
newCam.backgroundColor = camData.backgroundColor;
newCam.nearClipPlane = camData.nearClipPlane;
newCam.farClipPlane = camData.farClipPlane;
newCam.fieldOfView = camData.fieldOfView;
newCam.depth = camData.depth;
newCam.renderingPath = camData.renderingPath;

// this makes it work as the actual camera
newCam.tag = camData.tag;
// add a listener to the camera using the same settings as the original camera
AudioListener? listener = newCam.gameObject.AddComponent<AudioListener>();
if (listener != null) listener.enabled = true;
if (camData.TryGetComponent(out HDAdditionalCameraData dataToCopy)) {
HDAdditionalCameraData? hdData = newCam.gameObject.AddComponent<HDAdditionalCameraData>();
if (hdData != null && dataToCopy != null) {
hdData.customRenderingSettings = true;
hdData.renderingPathCustomFrameSettingsOverrideMask.mask =
dataToCopy.renderingPathCustomFrameSettingsOverrideMask.mask;
hdData.renderingPathCustomFrameSettings.SetEnabled(FrameSettingsField.CustomPass,
dataToCopy.renderingPathCustomFrameSettings.IsEnabled(FrameSettingsField.CustomPass));
hdData.renderingPathCustomFrameSettings.SetEnabled(FrameSettingsField.Volumetrics,
dataToCopy.renderingPathCustomFrameSettings.IsEnabled(FrameSettingsField.Volumetrics));
hdData.renderingPathCustomFrameSettings.lodBiasMode =
dataToCopy.renderingPathCustomFrameSettings.lodBiasMode;
hdData.renderingPathCustomFrameSettings.lodBias = dataToCopy.renderingPathCustomFrameSettings.lodBias;
hdData.antialiasing = dataToCopy.antialiasing;
hdData.renderingPathCustomFrameSettings.SetEnabled(FrameSettingsField.ShadowMaps,
dataToCopy.renderingPathCustomFrameSettings.IsEnabled(FrameSettingsField.ShadowMaps));
}
}

newCam.enabled = true;
CustomCamera = newCam;
return CustomCamera;
}

}
4 changes: 4 additions & 0 deletions lc-hax/Scripts/Helpers/Players.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ internal static bool GrabObject(this PlayerControllerB player, GrabbableObject g

return true;
}
internal static bool IsDead(this PlayerControllerB? instance) => instance is not null && (!instance.isPlayerControlled || instance.health <= 0);
xAstroBoy marked this conversation as resolved.
Show resolved Hide resolved

internal static PlayerControllerB? GetPlayerFromBody(this RagdollGrabbableObject body) => Helper.GetPlayer(body.bodyID.Value);

}
36 changes: 16 additions & 20 deletions lc-hax/Scripts/Modules/PhantomMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,23 @@ void PhantomEnabled(Camera camera) {

void PhantomDisabled(PlayerControllerB player, Camera camera) {
if (player.cameraContainerTransform is not Transform cameraParent) return;
if (player.gameplayCamera is not Camera gameplayCamera) return;
if (this.IsShiftHeld) {
player.TeleportPlayer(camera.transform.position);
}

if (PossessionMod.Instance is PossessionMod { IsPossessed: true } possession) {
possession.Unpossess();
}

camera.transform.SetParent(cameraParent, false);
camera.transform.localPosition = Vector3.zero;
camera.transform.localRotation = Quaternion.identity;

if (camera.gameObject.TryGetComponent(out KeyboardMovement keyboard)) {
keyboard.enabled = false;
Helper.DestroyCustomCam();
if (!player.IsDead()) {
gameplayCamera.enabled = true;
}

if (camera.gameObject.TryGetComponent(out MousePan mouse)) {
mouse.enabled = false;
if (PossessionMod.Instance is PossessionMod { IsPossessed: true } possession) {
possession.Unpossess();
}

if (player.gameplayCamera is not Camera gameplayCamera) {
return;
}
gameplayCamera.transform.SetParent(cameraParent, false);
gameplayCamera.transform.localPosition = Vector3.zero;
gameplayCamera.transform.localRotation = Quaternion.identity;

if (gameplayCamera.TryGetComponent(out KeyboardMovement gameplayKeyboard)) {
gameplayKeyboard.enabled = false;
Expand All @@ -128,20 +122,22 @@ void PhantomDisabled(PlayerControllerB player, Camera camera) {

void TogglePhantom() {
if (Helper.LocalPlayer is not PlayerControllerB player) return;
if (Helper.CurrentCamera is not Camera camera || !camera.enabled) return;
if (Helper.GameCamera is not Camera camera) return;

camera.enabled = !Setting.EnablePhantom;
Setting.EnablePhantom = !Setting.EnablePhantom;
player.enabled = !player.isPlayerDead || !Setting.EnablePhantom;
player.enabled = !player.IsDead() || !Setting.EnablePhantom;
player.playerBodyAnimator.enabled = !Setting.EnablePhantom;
player.thisController.enabled = !Setting.EnablePhantom;
player.isFreeCamera = Setting.EnablePhantom;

if (Setting.EnablePhantom) {
this.PhantomEnabled(camera);
Camera? customCamera = Helper.GetCustomCamera();
if (customCamera != null) this.PhantomEnabled(customCamera);
}

else {
this.PhantomDisabled(player, camera);
Camera? customCamera = Helper.GetCustomCamera();
if (customCamera != null) this.PhantomDisabled(player, customCamera);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ internal class BaboonHawkController : IEnemyController<BaboonBirdAI> {
Vector3 CustomCamp { get; } = new Vector3(1000.0f, 0.0f, 0.0f);
Vector3 OriginalCamp { get; set; } = Vector3.zero;


public void OnOutsideStatusChange(BaboonBirdAI enemy) => enemy.StopSearch(enemy.scoutingSearchRoutine, true);

public void OnDeath(BaboonBirdAI enemy) {
if (enemy.heldScrap is not null) {
_ = enemy.Reflect().InvokeInternalMethod("DropHeldItemAndSync");
Expand All @@ -20,7 +23,6 @@ public void OnDeath(BaboonBirdAI enemy) {

public void OnPossess(BaboonBirdAI _) {
if (BaboonBirdAI.baboonCampPosition != this.CustomCamp) return;

this.OriginalCamp = BaboonBirdAI.baboonCampPosition;
BaboonBirdAI.baboonCampPosition = this.CustomCamp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ enum BrackenState {
}

internal class BrackenController : IEnemyController<FlowermanAI> {

public void UsePrimarySkill(FlowermanAI enemy) {
if (!enemy.carryingPlayerBody) {
enemy.SetBehaviourState(BrackenState.ANGER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ public void UsePrimarySkill(RedLocustBees enemy) {
}

public void UseSecondarySkill(RedLocustBees enemy) => enemy.SetBehaviourState(BeesState.IDLE);

public void OnOutsideStatusChange(RedLocustBees enemy) => enemy.StopSearch(enemy.searchForHive, true);

}

Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ internal class CoilHeadController : IEnemyController<SpringManAI> {
public bool IsAbleToRotate(SpringManAI enemy) => !this.GetStoppingMovement(enemy);

public float InteractRange(SpringManAI _) => 1.5f;

public void OnOutsideStatusChange(SpringManAI enemy) => enemy.StopSearch(enemy.searchForPlayers, true);



}

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ internal class CrawlerController : IEnemyController<CrawlerAI> {
public void UseSecondarySkill(CrawlerAI enemy) => enemy.MakeScreechNoiseServerRpc();

public void UsePrimarySkill(CrawlerAI enemy) => enemy.CollideWithWallServerRpc();

public void OnOutsideStatusChange(CrawlerAI enemy) => enemy.StopSearch(enemy.searchForPlayers, true);

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ public void UseSecondarySkill(SandWormAI enemy) {
public float InteractRange(SandWormAI _) => 0.0f;

public bool SyncAnimationSpeedEnabled(SandWormAI _) => false;
public void OnOutsideStatusChange(SandWormAI enemy) => enemy.StopSearch(enemy.roamMap, true);

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ public void OnMovement(MouthDogAI enemy, bool isMoving, bool isSprinting) {
public string GetSecondarySkillName(MouthDogAI _) => "Lunge";

public float InteractRange(MouthDogAI _) => 2.5f;

public void OnOutsideStatusChange(MouthDogAI enemy) => enemy.StopSearch(enemy.roamPlanet, true);

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ public void ReleaseSecondarySkill(ForestGiantAI enemy) {
public void OnUnpossess(ForestGiantAI enemy) => this.IsUsingSecondarySkill = false;

public bool SyncAnimationSpeedEnabled(ForestGiantAI _) => false;

public void OnOutsideStatusChange(ForestGiantAI enemy) {
enemy.StopSearch(enemy.roamPlanet, true);
enemy.StopSearch(enemy.searchForPlayers, true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,10 @@ public void UseSecondarySkill(HoarderBugAI enemy) {
public string GetSecondarySkillName(HoarderBugAI enemy) => enemy.heldItem is null ? "" : "Drop item";

public float InteractRange(HoarderBugAI _) => 1.0f;

public void OnOutsideStatusChange(HoarderBugAI enemy) {
enemy.StopSearch(enemy.searchForItems, true);
enemy.StopSearch(enemy.searchForPlayer, true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ public void OnSecondarySkillHold(BlobAI enemy) {
public float InteractRange(BlobAI _) => 3.5f;

public float SprintMultiplier(BlobAI _) => 9.8f;

public void OnOutsideStatusChange(BlobAI enemy) => enemy.StopSearch(enemy.searchForPlayers, true);


}

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ internal interface IController {
float SprintMultiplier(EnemyAI enemy);

bool SyncAnimationSpeedEnabled(EnemyAI enemy);

void OnOutsideStatusChange(EnemyAI enemy);
}

internal interface IEnemyController<T> : IController where T : EnemyAI {
Expand Down Expand Up @@ -73,6 +75,8 @@ void OnMovement(T enemy, bool isMoving, bool isSprinting) { }

bool SyncAnimationSpeedEnabled(T enemy) => true;

void OnOutsideStatusChange(T enemy) { }

void IController.OnPossess(EnemyAI enemy) => this.OnPossess((T)enemy);

void IController.OnUnpossess(EnemyAI enemy) => this.OnUnpossess((T)enemy);
Expand Down Expand Up @@ -106,4 +110,6 @@ void OnMovement(T enemy, bool isMoving, bool isSprinting) { }
float IController.SprintMultiplier(EnemyAI enemy) => this.SprintMultiplier((T)enemy);

bool IController.SyncAnimationSpeedEnabled(EnemyAI enemy) => this.SyncAnimationSpeedEnabled((T)enemy);

void IController.OnOutsideStatusChange(EnemyAI enemy) => this.OnOutsideStatusChange((T)enemy);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ public void ReleaseSecondarySkill(JesterAI enemy) {
public string GetSecondarySkillName(JesterAI _) => "(HOLD) Begin cranking";

public float InteractRange(JesterAI _) => 1.0f;

public void OnOutsideStatusChange(JesterAI enemy) => enemy.StopSearch(enemy.roamMap, true);

}

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ internal class LassoManController : IEnemyController<LassoManAI> {
public void UsePrimarySkill(LassoManAI enemy) => enemy.MakeScreechNoiseServerRpc();

public bool SyncAnimationSpeedEnabled(LassoManAI enemy) => false;

public void OnOutsideStatusChange(LassoManAI enemy) => enemy.StopSearch(enemy.searchForPlayers, true);

}

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ internal class MaskedPlayerController : IEnemyController<MaskedPlayerEnemy> {
public float InteractRange(MaskedPlayerEnemy _) => 1.0f;

public bool SyncAnimationSpeedEnabled(MaskedPlayerEnemy _) => false;

public void OnOutsideStatusChange(MaskedPlayerEnemy enemy) => enemy.StopSearch(enemy.searchForPlayers, true);

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ public void ReleaseSecondarySkill(NutcrackerEnemyAI enemy) {
public string GetSecondarySkillName(NutcrackerEnemyAI _) => "(HOLD) Sentry mode";

public float InteractRange(NutcrackerEnemyAI _) => 1.5f;

public void OnOutsideStatusChange(NutcrackerEnemyAI enemy) {
enemy.StopSearch(enemy.attackSearch, true);
enemy.StopSearch(enemy.patrol, true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
using UnityEngine;

internal class SandSpiderController : IEnemyController<SandSpiderAI> {
public void OnMovement(SandSpiderAI enemy, bool isMoving, bool isSprinting) {
enemy.creatureAnimator.SetBool("moving", true);
// spider is too slow, make it like 6f default, 8f sprinting
float speed = isSprinting ? 8.0f : 6.0f;
enemy.agent.speed = speed;
enemy.spiderSpeed = speed;
public void Update(SandSpiderAI enemy, bool isAIControlled) {
enemy.meshContainerPosition = enemy.transform.position;
enemy.meshContainerTarget = enemy.transform.position;
enemy.eye.LookAt(enemy.transform.position - (enemy.transform.forward * 2) + (enemy.transform.right * 0.1f));
enemy.SyncMeshContainerPositionToClients();
if (!isAIControlled) enemy.homeNode = enemy.ChooseClosestNodeToPosition(enemy.transform.position, false, 2);
}

public bool SyncAnimationSpeedEnabled(SandSpiderAI enemy) => false;

public void UsePrimarySkill(SandSpiderAI enemy) => this.PlaceWebTrap(enemy);

void PlaceWebTrap(SandSpiderAI enemy) {
Expand All @@ -36,5 +37,9 @@ void PlaceWebTrap(SandSpiderAI enemy) {
Vector3 floorPosition = groundHit.point + (Vector3.up * 0.2f);
enemy.SpawnWebTrapServerRpc(floorPosition, raycastHit.point);
}

public void OnOutsideStatusChange(SandSpiderAI enemy) => enemy.StopSearch(enemy.patrolHomeBase, true);


}

Loading
Loading