-
Notifications
You must be signed in to change notification settings - Fork 25
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
base: main
Are you sure you want to change the base?
use external camera #419
Conversation
Co-authored-by: Winston H. <56998716+winstxnhdw@users.noreply.github.com>
@winstxnhdw looks solid to me, i have been testing these past 3 hours and got this custom camera to work and preserve hud and the rest, enemies work properly when they go outside, and best of all spider now follows the controller . |
@winstxnhdw with the jester i had to add a new Event , OnPlayerCollision , because for some weird reason the jester wouldn't kill a player if outside, so i fixed that. EDIT : i checked the other enemies that are inside and replicated their collision system without a check to make sure they work |
the blur ? you can read how the haxcamera is spawned and is not supposed to get rid of that blur or replace the camera, maybe is another mod or something else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 3
Configuration used: CodeRabbit UI
Files selected for processing (6)
- lc-hax/Scripts/Core/HaxCamera.cs (1 hunks)
- lc-hax/Scripts/Helpers/Camera.cs (1 hunks)
- lc-hax/Scripts/Modules/PhantomMod.cs (4 hunks)
- lc-hax/Scripts/Modules/Possession/PossessionMod.cs (1 hunks)
- lc-hax/Scripts/Modules/TriggerMod.cs (3 hunks)
- lc-hax/Scripts/Patches/PossessionPatch.cs (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- lc-hax/Scripts/Core/HaxCamera.cs
- lc-hax/Scripts/Helpers/Camera.cs
- lc-hax/Scripts/Modules/PhantomMod.cs
- lc-hax/Scripts/Patches/PossessionPatch.cs
Additional comments: 2
lc-hax/Scripts/Modules/TriggerMod.cs (1)
- 92-92: The integration of
GetPossessableEnemy
in theFire
method simplifies the logic and improves readability. However, consider profiling this change to ensure it does not introduce performance issues, especially in scenarios with many colliders.lc-hax/Scripts/Modules/Possession/PossessionMod.cs (1)
- 13-13: The implementation of the
Controller
property is appropriate for its intended use, allowing for the dynamic assignment of control logic for possessed enemies.
void InitCharacterMovement(EnemyAI? enemy = null) { | ||
this.CharacterMovementInstance = new GameObject("Hax CharacterMovement"); | ||
this.CharacterMovementInstance.transform.position = enemy is null ? default : enemy.transform.position; | ||
this.CharacterMovement = this.CharacterMovementInstance.AddComponent<CharacterMovement>(); | ||
this.CharacterMovement.Init(); | ||
|
||
if (enemy is not null) { | ||
this.CharacterMovement.CalibrateCollision(enemy); | ||
this.CharacterMovement.CharacterSprintSpeed = this.SprintMultiplier(enemy); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that CharacterMovement
instances are properly disposed of before creating a new one to prevent memory leaks. Consider adding a check to destroy the existing CharacterMovementInstance
if it's not null before creating a new one.
+ if (this.CharacterMovementInstance != null) {
+ Destroy(this.CharacterMovementInstance);
+ }
this.CharacterMovementInstance = new GameObject("Hax CharacterMovement");
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
void InitCharacterMovement(EnemyAI? enemy = null) { | |
this.CharacterMovementInstance = new GameObject("Hax CharacterMovement"); | |
this.CharacterMovementInstance.transform.position = enemy is null ? default : enemy.transform.position; | |
this.CharacterMovement = this.CharacterMovementInstance.AddComponent<CharacterMovement>(); | |
this.CharacterMovement.Init(); | |
if (enemy is not null) { | |
this.CharacterMovement.CalibrateCollision(enemy); | |
this.CharacterMovement.CharacterSprintSpeed = this.SprintMultiplier(enemy); | |
} | |
} | |
void InitCharacterMovement(EnemyAI? enemy = null) { | |
if (this.CharacterMovementInstance != null) { | |
Destroy(this.CharacterMovementInstance); | |
} | |
this.CharacterMovementInstance = new GameObject("Hax CharacterMovement"); | |
this.CharacterMovementInstance.transform.position = enemy is null ? default : enemy.transform.position; | |
this.CharacterMovement = this.CharacterMovementInstance.AddComponent<CharacterMovement>(); | |
this.CharacterMovement.Init(); | |
if (enemy is not null) { | |
this.CharacterMovement.CalibrateCollision(enemy); | |
this.CharacterMovement.CharacterSprintSpeed = this.SprintMultiplier(enemy); | |
} | |
} |
Oh, you're right. I am blind. |
lc-hax/Scripts/Core/HaxCamera.cs
Outdated
this.HaxCamAudioListener.enabled = true; | ||
this.HaxCameraContainer.SetActive(false); | ||
this.CustomCamera = newCamera; | ||
DontDestroyOnLoad(this.HaxCameraContainer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? HaxCamera is already set to not destroy on load in Loader.cs right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the container where the camera is not , the module is , but not the container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to make the container a child of the module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is best not, because the container is programmed to stalk the player.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we the module doesn't stalk the player, we have to expose HaxCameraContainer
which is so unnecessary.
lc-hax/Scripts/Core/HaxCamera.cs
Outdated
internal void SetActive(bool active) { | ||
if (Helper.StartOfRound is not StartOfRound startOfRound) return; | ||
if (Helper.LocalPlayer is not PlayerControllerB player) return; | ||
if (player.activeAudioListener is not AudioListener playerlistener) return; | ||
if (this.HaxCameraContainer is null) return; | ||
if (this.HaxCamAudioListener is not AudioListener haxListener) return; | ||
if (this.GetCamera() is not Camera camera) return; | ||
|
||
this.HaxCameraContainer.SetActive(active); | ||
|
||
if (!this.HaxCameraContainer.activeSelf) { | ||
playerlistener.enabled = true; | ||
startOfRound.audioListener = playerlistener; | ||
startOfRound.activeCamera.enabled = true; | ||
} | ||
else { | ||
this.CopyFromCamera(startOfRound.activeCamera.transform, camera, startOfRound.activeCamera); | ||
startOfRound.activeCamera.enabled = false; | ||
playerlistener.enabled = false; | ||
startOfRound.audioListener = haxListener; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why this cannot be in OnEnable
or OnDisable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the container is disabled, not the manager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am aware, but it doesn't seem like there would be a problem if we use OnEnable
instead. Then we don't have to use the boolean flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- lc-hax/Scripts/Core/HaxCamera.cs (1 hunks)
- lc-hax/Scripts/Modules/ESPMod.cs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- lc-hax/Scripts/Core/HaxCamera.cs
Additional comments: 2
lc-hax/Scripts/Modules/ESPMod.cs (2)
- 58-59: The conditional check introduced for rendering grabbable objects based on possession status and enemy type is clear and aligns with the PR objectives. Ensure to verify its impact on gameplay to avoid unintended side effects.
- 109-109: The addition of a condition to skip rendering for the currently possessed enemy and certain enemy types is consistent with the PR's objectives. Recommend thorough testing to ensure seamless integration with the gameplay experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- lc-hax/Scripts/Core/HaxCamera.cs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- lc-hax/Scripts/Core/HaxCamera.cs
There's still too many things I want to change. I don't like how |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- lc-hax/Scripts/Core/HaxCamera.cs (1 hunks)
- lc-hax/Scripts/Modules/PhantomMod.cs (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- lc-hax/Scripts/Core/HaxCamera.cs
- lc-hax/Scripts/Modules/PhantomMod.cs
f1bfe19
to
1411cd1
Compare
@winstxnhdw just to let you know, im done collabing to your repo trying to follow your strict requirements. |
you never really ever did follow any. cheers. |
the issue is that you dont know how to accept diverse code styles, i understand readability , but how you do it is too much |
I won't argue with you further on this. You probably won't find another maintainer that would bother to refactor your code. All I hope is that you won't keep this attitude at a real job. Also, https://blog.codacy.com/coding-standards Have a nice week. |
Fix Enemies Nodes not updating
Fix spider mesh not following the current position & rotation
when not controlling, the spider will use that last position and claim it as it's nest.
add LcHaxCamera and make all mods use that one on phantom mode.
add isDead()
add OnOutsideStatusChange to reset all enemies's NavMesh's searches to not be broken when AI Nodes update.
@winstxnhdw all done.
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Chores