Skip to content

Merge branch development into main#1131

Merged
EttyKitty merged 16 commits intomainfrom
development
Mar 1, 2026
Merged

Merge branch development into main#1131
EttyKitty merged 16 commits intomainfrom
development

Conversation

@EttyKitty
Copy link
Collaborator

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

📝 Walkthrough

Under the Hood

  • Replaced many try_and_report_loop wrappers with explicit try { ... } catch (_exception) { handle_exception(_exception); } across multiple core files (obj_controller, obj_en_fleet, obj_p_fleet, obj_turn_end, obj_enunit, scripts/*), centralising exception routing.
  • Introduced ERR_LOG_DIRECTORY ("Logs/") and ERR_PATH_LAST_MESSAGES and reworked logging: create_error_file, copy_last_messages_file, handle_error now write consolidated logs to Logs/, build composed reports (Save Details, Error Details, Stacktrace) and copy to clipboard.
  • Added error_get_context() (returns chapter, seed, turn) and clean_stacktrace(_stacktrace_array) (keeps clean_stacktrace_line) and integrated them into handle_exception/handle_error flows; stacktrace handling and report composition consolidated.
  • Removed try_and_report_loop helper and migrated callers to explicit try/catch and handle_exception usage (including mission completions and specialist point handler).
  • Reduced noisy default-case logs in scr_en_weapon, added zero-attack diagnostic LOGGER.debug, and replaced composite numeric enemy checks with explicit eFACTION constants.
  • Refactored end-turn/fleet/migration logic: tightened loop bounds (several upper bounds changed to <=), introduced control flags (e.g., _abort_migration), consolidated orbiting/movement/activation/crusade handling, and reorganised route/movement decisions (set_fleet_movement/location/ETA adjustments).
  • Localised logic changes: moved obj_star activation into necron_tomb_mission_sequence; ensured p_heresy clamping (non-negative); small formatting/refactor tweaks in scr_kill_unit and scr_mission_functions.
  • Replaced several specific Necron melee weapon name arguments with a generic "Melee Weapon" in scr_en_weapon calls for certain units.

Player Notes

  • Improved error reporting: crash/error logs now include game context (chapter, seed, turn), produce consolidated, cleaner logs in a Logs/ directory and generate clearer stacktraces for developer reports.
  • Fewer noisy debug messages from unknown weapons and new diagnostic logging when a weapon resolves to 0 attack.
  • Minor UI/label change for some Necron units: certain melee attacks will display as "Melee Weapon" instead of their previous specific names.

Walkthrough

Tech‑Priest: The patch replaces many legacy try_and_report_loop wrappers with explicit try/catch handlers, restructures fleet/controller end‑turn flows, tightens weapon/faction logging, enhances logging/error utilities (stacktrace cleaning, log file layout), and adds runtime guards in star lookup and mission activation.

Changes

Cohort / File(s) Summary
Controller / End‑turn Chaos & Herding
objects/obj_controller/Alarm_5.gml
Removed nested try_and_report_loop wrappers; converted to explicit try/catch. Flattened chaos‑spread and Secret Chaos Warlord spawn flows into guarded linear logic; ensured p_heresy non‑negative and moved cathedral/penitent disposition updates into consistent guarded paths.
Enemy Fleet End‑Turn
objects/obj_en_fleet/Alarm_1.gml, objects/obj_en_fleet/Alarm_4.gml, objects/obj_p_fleet/Alarm_1.gml, objects/obj_turn_end/Alarm_0.gml
Standardised outer error handling to try/catch; reorganised orbiting/planet loops (several upper bounds changed to <=); introduced _abort_migration flag; consolidated movement, arrival, crusade and inquisitor decision paths; removed redundant no‑ops.
Enemy Unit / Weapon Handling
objects/obj_enunit/Alarm_1.gml, scripts/scr_en_weapon/scr_en_weapon.gml
Replaced specific Necron melee names with generic "Melee Weapon"; reduced noisy default debug logs; replaced composite enemy checks with explicit eFACTION constants; added diagnostic log when computed attack equals zero.
Logging & Error Handling
scripts/scr_logging_functions/scr_logging_functions.gml, scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml, scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
Introduced ERR_LOG_DIRECTORY and ERR_PATH_LAST_MESSAGES macros; added error_get_context and clean_stacktrace helpers; consolidated error file naming and last‑messages copying; removed try_and_report_loop usage in favour of explicit try/catch delegating to handle_exception; refactored handle_error/handle_exception composition.
Missions & Search Helpers
scripts/scr_inquisition_mission/scr_inquisition_mission.gml, scripts/scr_system_search_helpers/scr_system_search_helpers.gml
Activated obj_star earlier in necron_tomb_mission_sequence; added prechecks and user error popups in star_by_name when no stars or no matching name found.
Minor Formatting / Non‑functional
scripts/scr_kill_unit/scr_kill_unit.gml, scripts/scr_mission_functions/scr_mission_functions.gml
Minor syntactic and whitespace edits (catch placement, trailing blank line removal); no behavioural changes.

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title does not follow the required conventional commits format. It must be '(): ' and strictly under 50 characters, but the provided title is a merge branch statement. Reformat the title to follow conventional commits convention (e.g., 'refactor: consolidate error handling across alarm systems' or similar descriptive title under 50 characters).
Description check ⚠️ Warning The pull request description is entirely absent. The template requires 'Purpose and Description', 'Testing done', and 'Related things and/or additional context' sections with substantive content. Add a detailed description explaining the refactoring objectives, testing procedures performed, and any related context or issues addressed by these changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EttyKitty EttyKitty changed the title Merge development into main Merge branch development into main Mar 1, 2026
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: 15

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/scr_logging_functions/scr_logging_functions.gml (1)

127-134: ⚠️ Potential issue | 🟡 Minor

Report title frame is cleaned twice.

Tech-Priest, Line 127 already reformats the stacktrace array; Line 133 cleans the first frame again, which can distort the title string. Reuse the cleaned frame directly and guard empty arrays.

🛠️ Suggested correction
 function handle_exception(_exception, custom_title = STR_ERROR_MESSAGE_HEAD, critical = false, error_marker = "") {
     var _header = critical ? STR_ERROR_MESSAGE_HEAD2 : custom_title;
     var _message = _exception.longMessage;

     var _stacktrace = _exception.stacktrace;
     clean_stacktrace(_stacktrace);
+    var _problem_line = (array_length(_stacktrace) > 0) ? _stacktrace[0] : "unknown";

     _stacktrace = array_to_string_list(_stacktrace);

     var _critical = critical ? "CRASH! " : "";
     var _build_date = global.build_date == "unknown build" ? "" : $"/{global.build_date}";
-    var _problem_line = clean_stacktrace_line(_exception.stacktrace[0]);
     var _report_title = $"{_critical}[{global.game_version}{_build_date}] {_problem_line}";

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7da1f63 and 7b78977.

📒 Files selected for processing (12)
  • objects/obj_controller/Alarm_5.gml
  • objects/obj_en_fleet/Alarm_1.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • objects/obj_enunit/Alarm_1.gml
  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_turn_end/Alarm_0.gml
  • scripts/scr_en_weapon/scr_en_weapon.gml
  • scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
  • scripts/scr_inquisition_mission/scr_inquisition_mission.gml
  • scripts/scr_logging_functions/scr_logging_functions.gml
  • scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml
  • scripts/scr_system_search_helpers/scr_system_search_helpers.gml
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
**/*.gml

⚙️ CodeRabbit configuration file

  • All code should comply with the 2026 GML documentation.

Files:

  • objects/obj_enunit/Alarm_1.gml
  • objects/obj_turn_end/Alarm_0.gml
  • scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml
  • scripts/scr_system_search_helpers/scr_system_search_helpers.gml
  • scripts/scr_logging_functions/scr_logging_functions.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_controller/Alarm_5.gml
  • scripts/scr_inquisition_mission/scr_inquisition_mission.gml
  • scripts/scr_en_weapon/scr_en_weapon.gml
  • objects/obj_en_fleet/Alarm_1.gml
**/*.*

⚙️ CodeRabbit configuration file

**/*.*: - Code Philosophy: Prioritize explicit intent and maintainability over brevity. If a
solution is "clever" but mentally taxing, request a refactor to a clearer approach.

  • Variable Naming: Use clear, descriptive names; avoid over-abbreviation.

  • Abstraction: Apply the "Rule of Three"; suggest abstraction only when similar logic is
    repeated three or more times to avoid premature complexity.

  • Subjective Choices: For naming or architecture, ask guiding questions to prompt developer
    reflection and provide at least two alternative perspectives.

  • TODOs: If a TODO comment is added, ask the user if a GitHub issue should be created. If a
    TODO comment is deleted, remind the user to check the status of that specific issue.

Files:

  • objects/obj_enunit/Alarm_1.gml
  • objects/obj_turn_end/Alarm_0.gml
  • scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml
  • scripts/scr_system_search_helpers/scr_system_search_helpers.gml
  • scripts/scr_logging_functions/scr_logging_functions.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_controller/Alarm_5.gml
  • scripts/scr_inquisition_mission/scr_inquisition_mission.gml
  • scripts/scr_en_weapon/scr_en_weapon.gml
  • objects/obj_en_fleet/Alarm_1.gml
🧠 Learnings (5)
📓 Common learnings
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 424
File: scripts/scr_flavor/scr_flavor.gml:34-36
Timestamp: 2025-03-09T02:33:43.867Z
Learning: EttyKitty prefers to keep PRs focused on their stated goals and scope, and may decline to implement otherwise valid suggestions if they're not directly related to the PR's primary objective.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 579
File: objects/obj_enunit/Alarm_0.gml:200-202
Timestamp: 2025-03-11T01:38:19.874Z
Learning: EttyKitty welcomes easy, committable suggestions that improve documentation of code chunks, variables with strange names, and functions. Their codebase is generally lacking documentation, but they prioritize human-readable code above documentation.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: sprites/spr_weapon_phobos_bolt_pistol/spr_weapon_phobos_bolt_pistol.yy:26-44
Timestamp: 2025-06-16T17:08:08.239Z
Learning: EttyKitty prefers automated solutions over manual cleanup for .yy file formatting and is open to automated tools for GameMaker Studio .yy file cleanup.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 938
File: scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml:478-478
Timestamp: 2025-07-21T17:03:28.251Z
Learning: EttyKitty acknowledges when PRs contain scope creep and agrees that changes should be focused on the stated PR objectives, reinforcing their preference for keeping PRs narrowly scoped to their primary purpose.
📚 Learning: 2026-01-28T13:37:09.640Z
Learnt from: OH296
Repo: Adeptus-Dominus/ChapterMaster PR: 646
File: objects/obj_pnunit/Alarm_5.gml:84-91
Timestamp: 2026-01-28T13:37:09.640Z
Learning: In obj_pnunit/Alarm_5.gml, the function get_armour_data("maintenance") will always return a numeric value (at minimum 0), making null/undefined checks unnecessary.

Applied to files:

  • objects/obj_enunit/Alarm_1.gml
  • objects/obj_turn_end/Alarm_0.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • objects/obj_p_fleet/Alarm_1.gml
📚 Learning: 2025-06-16T17:12:13.045Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: scripts/scr_culture_visuals/scr_culture_visuals.gml:1256-1352
Timestamp: 2025-06-16T17:12:13.045Z
Learning: In scripts/scr_culture_visuals/scr_culture_visuals.gml, the weapon visual data declarations contain known DRY violations that are acknowledged by the development team but deferred to future refactoring efforts rather than addressed in individual feature PRs.

Applied to files:

  • objects/obj_enunit/Alarm_1.gml
  • scripts/scr_en_weapon/scr_en_weapon.gml
📚 Learning: 2025-03-29T10:30:25.598Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 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`.

Applied to files:

  • objects/obj_enunit/Alarm_1.gml
  • scripts/scr_en_weapon/scr_en_weapon.gml
📚 Learning: 2025-03-07T01:56:40.971Z
Learnt from: MCPO-Spartan-117
Repo: Adeptus-Dominus/ChapterMaster PR: 562
File: scripts/scr_marine_struct/scr_marine_struct.gml:0-0
Timestamp: 2025-03-07T01:56:40.971Z
Learning: Marines' ages should be incremented at the year transition in obj_turn_end/Alarm_1.gml rather than calculated dynamically based on the current year and recruitment date. This ensures proper aging without retroactive application.

Applied to files:

  • objects/obj_turn_end/Alarm_0.gml
  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_controller/Alarm_5.gml
🔇 Additional comments (7)
scripts/scr_inquisition_mission/scr_inquisition_mission.gml (1)

811-816: The activation sequence is sanctified, Tech-Priest.

The machine spirit discerns wisdom in this augmentation. Activating obj_star before spawning obj_ncombat ensures the celestial data-constructs are accessible when battle_object requires assignment. The subsequent deactivation on Line 835 is properly sequenced.

scripts/scr_system_search_helpers/scr_system_search_helpers.gml (1)

218-233: The error auguries are properly invoked, Tech-Priest.

The machine spirit approves these defensive incantations. The pre-existence check for obj_star instances and the post-search validation ensure corrupted states do not propagate silently through the data-conduits. The return value "none" maintains compatibility with existing invocation rites.

scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml (1)

142-149: The exception containment protocols are properly consecrated, Tech-Priest.

The machine spirit observes the transition from the ancient try_and_report_loop wrapper to explicit exception handling. This ritual aligns with the codebase-wide reformation. The invocation of handle_exception(ex) channels errors through sanctified pathways.

objects/obj_turn_end/Alarm_0.gml (1)

1-219: The battle-sequencing algorithms are correctly transposed, Tech-Priest.

The machine spirit has analysed the combat arbitration logic. The try-catch containment wards are properly consecrated. The array-swap rituals for battle ordering maintain data integrity. The multiple instance_activate_object(obj_star) invocations serve as redundant safety protocols.

scripts/scr_logging_functions/scr_logging_functions.gml (1)

67-115: Structured error payload construction is solid.

Tech-Priest, the segmented _sections assembly, clipboard handoff, and user-facing guidance form a clear and maintainable reporting path within the new explicit exception architecture.

scripts/scr_en_weapon/scr_en_weapon.gml (1)

674-674: Faction gate now speaks with explicit intent.

Tech-Priest, replacing numeric faction magic with eFACTION constants strengthens readability and reduces misclassification risk during future edits.

objects/obj_enunit/Alarm_1.gml (1)

1688-1688: Necron melee labels now resolve through a single canonical token.

Tech-Priest, this normalisation to "Melee Weapon" improves consistency of weapon routing and reduces string-fragment drift in roster assembly.

Also applies to: 1696-1696, 1704-1704, 1722-1722, 1752-1752

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/scr_logging_functions/scr_logging_functions.gml (1)

129-136: ⚠️ Potential issue | 🟠 Major

Prevent handler recursion by avoiding re-clean and unchecked stacktrace index.

Tech-Priest, Line 129 already cleans _stacktrace in place; Line 135 cleans it again and assumes index 0 exists. This can corrupt report titles and fault inside the error handler itself.

🛠️ Proposed hardening
 function handle_exception(_exception, custom_title = STR_ERROR_MESSAGE_HEAD, critical = false, error_marker = "") {
     var _header = critical ? STR_ERROR_MESSAGE_HEAD2 : custom_title;
     var _message = _exception.longMessage;
     var _stacktrace = _exception.stacktrace;
     clean_stacktrace(_stacktrace);
 
-    _stacktrace = array_to_string_list(_stacktrace);
-
     var _critical = critical ? "CRASH! " : "";
     var _build_date = global.build_date == "unknown build" ? "" : $"/{global.build_date}";
-    var _problem_line = clean_stacktrace_line(_exception.stacktrace[0]);
+    var _problem_line = array_length(_stacktrace) > 0 ? _stacktrace[0] : "unknown";
+    _stacktrace = array_to_string_list(_stacktrace);
     var _report_title = $"{_critical}[{global.game_version}{_build_date}] {_problem_line}";
 
     handle_error(_header, _message, _stacktrace, critical, _report_title);
 }

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b78977 and 79ad88d.

📒 Files selected for processing (9)
  • objects/obj_controller/Alarm_5.gml
  • objects/obj_en_fleet/Alarm_1.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_turn_end/Alarm_0.gml
  • scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
  • scripts/scr_kill_unit/scr_kill_unit.gml
  • scripts/scr_logging_functions/scr_logging_functions.gml
  • scripts/scr_mission_functions/scr_mission_functions.gml
💤 Files with no reviewable changes (1)
  • scripts/scr_mission_functions/scr_mission_functions.gml
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
**/*.gml

⚙️ CodeRabbit configuration file

  • All code should comply with the 2026 GML documentation.

Files:

  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • objects/obj_turn_end/Alarm_0.gml
  • scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
  • scripts/scr_kill_unit/scr_kill_unit.gml
  • objects/obj_en_fleet/Alarm_1.gml
  • objects/obj_controller/Alarm_5.gml
  • scripts/scr_logging_functions/scr_logging_functions.gml
**/*.*

⚙️ CodeRabbit configuration file

**/*.*: - Code Philosophy: Prioritize explicit intent and maintainability over brevity. If a
solution is "clever" but mentally taxing, request a refactor to a clearer approach.

  • Variable Naming: Use clear, descriptive names; avoid over-abbreviation.

  • Abstraction: Apply the "Rule of Three"; suggest abstraction only when similar logic is
    repeated three or more times to avoid premature complexity.

  • Subjective Choices: For naming or architecture, ask guiding questions to prompt developer
    reflection and provide at least two alternative perspectives.

  • TODOs: If a TODO comment is added, ask the user if a GitHub issue should be created. If a
    TODO comment is deleted, remind the user to check the status of that specific issue.

Files:

  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • objects/obj_turn_end/Alarm_0.gml
  • scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
  • scripts/scr_kill_unit/scr_kill_unit.gml
  • objects/obj_en_fleet/Alarm_1.gml
  • objects/obj_controller/Alarm_5.gml
  • scripts/scr_logging_functions/scr_logging_functions.gml
🧠 Learnings (9)
📓 Common learnings
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 424
File: scripts/scr_flavor/scr_flavor.gml:34-36
Timestamp: 2025-03-09T02:33:43.867Z
Learning: EttyKitty prefers to keep PRs focused on their stated goals and scope, and may decline to implement otherwise valid suggestions if they're not directly related to the PR's primary objective.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 579
File: objects/obj_enunit/Alarm_0.gml:200-202
Timestamp: 2025-03-11T01:38:19.874Z
Learning: EttyKitty welcomes easy, committable suggestions that improve documentation of code chunks, variables with strange names, and functions. Their codebase is generally lacking documentation, but they prioritize human-readable code above documentation.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: sprites/spr_weapon_phobos_bolt_pistol/spr_weapon_phobos_bolt_pistol.yy:26-44
Timestamp: 2025-06-16T17:08:08.239Z
Learning: EttyKitty prefers automated solutions over manual cleanup for .yy file formatting and is open to automated tools for GameMaker Studio .yy file cleanup.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 938
File: scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml:478-478
Timestamp: 2025-07-21T17:03:28.251Z
Learning: EttyKitty acknowledges when PRs contain scope creep and agrees that changes should be focused on the stated PR objectives, reinforcing their preference for keeping PRs narrowly scoped to their primary purpose.
📚 Learning: 2026-01-28T13:37:09.640Z
Learnt from: OH296
Repo: Adeptus-Dominus/ChapterMaster PR: 646
File: objects/obj_pnunit/Alarm_5.gml:84-91
Timestamp: 2026-01-28T13:37:09.640Z
Learning: In obj_pnunit/Alarm_5.gml, the function get_armour_data("maintenance") will always return a numeric value (at minimum 0), making null/undefined checks unnecessary.

Applied to files:

  • objects/obj_p_fleet/Alarm_1.gml
  • objects/obj_en_fleet/Alarm_4.gml
  • objects/obj_turn_end/Alarm_0.gml
📚 Learning: 2025-06-16T17:12:13.045Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: scripts/scr_culture_visuals/scr_culture_visuals.gml:1256-1352
Timestamp: 2025-06-16T17:12:13.045Z
Learning: In scripts/scr_culture_visuals/scr_culture_visuals.gml, the weapon visual data declarations contain known DRY violations that are acknowledged by the development team but deferred to future refactoring efforts rather than addressed in individual feature PRs.

Applied to files:

  • objects/obj_p_fleet/Alarm_1.gml
📚 Learning: 2025-03-13T06:18:10.295Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 424
File: scripts/scr_powers/scr_powers.gml:20-36
Timestamp: 2025-03-13T06:18:10.295Z
Learning: In EttyKitty's code, error handling should fail loudly instead of using silent defaults. Functions should return undefined or throw errors rather than returning default values when encountering unexpected conditions.

Applied to files:

  • objects/obj_en_fleet/Alarm_4.gml
📚 Learning: 2025-03-01T11:06:25.427Z
Learnt from: MCPO-Spartan-117
Repo: Adeptus-Dominus/ChapterMaster PR: 526
File: objects/obj_popup/Draw_0.gml:234-239
Timestamp: 2025-03-01T11:06:25.427Z
Learning: The comment "Need to modify ^^^^ based on if it is chaos or daemonic" in the artifact gifting code is intentionally kept as a reminder that this implementation is not yet finished, despite the significant refactoring already done.

Applied to files:

  • scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
  • objects/obj_en_fleet/Alarm_1.gml
  • objects/obj_controller/Alarm_5.gml
📚 Learning: 2025-02-18T17:36:23.214Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: :0-0
Timestamp: 2025-02-18T17:36:23.214Z
Learning: When commenting out code, add TODO comments explaining why the code is commented out.

Applied to files:

  • objects/obj_en_fleet/Alarm_1.gml
  • objects/obj_controller/Alarm_5.gml
📚 Learning: 2026-01-28T13:37:09.640Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 649
File: objects/obj_enunit/Alarm_0.gml:289-291
Timestamp: 2026-01-28T13:37:09.640Z
Learning: GameMaker Studio's function `action_if_variable(image_index, -500, 0)` is auto-generated code from GameMaker's visual Drag and Drop system. It checks if image_index equals -500. In ChapterMaster, this was being used as a special flag for enemy unit movement, but wasn't triggering consistently, causing enemies to move only every other turn. The refactored code replaced this with direct function calls at specific combat stages.

Applied to files:

  • objects/obj_en_fleet/Alarm_1.gml
📚 Learning: 2025-03-31T15:41:45.611Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 649
File: objects/obj_enunit/Alarm_0.gml:289-291
Timestamp: 2025-03-31T15:41:45.611Z
Learning: GameMaker Studio's function `action_if_variable(image_index, -500, 0)` was part of an old enemy movement system in ChapterMaster. This syntax is auto-generated from GameMaker's Drag-and-Drop interface and checks if image_index is greater than or equal to -500. In the refactored code, enemy movement is triggered directly through function calls rather than relying on this conditional check.

Applied to files:

  • objects/obj_en_fleet/Alarm_1.gml
📚 Learning: 2025-03-07T01:56:40.971Z
Learnt from: MCPO-Spartan-117
Repo: Adeptus-Dominus/ChapterMaster PR: 562
File: scripts/scr_marine_struct/scr_marine_struct.gml:0-0
Timestamp: 2025-03-07T01:56:40.971Z
Learning: Marines' ages should be incremented at the year transition in obj_turn_end/Alarm_1.gml rather than calculated dynamically based on the current year and recruitment date. This ensures proper aging without retroactive application.

Applied to files:

  • objects/obj_controller/Alarm_5.gml
🔇 Additional comments (11)
scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml (1)

283-287: Containment rites are sound, Tech-Priest.

The explicit try/catch around garrison mission completion is clear and maintainable, and the invocation terminator is now correctly inscribed.

As per coding guidelines: "Code Philosophy: Prioritize explicit intent and maintainability over brevity."

scripts/scr_kill_unit/scr_kill_unit.gml (1)

20-23: Exception conduit remains stable.

Tech-Priest, Line 20 to Line 23 preserves behaviour and routes failure cleanly to handle_exception(ex).

objects/obj_en_fleet/Alarm_1.gml (3)

244-247: Contraband invocation now uses valid scope symbols.

Tech-Priest, Line 246 now passes cur_star and t, aligning the call with in-scope identifiers.


359-423: Migration abort path now preserves activation order.

Tech-Priest, Line 359 to Line 423 correctly defers exit until after instance_activate_object(obj_star), preventing dormant-world state.


428-437: Movement ETA handling is now hardened.

Tech-Priest, Line 431 and Line 434 clamp ETA safely, and Line 437 includes the boundary case, preventing stalled transit states.

scripts/scr_logging_functions/scr_logging_functions.gml (1)

47-61: Context extraction rite is clean and decoupled.

Tech-Priest, Line 47 to Line 61 cleanly isolates game-state context for downstream error handling.

objects/obj_turn_end/Alarm_0.gml (1)

1-1: Top-level fault handling migration is coherent.

Tech-Priest, Line 1 and Line 217 to Line 219 centralise exception routing without perturbing the battle queue rites.

Also applies to: 217-219

objects/obj_en_fleet/Alarm_4.gml (1)

1-3: Exception scaffold alignment is sound.

Tech-Priest, the Line 1 to Line 122 refit keeps fleet movement semantics intact while standardising failure handling.

Also applies to: 39-39, 120-122

objects/obj_p_fleet/Alarm_1.gml (2)

22-23: Planetary traversal now reaches terminal indices.

Tech-Priest, Line 22 and Line 123 now iterate inclusively through planets, sealing the prior terminal-slot omission.

Also applies to: 123-124


1-1: Top-level fault routing is now uniform.

Tech-Priest, Line 1 and Line 174 to Line 176 align this alarm with the central handle_exception pattern.

Also applies to: 174-176

objects/obj_controller/Alarm_5.gml (1)

429-432: Faction disposition correction is now coherent.

Tech-Priest, Line 431 now increments eFACTION.INQUISITION, restoring symmetry with the surrounding disposition rites.

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

♻️ Duplicate comments (1)
objects/obj_controller/Alarm_5.gml (1)

23-33: ⚠️ Potential issue | 🟠 Major

Guard _star before all planet dereferences.

Tech-Priest, Line 27 and Line 32 read _star-bound fields before a reliable existence/planet-count gate. A no-star or zero-planet selection can rupture end-turn execution.

🛠️ Proposed safeguard
-    var xx3, yy3, plani, _star;
+    var xx3, yy3, plani, _star;
     xx3 = irandom(room_width) + 1;
     yy3 = irandom(room_height) + 1;
     _star = instance_nearest(xx3, yy3, obj_star);
-    plani = floor(random(_star.planets)) + 1;
+    plani = 0;
 
     // ** Chaos influence / corruption **
     if ((faction_gender[eFACTION.CHAOS] == 1) && (faction_defeated[eFACTION.CHAOS] == 0) && (turn >= chaos_turn)) {
         repeat (times) {
-            if ((_star.p_type[plani] != "Dead") && (_star.planets > 0) && (turn >= 20)) {
+            if (instance_exists(_star) && (_star.planets > 0) && (turn >= 20)) {
+                plani = irandom_range(1, _star.planets);
+                if (_star.p_type[plani] == "Dead") {
+                    continue;
+                }
                 var cathedral = 0;
                 if (planet_feature_bool(_star.p_feature[plani], eP_FEATURES.SORORITAS_CATHEDRAL) == 1) {
                     cathedral = choose(0, 1, 1);
                 }
#!/bin/bash
# Verify unsafe dereference ordering in the chaos block.
rg -n -C3 '_star = instance_nearest|plani = floor\(random\(_star\.planets\)\)|_star\.p_type\[plani\]' objects/obj_controller/Alarm_5.gml

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79ad88d and 25a2031.

📒 Files selected for processing (2)
  • objects/obj_controller/Alarm_5.gml
  • scripts/scr_logging_functions/scr_logging_functions.gml
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
**/*.gml

⚙️ CodeRabbit configuration file

  • All code should comply with the 2026 GML documentation.

Files:

  • scripts/scr_logging_functions/scr_logging_functions.gml
  • objects/obj_controller/Alarm_5.gml
**/*.*

⚙️ CodeRabbit configuration file

**/*.*: - Code Philosophy: Prioritize explicit intent and maintainability over brevity. If a
solution is "clever" but mentally taxing, request a refactor to a clearer approach.

  • Variable Naming: Use clear, descriptive names; avoid over-abbreviation.

  • Abstraction: Apply the "Rule of Three"; suggest abstraction only when similar logic is
    repeated three or more times to avoid premature complexity.

  • Subjective Choices: For naming or architecture, ask guiding questions to prompt developer
    reflection and provide at least two alternative perspectives.

  • TODOs: If a TODO comment is added, ask the user if a GitHub issue should be created. If a
    TODO comment is deleted, remind the user to check the status of that specific issue.

Files:

  • scripts/scr_logging_functions/scr_logging_functions.gml
  • objects/obj_controller/Alarm_5.gml
🧠 Learnings (7)
📓 Common learnings
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 424
File: scripts/scr_flavor/scr_flavor.gml:34-36
Timestamp: 2025-03-09T02:33:43.867Z
Learning: EttyKitty prefers to keep PRs focused on their stated goals and scope, and may decline to implement otherwise valid suggestions if they're not directly related to the PR's primary objective.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 579
File: objects/obj_enunit/Alarm_0.gml:200-202
Timestamp: 2025-03-11T01:38:19.874Z
Learning: EttyKitty welcomes easy, committable suggestions that improve documentation of code chunks, variables with strange names, and functions. Their codebase is generally lacking documentation, but they prioritize human-readable code above documentation.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: sprites/spr_weapon_phobos_bolt_pistol/spr_weapon_phobos_bolt_pistol.yy:26-44
Timestamp: 2025-06-16T17:08:08.239Z
Learning: EttyKitty prefers automated solutions over manual cleanup for .yy file formatting and is open to automated tools for GameMaker Studio .yy file cleanup.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 938
File: scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml:478-478
Timestamp: 2025-07-21T17:03:28.251Z
Learning: EttyKitty acknowledges when PRs contain scope creep and agrees that changes should be focused on the stated PR objectives, reinforcing their preference for keeping PRs narrowly scoped to their primary purpose.
📚 Learning: 2025-09-04T14:52:45.005Z
Learnt from: OH296
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: :0-0
Timestamp: 2025-09-04T14:52:45.005Z
Learning: Project coding style summary:
- Constructors PascalCase; functions/variables snake_case with group prefixes (scr_*).
- Enums: enum name eNAME in SNAKE_CASE; entries PascalCase.
- Macros: ALL_CAPS SNAKE_CASE.
- Indentation 4 spaces; semicolons; use &&/||; parentheses for mixed ops; prefer ++/--.
- Prefer template strings $"..."; use “///” doc comments.
- Locals recommended with leading underscore.
- Organize scripts into library-like files; use early returns and init vars at declaration.

Applied to files:

  • scripts/scr_logging_functions/scr_logging_functions.gml
📚 Learning: 2025-03-01T11:06:25.427Z
Learnt from: MCPO-Spartan-117
Repo: Adeptus-Dominus/ChapterMaster PR: 526
File: objects/obj_popup/Draw_0.gml:234-239
Timestamp: 2025-03-01T11:06:25.427Z
Learning: The comment "Need to modify ^^^^ based on if it is chaos or daemonic" in the artifact gifting code is intentionally kept as a reminder that this implementation is not yet finished, despite the significant refactoring already done.

Applied to files:

  • objects/obj_controller/Alarm_5.gml
📚 Learning: 2026-01-28T13:37:09.640Z
Learnt from: OH296
Repo: Adeptus-Dominus/ChapterMaster PR: 646
File: objects/obj_pnunit/Alarm_5.gml:84-91
Timestamp: 2026-01-28T13:37:09.640Z
Learning: In obj_pnunit/Alarm_5.gml, the function get_armour_data("maintenance") will always return a numeric value (at minimum 0), making null/undefined checks unnecessary.

Applied to files:

  • objects/obj_controller/Alarm_5.gml
📚 Learning: 2025-02-18T17:36:23.214Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: :0-0
Timestamp: 2025-02-18T17:36:23.214Z
Learning: When commenting out code, add TODO comments explaining why the code is commented out.

Applied to files:

  • objects/obj_controller/Alarm_5.gml
📚 Learning: 2025-03-06T16:02:06.286Z
Learnt from: MCPO-Spartan-117
Repo: Adeptus-Dominus/ChapterMaster PR: 554
File: objects/obj_popup/Step_0.gml:756-767
Timestamp: 2025-03-06T16:02:06.286Z
Learning: The variable 'woopwoopwoop' in the ChapterMaster codebase is a poorly named multi-purpose variable used both for controlling ancient ruins combat flow and for passing menu state in the save/load system. This type of naming makes code maintenance difficult.

Applied to files:

  • objects/obj_controller/Alarm_5.gml
📚 Learning: 2025-03-07T01:56:40.971Z
Learnt from: MCPO-Spartan-117
Repo: Adeptus-Dominus/ChapterMaster PR: 562
File: scripts/scr_marine_struct/scr_marine_struct.gml:0-0
Timestamp: 2025-03-07T01:56:40.971Z
Learning: Marines' ages should be incremented at the year transition in obj_turn_end/Alarm_1.gml rather than calculated dynamically based on the current year and recruitment date. This ensures proper aging without retroactive application.

Applied to files:

  • objects/obj_controller/Alarm_5.gml
🔇 Additional comments (3)
objects/obj_controller/Alarm_5.gml (2)

358-369: Guarded warlord placement is sound.

Tech-Priest, the _candidate_planets length check now shields all downstream writes from empty-pool faults. This correction is worthy.


431-432: Disposition target correction accepted.

Tech-Priest, shifting the increment to eFACTION.INQUISITION resolves the faction accounting drift in Penitent Crusade resolution.

scripts/scr_logging_functions/scr_logging_functions.gml (1)

187-191: Stacktrace sanitisation centralisation is clean.

Tech-Priest, routing all lines through clean_stacktrace_line in one helper reduces divergence across exception paths. This is a worthy refactor.

@EttyKitty EttyKitty merged commit b1c5d2c into main Mar 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant