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

Dialog box choice stuff (mega-PR lol) #49

Merged
merged 72 commits into from
Jan 17, 2024
Merged

Dialog box choice stuff (mega-PR lol) #49

merged 72 commits into from
Jan 17, 2024

Conversation

Lamby777
Copy link
Owner

@Lamby777 Lamby777 commented Jan 17, 2024

This one's been going on for way too long. There's one last bug where the second page of the Rodrick Sign interaction won't let you move onto the third, but besides that it seems to work up until then. Gonna merge what I have into master so far, so the battle engine branch can stay somewhat up-to-date, since those 2 features are somewhat related.

Summary by CodeRabbit

  • New Features

    • Enhanced dialog choice display with new positioning and color settings.
    • Added label animation and creation functionalities for dialog choices.
    • Improved menu navigation with the introduction of a new Wrapped struct to manage menu choices.
  • Bug Fixes

    • Fixed the control flow in the stat calculation, ensuring accurate gameplay stats.
  • Refactor

    • Streamlined battle input and action handling by utilizing the new wrapped module functions.
    • Simplified player movement code by adopting shorthand initialization for vectors.
    • Reorganized constants for better module interoperability and consistency.
    • Removed redundant code and updated method structures for dialog boxes.
    • Updated the stats interface to reflect semantic changes in variable naming.
  • Style

    • Cleaned up import orders and renamed parameters for clarity in utility functions.
  • Documentation

    • Updated documentation to align with the refactored methods and new functionalities.

@Lamby777 Lamby777 added enhancement New feature or request rust GDExtension Rust-related stuff dev-interface Things only developers care about (refactoring, schema changes, etc.) ui Interface stuff labels Jan 17, 2024
@Lamby777 Lamby777 added this to the Core Functionality Complete milestone Jan 17, 2024
Copy link

coderabbitai bot commented Jan 17, 2024

Walkthrough

The project has undergone a UI enhancement and codebase cleanup, focusing on streamlining user interactions and improving the visual elements. Key updates include repositioning UI components, enriching text content, adopting shorthand coding conventions, and refactoring for better modularity. New functionalities for list management and animation have been introduced, alongside semantic changes in variable naming for clarity.

Changes

File Path Change Summary
.../scenes/dialogchoice.tscn Updated DChoice node positioning and Label node text and color.
.../src/battle/mod.rs,
.../src/battle/player.rs,
.../src/main_menu.rs,
.../src/wrapped.rs
Refactored to use Wrapped struct and simplified vector initialization.
.../src/dialogue/dbox/dchoice.rs,
.../src/dialogue/dbox/mod.rs
Enhanced DChoice struct, added new methods, and updated DialogBox.
.../src/lib.rs Removed choicelist module, added wrapped module, and updated prelude.
.../src/consts.rs Reorganized constants and updated TransitionType usage.
.../src/stats/stats_interface.rs Renamed variable for semantic clarity.
.../src/util.rs Added bbcode_toggle function and renamed parameters in tween.

"In the burrow of code, we hop and tweak,
🐇 Refining the game, for a future not bleak.
With each new commit, the bugs we do seek,
A rabbit's work, never done, always chic."

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e8686f4 and f57bba1.
Files selected for processing (12)
  • pets-gd/scenes/dialogchoice.tscn (1 hunks)
  • pets-lib/src/battle/mod.rs (2 hunks)
  • pets-lib/src/battle/player.rs (2 hunks)
  • pets-lib/src/consts.rs (3 hunks)
  • pets-lib/src/dialogue/dbox/dchoice.rs (2 hunks)
  • pets-lib/src/dialogue/dbox/mod.rs (10 hunks)
  • pets-lib/src/lib.rs (5 hunks)
  • pets-lib/src/main_menu.rs (3 hunks)
  • pets-lib/src/stats/stats_interface.rs (1 hunks)
  • pets-lib/src/util.rs (2 hunks)
  • pets-lib/src/world/playercb.rs (1 hunks)
  • pets-lib/src/wrapped.rs (1 hunks)
Files skipped from review due to trivial changes (1)
  • pets-lib/src/battle/player.rs
Additional comments: 28
pets-gd/scenes/dialogchoice.tscn (3)
  • 4-5: The offset_right and offset_bottom properties of the DChoice node have been increased significantly from 40.0 to 200.0. This is a large change and could affect the layout significantly. Ensure that this change is consistent with the intended design and does not cause any visual issues in the UI.
  • 10-10: The Label node's default color has been changed. Verify that this new color aligns with the game's color scheme and UI design guidelines.
  • 13-13: The text for the Label node has been changed from "Amogus" to "Sample Text Words Words More Words". Ensure that this change is intentional and correctly reflects the desired content in the game's dialog choices.
pets-lib/src/consts.rs (3)
  • 5-5: The TransitionType is now being imported from the parent module. Confirm that this change does not affect any other modules that might be using TransitionType differently.
  • 33-34: The constants DBOX_CHOICE_TWEEN_TIME and DBOX_CHOICE_TWEEN_TRANS in the dialogue module have been modified to use values from main_menu. This change suggests a unification of tweening behavior across different UI elements. Confirm that this shared behavior is consistent with the design requirements.
  • 46-46: The MENU_WAVE_BBCODE in main_menu now references DBOX_SELECTION_BBCODE from dialogue. This change indicates a shared visual effect between menu and dialogue choices. Verify that this is the intended effect and that it works correctly in both contexts.
pets-lib/src/lib.rs (2)
  • 29-29: The choicelist module has been removed, and the wrapped module has been added. Ensure that all references to choicelist have been properly updated to use wrapped and that no orphaned code remains.
  • 62-65: Instances of StatsInterface and DBoxInterface are now created using new_alloc instead of alloc_gd. Confirm that this change aligns with the memory management strategy and that the new method properly handles the lifecycle of these instances.
pets-lib/src/util.rs (1)
  • 48-60: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [36-57]

The tween function's parameters have been renamed from from to start_value and target to end_value. This is a good change for clarity. Ensure that all calls to tween throughout the codebase have been updated to reflect these new parameter names.

pets-lib/src/dialogue/dbox/dchoice.rs (3)
  • 17-20: The base class of DChoice has been changed from Container to MarginContainer. Verify that this change does not introduce any layout issues and that the MarginContainer properties are being utilized correctly.
  • 30-32: A private method txt_label has been added to encapsulate the retrieval of the text label. This is a good encapsulation practice. Ensure that it is being used consistently wherever the text label is needed.
  • 35-47: New methods tween_label and new_container have been added for label animation and container creation. Verify that these methods are correctly implemented and that the animations perform as expected.
pets-lib/src/stats/stats_interface.rs (1)
  • 36-42: The variable lv has been renamed to lvl within the fn_name function. This is a minor change but improves readability. Confirm that this change has been propagated to all usages of the variable to maintain consistency.
pets-lib/src/world/playercb.rs (1)
  • 101-101: The logic for updating past rotations in the PlayerCB class has been simplified. Confirm that this change does not alter the intended behavior and that the simplification maintains the same functionality.
pets-lib/src/battle/mod.rs (3)
  • 56-56: The choices field in the BattleEngine struct has been changed to use the Wrapped struct. Ensure that the new structure is properly integrated and that all related methods have been updated accordingly.
  • 102-103: The ready method now initializes choices using from_children_of from the wrapped module. Verify that this method correctly initializes the choices and that the order of elements is maintained.
  • 107-135: The process method has been refactored to use functions from the wrapped module for input processing and action handling. Ensure that the refactored method correctly processes user input and that the battle choices are handled as intended.
pets-lib/src/main_menu.rs (3)
  • 26-26: The tween_choice_to function has been modified to take a non-mutable reference to RichTextLabel. Confirm that this change does not affect the functionality of the tweening behavior and that it is consistent with the intended usage.
  • 70-70: The choices field has been updated to use the Wrapped struct. Verify that the new structure is properly integrated and that the logic for menu choice processing has been correctly updated.
  • 76-118: The logic for processing menu choices has been restructured using pattern matching. Ensure that the new structure correctly handles user input and that the menu choices are processed as intended.
pets-lib/src/wrapped.rs (2)
  • 73-76: The Wrapped struct has been introduced to manage lists of elements. Verify that this new structure is correctly implemented and that it integrates well with the rest of the system, particularly in managing user input and list creation.
  • 113-126: The from_children_of function creates a Wrapped list from the child nodes of a parent node. Confirm that this function correctly maps the children to the corresponding enum variants and that the order is preserved.
pets-lib/src/dialogue/dbox/mod.rs (6)
  • 64-65: The awaiting_choice field has been added to the DialogBox struct. Ensure that this new field is used correctly to manage the state of the dialog box when awaiting user input.
  • 66-67: The choices field has been updated to use the Wrapped struct. Verify that this new structure is properly integrated and that the dialog box choices are managed correctly.
  • 155-169: The run_ix_ending method has been refactored. Confirm that the refactoring maintains the original functionality and that the method correctly handles the different types of dialogue endings.
  • 171-184: The on_accept method has been added to handle user input. Verify that this method correctly processes the acceptance action and that it properly advances the dialog or ends the interaction as intended.
  • 186-227: The process_choice_input method has been refactored. Ensure that the refactored method correctly processes user input for choices and that the dialog box responds appropriately.
  • 396-428: The MetaPair struct has been added. Verify that this new struct is used correctly to manage temporary and permanent metadata for dialogue and that it integrates well with the existing system.

pets-lib/src/util.rs Outdated Show resolved Hide resolved
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 f57bba1 and 873751e.
Files selected for processing (1)
  • pets-lib/src/util.rs (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • pets-lib/src/util.rs

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 f57bba1 and 075d0c4.
Files selected for processing (1)
  • pets-lib/src/util.rs (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • pets-lib/src/util.rs

@Lamby777
Copy link
Owner Author

W rizz
image

@Lamby777 Lamby777 merged commit 04caf31 into master Jan 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-interface Things only developers care about (refactoring, schema changes, etc.) enhancement New feature or request rust GDExtension Rust-related stuff ui Interface stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant