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 233 commits into
base: main
Choose a base branch
from
Open

use external camera #419

wants to merge 233 commits into from

Conversation

xAstroBoy
Copy link
Contributor

@xAstroBoy xAstroBoy commented Feb 23, 2024

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

    • Added movement permission control and sprinting logic for characters.
    • Introduced dynamic camera positioning to enhance gameplay experience.
    • New classes for controlling characters "Bracken," "Jester," "Manticoil," and "Snare Flea" with unique abilities and camera interactions.
    • Implemented a custom camera setup with advanced controls and settings.
    • Enhanced possession mechanics with updated conditions and event handling.
    • Added phantom mode with enable/disable functionality and improved integration with the game's camera system.
  • Refactor

    • Improved code readability and maintainability in character movement and camera management.
  • Bug Fixes

    • Adjusted camera offset calculations and skill use conditions for a smoother gameplay experience.
  • Chores

    • Updated internal access modifiers and method adjustments for better code organization.

lc-hax/Scripts/Helpers/Players.cs Outdated Show resolved Hide resolved
@xAstroBoy
Copy link
Contributor Author

@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 .

@xAstroBoy
Copy link
Contributor Author

xAstroBoy commented Feb 23, 2024

@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

@xAstroBoy
Copy link
Contributor Author

When you inject while in game, you can see that the colours change slightly. The blur is gone. You could've made it a lot easier for yourself if you just switch back and forth from the new camera and the main camera.

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.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 0bc6215 and 275daeb.
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 the Fire 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.

lc-hax/Scripts/Modules/TriggerMod.cs Show resolved Hide resolved
Comment on lines +60 to +70
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);
}
}
Copy link

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.

Suggested change
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);
}
}

@winstxnhdw
Copy link
Owner

Oh, you're right. I am blind.

this.HaxCamAudioListener.enabled = true;
this.HaxCameraContainer.SetActive(false);
this.CustomCamera = newCamera;
DontDestroyOnLoad(this.HaxCameraContainer);
Copy link
Owner

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?

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 container where the camera is not , the module is , but not the container.

Copy link
Owner

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?

Copy link
Contributor Author

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.

Copy link
Owner

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 Show resolved Hide resolved
Comment on lines 30 to 51
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;
}
}
Copy link
Owner

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?

Copy link
Contributor Author

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

Copy link
Owner

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.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 275daeb and c5b9e83.
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.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between c5b9e83 and b39c60e.
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

@winstxnhdw
Copy link
Owner

winstxnhdw commented Mar 17, 2024

There's still too many things I want to change. I don't like how DisablePhantom is exposed. Phantom should turn off on it's own and not couple with the camera. I'll continue again next week or the week after that.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between b39c60e and eb7c0f4.
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

@xAstroBoy
Copy link
Contributor Author

@winstxnhdw just to let you know, im done collabing to your repo trying to follow your strict requirements.

@winstxnhdw
Copy link
Owner

@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.

@xAstroBoy
Copy link
Contributor Author

xAstroBoy commented Apr 28, 2024

@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

@winstxnhdw
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants