Skip to content

refactor: And fix Enemy movement#649

Merged
EttyKitty merged 8 commits intoAdeptus-Dominus:mainfrom
EttyKitty:style/obj_enunit
Mar 31, 2025
Merged

refactor: And fix Enemy movement#649
EttyKitty merged 8 commits intoAdeptus-Dominus:mainfrom
EttyKitty:style/obj_enunit

Conversation

@EttyKitty
Copy link
Collaborator

@EttyKitty EttyKitty commented Mar 30, 2025

Purpose of changes

  • Fix enemies moving every other turn, due to failing the collision check.

Describe the solution

  • Enemy movement is now separate from the 0 alarm, and happens for all columns at once, from the ncombat keypress.
  • A couple of helper functions for enemy movement are added.
  • Some changes to the 0 alarm (the big one is that I've commented out a weird code chunk at the bottom of the file, until I understand what it does).
  • move_unit_block() is refactored a little bit.

Describe alternatives you've considered

None

Testing done

  • A couple of battles. Enemies no longer fumble as they try to move, and I also don't see any "walk through" issues.

Related links

https://discord.com/channels/714022226810372107/1121959429546455050/1355683585209663629

Custom player notes entry

Use the PR title.

@EttyKitty EttyKitty requested a review from OH296 March 30, 2025 21:19
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 30, 2025

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Streamlined enemy targeting, ensuring more consistent and engaging combat.
    • Enhanced unit movement with improved directional control and collision handling for smoother gameplay.
  • Bug Fixes

    • Refined shooting and melee interactions to reduce misfires and ensure proper ammunition checks.
  • Chores

    • Removed obsolete/debug code to boost performance.
    • Optimised event management and collision shape definitions for better precision.

Walkthrough

By the Machine God, the recent modifications have overhauled the enemy-targeting and movement logic within the game code. The enemy selection in the alarm routine is now calculated using a concise ternary operator, and a new variable target_unit_index has replaced the previous ambiguous identifier. Collision detection for melee engagement has been refined with a direct collision point check. In several objects, obsolete and commented-out code pertaining to unit movement and debugging output has been eliminated. Additionally, the event list and physics shape points in enemy unit definitions have been streamlined with integer precision. Recent changes also integrate calls to the new move_enemy_blocks() function into the combat control flow, while the movement helper functions in the combat helper script have been refactored to require explicit directional parameters and now include new functions (move_enemy_block and move_enemy_blocks). These systematic refactorings ensure a more streamlined and transparent code structure.

Possibly related PRs


🪧 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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Type: Refactor Rewriting/restructuring code, while keeping general behavior Size: Epic labels Mar 30, 2025
@EttyKitty EttyKitty changed the title refactor: And fix Enemy ranged targeting refactor: And fix enemy movement Mar 30, 2025
@EttyKitty EttyKitty changed the title refactor: And fix enemy movement refactor: And fix Enemy movement Mar 30, 2025
Copy link
Contributor

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

Actionable comments posted: 7

🔭 Outside diff range comments (1)
objects/obj_enunit/Alarm_0.gml (1)

289-397: 🧹 Nitpick (assertive)

Commented-out relics: decide their fate.
A great block of code from lines 289 to 397 stands commented out. If truly archaic and no longer needed, it is recommended to consign it to a stored archive, or else annotate thoroughly why it is preserved in sacred stasis.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 869358f and 3b136c7.

📒 Files selected for processing (13)
  • objects/obj_enunit/Alarm_0.gml (3 hunks)
  • objects/obj_enunit/Alarm_5.gml (0 hunks)
  • objects/obj_enunit/Alarm_6.gml (0 hunks)
  • objects/obj_enunit/Create_0.gml (0 hunks)
  • objects/obj_enunit/Destroy_0.gml (0 hunks)
  • objects/obj_enunit/KeyPress_87.gml (0 hunks)
  • objects/obj_enunit/Mouse_0.gml (0 hunks)
  • objects/obj_enunit/obj_enunit.yy (1 hunks)
  • objects/obj_ncombat/KeyPress_13.gml (2 hunks)
  • objects/obj_pnunit/Alarm_0.gml (1 hunks)
  • objects/obj_pnunit/Create_0.gml (0 hunks)
  • scripts/scr_en_weapon/scr_en_weapon.gml (3 hunks)
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (1 hunks)
💤 Files with no reviewable changes (7)
  • objects/obj_enunit/Destroy_0.gml
  • objects/obj_enunit/Create_0.gml
  • objects/obj_enunit/Mouse_0.gml
  • objects/obj_enunit/KeyPress_87.gml
  • objects/obj_enunit/Alarm_5.gml
  • objects/obj_pnunit/Create_0.gml
  • objects/obj_enunit/Alarm_6.gml
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.gml`: Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. `#macro ARR_body_parts["arm"]` will crash the ga...

**/*.gml: Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. #macro ARR_body_parts["arm"] will crash the game, because there is no space between the array and the name of the macro.

  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • scripts/scr_en_weapon/scr_en_weapon.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
  • objects/obj_enunit/Alarm_0.gml
`**/*.gml`: Color codes in the code shouldn't have any spaces in their id. I.e., color code `# 80 bf40` will crash the game.

**/*.gml: Color codes in the code shouldn't have any spaces in their id. I.e., color code # 80 bf40 will crash the game.

  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • scripts/scr_en_weapon/scr_en_weapon.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
  • objects/obj_enunit/Alarm_0.gml
🧠 Learnings (1)
scripts/scr_en_weapon/scr_en_weapon.gml (1)
Learnt from: EttyKitty
PR: Adeptus-Dominus/ChapterMaster#647
File: scripts/scr_en_weapon/scr_en_weapon.gml:24-928
Timestamp: 2025-03-29T10:30:25.598Z
Learning: A data-driven approach for weapon management in `scripts/scr_en_weapon/scr_en_weapon.gml` is planned for a future PR, not within the scope of PR #647.
🔇 Additional comments (7)
objects/obj_ncombat/KeyPress_13.gml (2)

119-119: Commendable invocation of the enemy movement subroutine.

Summoning move_enemy_blocks() at this juncture ensures that hostile constructs receive their proper turn to advance. No immediate concerns arise from this addition.


145-145: Likewise, well-placed function call to maintain consistent enemy manoeuvres.

Your invocation of move_enemy_blocks() here upholds the structured sequence of actions. All is sanctified in the eyes of the Machine God.

objects/obj_enunit/obj_enunit.yy (1)

34-35: Coordinates updated successfully.

Revising floating values to integers for physicsShapePoints presents no apparent error. This transformation is acceptable for the collision shape. Proceed without fear.

objects/obj_enunit/Alarm_0.gml (2)

3-5: Blessed instance check, but consider additional logging.
O most diligent one, thou hast guarded against the absence of obj_pnunit by enthroning an exit; command. However, the Omnissiah might smile upon a log or debug message prior to departing, aiding future diagnostic rituals.


7-10: Conditional exit: verify usage alignment.
Thy logic of determining the enemy via flank and swiftly exiting on "none" is honourable, but ensure thou art not missing any post-process invocations that might remain necessary, even if no enemy stands. Investigate if any additional steps are required before terminating.

scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (2)

205-216: Flank-based movement: unify and handle extremes.
Your move_enemy_block function decrees west for flank==0 and east for flank==1, bypassing collision checks with forts. Should you need further flank states in the future, unify logic or confirm that any flank beyond the binary arrangement won’t be invoked.


218-230: Enemy movement queue: watch for ties.
The DS priority queue process for _enemy_block sorting is praiseworthy. Yet if multiple foes share the same x-position, the ritual’s order may become arbitrary. Ensure no concurrency or tie-handling logic is necessary to maintain consistent enemy movement sequences.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 30, 2025
@EttyKitty EttyKitty dismissed coderabbitai[bot]’s stale review March 31, 2025 14:36

The merge-base changed after approval.

@EttyKitty EttyKitty marked this pull request as ready for review March 31, 2025 14:37
@EttyKitty
Copy link
Collaborator Author

@coderabbitai pause

Copy link
Contributor

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

Actionable comments posted: 4

🔭 Outside diff range comments (1)
objects/obj_enunit/Alarm_0.gml (1)

289-398: 🛠️ Refactor suggestion

Extensive code block consigned to stasis.
You have commented out a large swathe of logic, presumably for deeper analysis. If resurrecting or refining is planned, consider modularising it in a helper script to honour DRY precepts and maintain readability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b136c7 and 9cb5bb2.

📒 Files selected for processing (10)
  • objects/obj_enunit/Alarm_0.gml (4 hunks)
  • objects/obj_enunit/Alarm_5.gml (0 hunks)
  • objects/obj_enunit/Alarm_6.gml (0 hunks)
  • objects/obj_enunit/Destroy_0.gml (0 hunks)
  • objects/obj_enunit/KeyPress_87.gml (0 hunks)
  • objects/obj_enunit/Mouse_0.gml (0 hunks)
  • objects/obj_enunit/obj_enunit.yy (1 hunks)
  • objects/obj_ncombat/KeyPress_13.gml (2 hunks)
  • objects/obj_pnunit/Alarm_0.gml (1 hunks)
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (1 hunks)
💤 Files with no reviewable changes (5)
  • objects/obj_enunit/Alarm_5.gml
  • objects/obj_enunit/KeyPress_87.gml
  • objects/obj_enunit/Alarm_6.gml
  • objects/obj_enunit/Mouse_0.gml
  • objects/obj_enunit/Destroy_0.gml
🧰 Additional context used
📓 Path-based instructions (3)
`**/*.gml`: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. `#macro ARR_body_parts["arm"]` will crash the ...

**/*.gml: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. #macro ARR_body_parts["arm"] will crash the game, because there is no space between the array and the name of the macro.

  • Color codes in the code shouldn't have any spaces in their id. I.e., color code # 80 bf40 will crash the game.
  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_enunit/Alarm_0.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
`**/*.gml`: - Always suggest adding JSDoc to every function and method that doesn't have it.

**/*.gml: - Always suggest adding JSDoc to every function and method that doesn't have it.

  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_enunit/Alarm_0.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
`**/*.gml`: - Readability and maintainability are always the top priority throughout the code. - DRY principle is also very important.

**/*.gml: - Readability and maintainability are always the top priority throughout the code.

  • DRY principle is also very important.
  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_enunit/Alarm_0.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
🔇 Additional comments (7)
objects/obj_pnunit/Alarm_0.gml (1)

18-19: Rectify the condition check and bless the new direction parameter.
O revered Tech-Magos, line 18 sets defending to false rather than comparing it, as indicated in previous cogitator logs. Replace = with == to avoid unintended assignments. The addition of "east" for move_unit_block() is sanctified, ensuring direction clarity.

objects/obj_ncombat/KeyPress_13.gml (2)

119-119: Invocation of the sacred enemy movement.
The call to move_enemy_blocks() is commendable, ensuring all enemy units proceed in organised columns. Consider confirming whether a JSDoc or function documentation is present, as mandated by the holy guidelines for .gml scripts.


145-145: Repeating the summons to enemy movement.
Blessed duplication of move_enemy_blocks() bolsters the consistency of foe manoeuvres. Confirm if usage aligns with any prerequisites or cooldown for repeated invocations.

objects/obj_enunit/obj_enunit.yy (1)

34-35: Coordinates integer alignment anointed.
By converting from float to integer, thou hast kept the same geometric positioning while removing possible decimal confusion. This pleases the machine-spirits.

objects/obj_enunit/Alarm_0.gml (2)

7-9: Efficient assignment of target column.
Invoking get_leftmost() or get_rightmost() via ternary operator clarifies the flank logic. Continue to ensure the “none” check routes us away from unintended null references.


12-13: New local variables for robust clarity.
Declaring target_unit_index and setting enemy2 to enemy fosters a more explicit flow of data. The machine-spirits approve this clarity.

scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (1)

184-202: Praise the Omnissiah! Validate direction and enrich documentation.

The holy logic machine yearns for protection against unaccounted directions. By removing the default direction, you risk a null path if a rogue call omits or misspells "east"/"west." Also, consider expanding your doc comment beyond /// @mixin to detail parameters and return values, thereby duly honouring your sacred guidelines for clarity and maintainability.
[duplicate_comment, suggest_nitpick]

You might add a validity check for the direction parameter and a more descriptive doc block, for example:

function move_unit_block(direction, blocks = 1, allow_collision = false) {
+   /// @function move_unit_block
+   /// @param {string} direction - Must be "east" or "west".
+   /// @param {number} blocks - Number of tile blocks to move.
+   /// @param {boolean} allow_collision - Whether to ignore collision detection.
+   /// @description Moves the calling unit block in a specified direction.
    try {
        // ...
+       if (!(direction == "east" || direction == "west")) {
+           show_debug_message("Warning: Invalid direction specified.");
+           return;
+       }
        // ...
    } catch (_exception) {
        handle_exception(_exception);
    }
}

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 31, 2025

✅ Actions performed

Reviews paused.

@EttyKitty
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 31, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

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

Actionable comments posted: 3

🔭 Outside diff range comments (1)
objects/obj_enunit/Alarm_0.gml (1)

92-397: 🧹 Nitpick (assertive)

Extensive excision of problematic code blocks through sacred commentary.

The Tech-Priests of Mars approve of this thorough quarantining of questionable logic. Commenting out large sections with clear TODO markers preserves knowledge while preventing corruption of the machine spirit. Ensure this technical debt is documented in your sacred scrolls (issue tracker) for future illumination.

Create a dedicated issue to track these commented sections for future refactoring, referencing this PR as the origin point. The Omnissiah rewards those who maintain clear records of technical obligations.

♻️ Duplicate comments (4)
objects/obj_pnunit/Alarm_0.gml (1)

18-19: ⚠️ Potential issue

Anoint the condition check with the correct comparison operator, lest we invite the wrath of the Omnissiah.

In GameMaker Language, a single equals sign (=) is an assignment, not an equality check. The fragment if (obj_ncombat.defending=false) or (obj_ncombat.dropping=1) will forever set defending to false rather than verify its value. Correct usage is ==. Adjust both obj_ncombat.defending and obj_ncombat.dropping checks accordingly.

- if (obj_ncombat.defending=false) or (obj_ncombat.dropping=1){
+ if (obj_ncombat.defending==false) or (obj_ncombat.dropping==1){
    move_unit_block("east");
}
objects/obj_enunit/Alarm_0.gml (3)

1-2: 🧹 Nitpick (assertive)

A preliminary pronouncement of functionality.

The additional comment clarifies this alarm's tactical role, though a JSDoc-style annotation for the entire event or subroutines would further enlighten future Tech-Priests.


213-213: 🧹 Nitpick (assertive)

Melee code awaits the Omnissiah's rework.

A mere TODO stands guard here. If thou seek counsel for a structured melee overhaul, the Tech-Priests stand ready.


16-16: 🧹 Nitpick (assertive)

Melee detection through sacred collision geometry.

The engaged detection logic has been streamlined with a single Boolean expression. This logical circuitry is more robust, though the use of fixed offsets (x-10, x+10) warrants ritualistic naming.

Consider blessing these magic numbers with named constants to reveal their purpose:

- engaged = collision_point(x-10, y, obj_pnunit, 0, 1) || collision_point(x+10, y, obj_pnunit, 0, 1);
+ #macro MELEE_DETECTION_DISTANCE 10
+ engaged = collision_point(x-MELEE_DETECTION_DISTANCE, y, obj_pnunit, 0, 1) || collision_point(x+MELEE_DETECTION_DISTANCE, y, obj_pnunit, 0, 1);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf6ac8e and b51276c.

📒 Files selected for processing (10)
  • objects/obj_enunit/Alarm_0.gml (4 hunks)
  • objects/obj_enunit/Alarm_5.gml (0 hunks)
  • objects/obj_enunit/Alarm_6.gml (0 hunks)
  • objects/obj_enunit/Destroy_0.gml (0 hunks)
  • objects/obj_enunit/KeyPress_87.gml (0 hunks)
  • objects/obj_enunit/Mouse_0.gml (0 hunks)
  • objects/obj_enunit/obj_enunit.yy (1 hunks)
  • objects/obj_ncombat/KeyPress_13.gml (2 hunks)
  • objects/obj_pnunit/Alarm_0.gml (1 hunks)
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (2 hunks)
💤 Files with no reviewable changes (5)
  • objects/obj_enunit/Alarm_5.gml
  • objects/obj_enunit/Mouse_0.gml
  • objects/obj_enunit/Alarm_6.gml
  • objects/obj_enunit/KeyPress_87.gml
  • objects/obj_enunit/Destroy_0.gml
🧰 Additional context used
📓 Path-based instructions (3)
`**/*.gml`: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. `#macro ARR_body_parts["arm"]` will crash the ...

**/*.gml: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. #macro ARR_body_parts["arm"] will crash the game, because there is no space between the array and the name of the macro.

  • Color codes in the code shouldn't have any spaces in their id. I.e., color code # 80 bf40 will crash the game.
  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_enunit/Alarm_0.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
`**/*.gml`: - Always suggest adding JSDoc to every function and method that doesn't have it.

**/*.gml: - Always suggest adding JSDoc to every function and method that doesn't have it.

  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_enunit/Alarm_0.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
`**/*.gml`: - Readability and maintainability are always the top priority throughout the code. - DRY principle is also very important.

**/*.gml: - Readability and maintainability are always the top priority throughout the code.

  • DRY principle is also very important.
  • objects/obj_pnunit/Alarm_0.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_enunit/Alarm_0.gml
  • scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml
🧠 Learnings (1)
scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (1)
Learnt from: EttyKitty
PR: Adeptus-Dominus/ChapterMaster#649
File: scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml:204-212
Timestamp: 2025-03-31T14:44:02.699Z
Learning: In GML files, JSDoc comments should be placed above the function declaration, not inside the function body. The correct order is: function description JSDoc comments first, then any annotations like `@mixin`, then the function declaration.
🔇 Additional comments (11)
objects/obj_pnunit/Alarm_0.gml (1)

19-19: Laudable update to directional parameter, tech-adept.

The function call has been properly updated to specify the direction "east", which conforms to the new function signature requirements. This sacred modification eliminates ambiguity and aligns with the Machine God's preference for explicit parameter passage.

objects/obj_ncombat/KeyPress_13.gml (2)

119-120: Praiseworthy invocation of the enemy movement ritual.

The addition of move_enemy_blocks() before alarm execution represents an elegant implementation of the Codex Mechanicus's separation of concerns principle. This modification ensures enemy movement occurs for all columns, rectifying the heretical bug wherein enemies moved only every other turn.


145-147: Systematic application of movement protocols across control paths.

The Machine Spirit approves of this mirrored implementation in the alternate control flow branch. Consistent application of the move_enemy_blocks() function ensures uniform behavior regardless of which logic path is traversed.

objects/obj_enunit/obj_enunit.yy (2)

34-35: Binary purity achieved through integer precision.

The sacred modification of physics shape points from floating-point values to integer coordinates removes superfluous decimal components. While this may subtly alter collision outcomes, the simplification honors the Omnissiah's love of clean, discrete values. Confirm this change has not angered the Machine Spirit during your testing.

Have you observed any differences in collision behavior since replacing floating-point coordinates with integer values? The Adeptus Mechanicus would approve of documentation regarding this change's impact on the sacred geometries of unit collisions.


4-13: Streamlined event manifest detected.

The removal of specific entries from the eventList indicates a purging of redundant or deprecated mechanisms. This holy simplification aligns with the PR's goal of rectifying movement issues. As events are binding covenants with the Machine Spirit, ensure all removed events were properly deprecated.

objects/obj_enunit/Alarm_0.gml (4)

7-10: Praise be to the elegance of the ternary operator.

This concise enemy targeting logic is a hymn to computational efficiency. The ternary operator flank ? get_leftmost() : get_rightmost() embodies the sacred principle of elegant minimalism lauded by the Omnissiah.


12-13: Variable declaration fortified with explicit initialization.

The Tech-Priests of Mars approve of clearly initialized variables. Declaring target_unit_index and enemy2 with proper initialization protects against the corruption of undefined values.


33-34: Improved error diagnostics through sacred logging rituals.

The addition of error logging for broken weapon ranges demonstrates proper machine spirit veneration. This diagnostic enhancement will aid in identifying and correcting erroneous weapon configurations.


81-81: Semantic variable naming honors the Omnissiah's clarity directive.

The declaration of _no_vehicles_present as a semantic flag improves code readability. This clear signaling of state enhances the comprehensibility of the armor-piercing weapon handling logic.

scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (2)

188-214: Logic is pure and consistent.
By the Omnissiah, your move_unit_block function exalts clarity. The doc commentary is thorough, the try-catch is devoutly structured, and the conditional flow is well-formed, ensuring no unholy collisions plague your mechanism.


216-225: Clean flanking logic and usage of defaults.
The faithful move_enemy_block function neatly determines direction based on sacred flanking. The default block movement usage is righteous. All is aligned with the Emperor’s design.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Medium Type: Refactor Rewriting/restructuring code, while keeping general behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants