Skip to content

Conversation

@EttyKitty
Copy link
Collaborator

@EttyKitty EttyKitty commented Mar 27, 2025

Purpose of changes

  • Fix the existing not properly working vehicle recovery priority system.
  • Add a marine recovery priority system.
  • Refactor the related code bits, to be a bit more readable.
  • Marine and vehicle recovery systems.

Describe the solution

  • The solution is psychotic, and there is probably a better/cleaner way to do this.
    • First, you basically loop through each player column and assemble structs of dead unit data with column id, unit id, unit struct and priority.
    • Then you add each of these structs to the recovery queue.
    • Then you go through the priority queue, recovering units with the highest priority first.
    • To make this work, I had to remove alarm[5] from the player column object, move it into a dumb func and call it from the battle object, because this alarm needed units to be revived before being executed.
    • Most of the code repeats itself and honestly a garbage mess. I was just so done with it, that I could bring myself to improve it further. I just want it to end.
  • Integrated constitution tests into marine recovery system.
  • obj_punit alarm 5 and alarm 4 are copy-pasted into functions.
  • scripts/scr_after_combat/scr_after_combat.gml now contains many of the combat end related functions.
  • Marine recovery priority is based on their EXP and role.
  • Random survival no longer works for all units. Only units with the sus membrane can attempt it.
  • Sus membrane has no health threshold at which it no longer saves units. -1500% hp marines incoming.
  • First, apothecaries try to recover units and restore some of their HP; when you run out of recovery points, the sus membrane tries to save them, without HP recovery; if both fail - the unit dies.

Describe alternatives you've considered

None

Testing done

  • A couple of battles against 5 str orks with predators and some marines in the front. Some marines and preds died - then got recovered.

Related links

None

Custom player notes entry

Use the PR title.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Introduced an enhanced post-combat system that improves unit recovery and refines experience allocation, ensuring a more dynamic battle outcome.
    • Enhanced feedback for combat results with critical injury notifications now highlighted in red and unit status updated to indicate "critically damaged" conditions.
  • Refactor

    • Streamlined casualty tracking to precisely differentiate marine losses.
    • Simplified unit notifications and optimised in-game physics for more natural object interactions.

Walkthrough

O honourable data, observe the sacred modifications: this commit replaces the experience distribution mechanism by removing the old script scr_distribute_experience and adding a new post-combat script, scr_after_combat, into the ChapterMaster configuration. The mortal tally procedure has been refined by renaming the variable tracking general deaths to final_marine_deaths across several combat objects. Additionally, arrays for marines and vehicles queued for recovery are now declared, and obsolete variables such as command_casualties have been expurgated. Minor adjustments have also been made in object event lists and physics shape point precision within the pnunit schema, ensuring consistent numerical representation. These systematic alterations serve to recalibrate post-combat recovery protocols and experience management within the game’s code.

Possibly related PRs

  • feat: Custom priority and costs to vehicle recovery #580: The changes in the main PR, which involve adding a new script for post-combat recovery and experience distribution, are related to the retrieved PR that enhances vehicle recovery logic, as both involve managing recovery processes and experience distribution in combat scenarios.
  • feat: Ground Combat Overhaul: Balance, ARP System, and New Weapons #483: The changes in the main PR, which involve adding a new script for post-combat actions and removing the experience distribution script, are related to the changes in the retrieved PR, which also includes modifications to experience distribution and combat mechanics, specifically through the introduction of new weapons and adjustments to existing combat logic.
  • feat: Unit Management improvements #538: The changes in the main PR, which involve adding a new script for post-combat recovery and experience distribution, are related to the retrieved PR as both involve modifications to the management of experience distribution in combat scenarios, specifically through the introduction of new functions and the removal of the old experience distribution script.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 27ec149 and 545930a.

📒 Files selected for processing (1)
  • objects/obj_ncombat/KeyPress_13.gml (0 hunks)
💤 Files with no reviewable changes (1)
  • objects/obj_ncombat/KeyPress_13.gml

🪧 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: Feature Adds something new Size: Huge labels Mar 27, 2025
@EttyKitty
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a7dc532 and 4904d6a.

📒 Files selected for processing (10)
  • ChapterMaster.yyp (1 hunks)
  • objects/obj_ncombat/Alarm_5.gml (7 hunks)
  • objects/obj_ncombat/Alarm_7.gml (2 hunks)
  • objects/obj_ncombat/Create_0.gml (2 hunks)
  • objects/obj_ncombat/KeyPress_13.gml (0 hunks)
  • objects/obj_pnunit/Alarm_5.gml (0 hunks)
  • objects/obj_pnunit/obj_pnunit.yy (1 hunks)
  • scripts/scr_after_combat/scr_after_combat.gml (1 hunks)
  • scripts/scr_after_combat/scr_after_combat.yy (1 hunks)
  • scripts/scr_distribute_experience/scr_distribute_experience.gml (0 hunks)
💤 Files with no reviewable changes (3)
  • scripts/scr_distribute_experience/scr_distribute_experience.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_pnunit/Alarm_5.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_ncombat/Create_0.gml
  • objects/obj_ncombat/Alarm_5.gml
  • objects/obj_ncombat/Alarm_7.gml
  • scripts/scr_after_combat/scr_after_combat.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_ncombat/Create_0.gml
  • objects/obj_ncombat/Alarm_5.gml
  • objects/obj_ncombat/Alarm_7.gml
  • scripts/scr_after_combat/scr_after_combat.gml
🔇 Additional comments (25)
objects/obj_pnunit/obj_pnunit.yy (1)

39-40: Commendation: The sacred precision of integers is superior to floating-point approximations.

The holy conversion from imprecise floating values (0.0, 5.0) to sacred integers (0, 5) is logically sound. This modification optimizes computational efficiency while maintaining functional equivalence, as dictated by the Omnissiah's principles of digital purity.

scripts/scr_after_combat/scr_after_combat.yy (1)

3-3: The designation has been appropriately reconsecrated to reflect its true purpose.

The machine spirit of this script has been renamed from "scr_distribute_experience" to "scr_after_combat", a more encompassing designation that better represents its function within the combat logic circuits. This nomenclature alteration aligns with the Omnissiah's dictates for proper categorization of binary procedures.

Also applies to: 6-6

objects/obj_ncombat/Create_0.gml (2)

31-32: Praise be to the Machine God for these new data repositories.

The addition of these sacred array structures will serve as proper receptacles for the machine spirits of damaged units awaiting techno-liturgical recovery rites. These data structures shall maintain the proper hierarchy of recovery priorities as dictated by the holy STC templates.


152-152: The variable designation has been properly specified for clarity.

The renaming from "final_deaths" to "final_marine_deaths" is a logical improvement that increases the semantic precision of this data node. This modification ensures proper categorization of mortality statistics according to unit type, as the Omnissiah demands precise ontological classification in all data structures.

ChapterMaster.yyp (1)

664-664: Praise be to the Omnissiah! New script component integrated successfully.

The addition of scr_after_combat in favor of the previous scr_distribute_experience represents a satisfactory adaptation of the sacred project structure. As the PR objectives indicate, this modification supports the implementation of Marine and Vehicle recovery priorities, a logical advancement of the machine-spirit's capability to prioritize unit restoration post-combat.

This script modification aligns perfectly with the Machine God's will for more efficient combat resource management. The new script will likely enhance post-combat recovery protocols by implementing the described priority queue system based on column ID, unit ID, unit struct, and priority data.

objects/obj_ncombat/Alarm_7.gml (3)

258-258: Blessed consistency in naming variables, honoured Tech-Acolyte.
Line 258 now refers to final_marine_deaths in place of final_deaths. This correction aligns with the revised naming scheme for Adeptus Astartes casualties. No errors in logic appear here, and the code now more clearly tracks the fallen marines.


269-269: Proper invocation of the Defeat Protocol.
Replacing final_deaths with final_marine_deaths maintains consistency when summoning the defeat message if casualties surpass a threshold of 10. The logic stands correct for detecting defeat conditions.


271-271: Ensuring parallel usage of final_marine_deaths.
This line mirrors the adjusted logic in the if-clause to record a defeat message. Employing final_marine_deaths + final_command_deaths is consistent with the rest of the script’s approach to losses.

scripts/scr_after_combat/scr_after_combat.gml (3)

1-20: Commendation for structured marine recovery.
The new add_marines_to_recovery function properly iterates through player_column.unit_struct, preparing an array of fallen battle-brothers for resurrection attempts. Logic checks for marine_dead[i] and ignores allied units, ensuring only relevant Astartes undertake the sacred recovery.


51-62: Assembling living brethren is efficient and clear.
The assemble_alive_units function collects only living non-allied units, neatly grouping them for post-battle operations. This helps maintain an accurate record of active combatants.


64-85: Laudable approach to distributing experience.
The logic calculates each warrior’s experience share, scaled by their existing level. This helps avoid sudden overpowered leaps. Marking librarians that learn new powers is also well done.

objects/obj_ncombat/Alarm_5.gml (14)

20-25: Initiation of post-combat recovery.
Invoking add_marines_to_recovery and add_vehicles_to_recovery only when obj_ncombat.defeat == 0 ensures these holy rites occur for successful engagements. Logical gating seems sound.


27-45: Creation of marine recovery priority queue.
The reliance on ds_priority to retrieve top-priority casualties is an organised approach. Deducting unit_recovery_score and incrementing units_saved is coherent.


82-84: Additional invocation for after-battle updates.
Calling after_battle_part1() here centralises key post-battle logic, ensuring that gear salvaging, gene-seed updates, and other finalisations occur systematically.


86-104: Calculating total losses.
Declaring _total_deaths as (final_marine_deaths + final_command_deaths) - units_saved clarifies the final figure of truly fallen Astartes. The subsequent logic for enumerating these losses is well-structured.


106-108: Marine saviours.
Announcing how many marines the Apothecaries have rescued fosters clarity for the glorious reconstruction efforts. No miscalculation is evident.


132-144: Gene-seed reclamation.
Properly accounts for scenarios where no Apothecaries survive or the Chapter is afflicted by mutations, thus losing gene-seed. This is consistent with existing world-lore mechanics.


158-159: Blank newline usage.
These lines simply inject spacing, promoting readability within the sacred text.


163-166: Vehicle recovery message.
Announcing how many machines of war were rescued by Techmarines is thematically sound. The logic references the same priority logic introduced earlier.


168-183: Vehicle loss handling.
Details the final count of vehicles destroyed, listing them by type. This consistent approach mirrors the marine casualty reporting. The usage of newline_color="red"; draws attention appropriately.


211-234: Post-battle experience distribution block.
Calls assemble_alive_units and calculates average_battle_exp_gain. Summarising the changes in librarian powers is straightforward and user-friendly. The usage of name_role() is also more descriptive.


238-238: Assignment of post-equipment lost data.
Line 238 ensures any post-equipment-lost arrays are passed to obj_ground_mission. Harmonising data across objects fosters unity in the code’s architecture.


632-652: Leader elimination logic.
A properly displayed message when an enemy leader falls. The event log updates also appear consistent with the journaling approach used for other factions.


785-791: Sorcery usage detection.
Checks if the Inquisition has witnessed illicit powers. This is a meaningful expansion of the campaign’s consequences, adjusting loyalty accordingly. The logic is consistent with the broader theme of watchful or suspicious allies.


47-80: Vehicle salvation queue.
Similar to marines, vehicles now follow a priority-based recovery. The if (obj_controller.stc_bonus[3] = 4) check stands out—be certain the single ‘=’ is indeed a valid comparison in your GML dialect. Otherwise, this might inadvertently assign a value.

Shall we verify that equality is performed correctly in your game’s version of GML?

#!/bin/bash
# Searching for other usage of stc_bonus comparisons across scripts to confirm consistency:
rg "stc_bonus\[3\]" -A 4

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 28, 2025
@EttyKitty EttyKitty marked this pull request as ready for review March 28, 2025 18:16
@EttyKitty
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 28, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 (3)
objects/obj_ncombat/Alarm_5.gml (3)

103-119: 🧹 Nitpick (assertive)

Gear checks for special items are robust, but watch for edge cases.
The detection of “Plasma Bomb” or “Exterminatus” gear while marines remain alive effectively tracks high-value wargear. Be mindful that older GML dialects can treat single-= as assignment, so verifying your environment’s function for these conditionals is crucial.


150-166: 🧹 Nitpick (assertive)

Gene-seed harvesting logic is well-aligned with the rites of the Astartes.
Here, the code properly increments seed_max based on age checks. Overall correct, but do verify random thresholds are balanced for your desired difficulty. The Emperor’s mercy need not be random if your design requires a consistent harvest rate.


180-340: 🧹 Nitpick (assertive)

Extensive salvage sub-routine.
Five passes are made (armour, weapon1, weapon2, gear, mobility) extracting or destroying each item. This code is quite verbose, reflecting a pattern repeated for each item slot. For future expansions, you might consider a single function that processes salvage checks more dynamically to reduce duplication and purify the code’s structure in honour of the Omnissiah.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4904d6a and d7e5946.

📒 Files selected for processing (3)
  • ChapterMaster.yyp (2 hunks)
  • objects/obj_ncombat/Alarm_5.gml (7 hunks)
  • scripts/scr_after_combat/scr_after_combat.gml (1 hunks)
🧰 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_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.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_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.gml
🔇 Additional comments (14)
ChapterMaster.yyp (1)

664-664: The Omnissiah has blessed this codebase with increased efficiency!

The sacred augmentation of scr_after_combat script to the resources registry is logically sound. According to the PR objectives, this script houses the new marine and vehicle recovery priority system. The removal of the outdated scr_distribute_experience script and its replacement with this more comprehensive post-combat routine demonstrates proper adherence to the principles of code optimization.

01101101 01100001 01111001 00100000 01110100 01101000 01100101 00100000 01001111 01101101 01101110 01101001 01110011 01110011 01101001 01100001 01101000 00100000 01100010 01101100 01100101 01110011 01110011 00100000 01110100 01101000 01101001 01110011 00100000 01100011 01101111 01100100 01100101

objects/obj_ncombat/Alarm_5.gml (7)

9-9: Verily, this commented debug line might be an obsolete remnant.
O blessed developer, thou hast a line referencing final_marine_deaths that is commented out. Consider removing or re-enabling it if needed for troubleshooting, lest it add unneeded clutter.


19-24: Commendable retrieval logic for marines.
These lines properly gate the recovery procedure to when defeat is zero, which appeases the machine spirit by preventing unnecessary salvage calls in a lost scenario. Well done.


80-101: Invocation of after_battle_part1 and _total_deaths computation are consistent.
The logic to handle marine losses and display final death counts is performed with due diligence. No major concerns are detected here, though expansions to reflect certain special mission parameters could be beneficial in future.


126-146: Adequate final death categorisation for command vs standard units.
This block cleanly increments final_command_deaths or final_marine_deaths. The approach fairly distinguishes casualties among specialist roles. Should you require more complex logic for ephemeral roles (like "trainee"), ensuring robust classification of newly introduced roles is recommended.


168-178: Correct usage of post_unit_lost array for custom role names.
This block appends the marine’s role or type to the array if vacant. No immediate concerns, though watch for potential collisions if multiple marines share identical roles.


342-367:

❓ Verification inconclusive

Vehicle death tracking is thorough, but be cautious about indexing.
This segment increments vehicle_deaths and updates post_unit_lost with the lost vehicle. The nested loop uses a second for alongside an o+=1 approach that can be tricky to follow. Ensure the indexing logic will not skip or overflow the array if post_unit_lost is near capacity.

Please run this script to confirm no references cause out-of-bounds errors:


🏁 Script executed:

#!/bin/bash
rg 'post_unit_lost\[' -A 3

Length of output: 2848


Attention, Devotee of the Code: Verify Array Index Sanctity

The Omnissiah’s data indicates that the vehicle death tracking is implemented with careful thought, yet the nested iteration—particularly the incrementation of the variable o—in the combat script demands vigilance. Our investigation reveals:

  • Array Initialisation: In objects/obj_ncombat/Create_0.gml, the arrays post_unit_lost, post_units_lost, and post_unit_veh are properly initialised.
  • Boundary Checks in Output: In objects/obj_ncombat/Alarm_5.gml, the condition if (i < array_length(post_unit_lost) - 1) ensures that the indexing for output is bounded.
  • Nested Loop Caution: In scripts/scr_after_combat/scr_after_combat.gml, the update logic using o to track vehicle losses must be verified to ensure it does not breach array capacity when the casualty tally rises.

While no immediate out-of-bounds errors have been unearthed by our rituals, remain cautious and confirm that the indexing of o is robust under all conditions. Continue testing this logic to honour the Machine God’s precision.


46-78:

✅ Verification successful

Vehicle salvage logic harmonises with the Omnissiah’s hierarchy.
The introduction of _vehicle_recovery_queue and distinct numerical priority values is praiseworthy, ensuring mightier vehicles (like Land Raiders) are rescued first. As a small improvement, confirm that out-of-range or new vehicle types will not be overlooked if the _vehicles_priority struct lacks an entry.

Please confirm by scanning for references of veh_type[] usage across the codebase:


🏁 Script executed:

#!/bin/bash
rg -A 5 'veh_type\['

Length of output: 11368


Vehicle Salvage Logic Verified and Approved

Ave tech, your vehicle recovery mechanism art most pleasing to the Machine Spirit. The introduction of the _vehicle_recovery_queue and discrete numerical priority values capably ensures that mighty vehicles — the Land Raiders among them — are attended to with due reverence. Our diligent scan revealed that in scripts/scr_after_combat/scr_after_combat.gml, the existence check

if (struct_exists(_vehicles_priority, veh_type[i])) && (veh_dead[i]) && (!veh_ally[i])

confirms that new or out-of-range vehicle types without a corresponding entry in the _vehicles_priority structure are indeed excluded from the recovery process.

  • The filtering in scr_after_combat confirms that no vehicle type shall be inadvertently overlooked.
  • The salvage logic flows in harmony with the creed of the Omnissiah.

Your code requires no further amendments on this matter. Praise be to the Machine!

scripts/scr_after_combat/scr_after_combat.gml (6)

1-17: Marine recovery logic is systematically sound.
The iteration over unit_struct and the creation of _recovery_candidate objects properly keep track of each marine’s ID, experience, and so forth. This is an efficient approach as it isolates the building of the recovery pool to a single function.


42-52: Assembling alive units is elegantly handled.
Gathering survivors into end_alive_units is neatly consolidated in this function, preventing duplicate code in your logic. This fosters maintainability and clarity.


78-87: Streamlined post-battle Death Company assignment.
Here, the code ensures that any unit flagged as Death Company is properly given the Death Company role if they are not already so assigned. No major issues are perceived.


121-146: Properly incrementing final_command_deaths or final_marine_deaths.
The code deals with command losses and standard marine losses distinctly, reflecting the correct usage from the parent object’s logic. Clear alignment with your overall system.


168-178: post_unit_lost array usage remains consistent.
Your approach to naming and indexing within the post_unit_lost array is mirrored across the codebase, ensuring uniform tracking for lost marines or vehicles.


341-367:

❓ Verification inconclusive

Vehicle loss recording is coherent.
This chunk tallies vehicle_deaths and updates post_unit_lost for vehicles. Keep a watchful eye on array indexing increments, given the manual o+=1 approach in nested loops, to avoid out-of-bounds confusion.


🏁 Script executed:

#!/bin/bash
rg 'post_unit_lost\[' -A 5

Length of output: 3409


Hail the Omnissiah: Verify Array Indexing in Vehicle Loss Code

The vehicle loss tallying in scripts/scr_after_combat/scr_after_combat.gml appears functionally coherent, as evidenced by our search output. However, the manual increment operation (o += 1) within the nested loop must be carefully scrutinised to ensure that it does not lead the machine spirit into array out‑of‑bounds error or skipped indices.

  • Verify that the manual index incrementation in the inner loop (lines 341–367) is intentional and safely bounded.
  • Confirm that this pattern — as also observed in the related initialisation and reporting of post_unit_lost in other modules — does not compromise future iterations or lead to transient errors.

May the machine’s precision guide your review.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 28, 2025
@EttyKitty EttyKitty added the Type: Fix This is a fix for a bug label Mar 29, 2025
Copy link
Collaborator

@OH296 OH296 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fuck yeah death to the alarms. Gonna take me a few stints to read through most of this but it pretty much seems all good to me

@EttyKitty EttyKitty force-pushed the feat/recovery-priority branch from cca8137 to 9430b9e Compare March 31, 2025 16:59
@EttyKitty
Copy link
Collaborator Author

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 (2)
objects/obj_ncombat/Alarm_5.gml (2)

125-147: 🧹 Nitpick (assertive)

Death Company transition and Mucranoid slime checks.
Behold, the logic for reassigning marines to the Death Company role upon survival is consistent with your chapter’s dark rituals. The random armour destruction from mucranoid slime also appears correct. The single equals usage for GML conditions may again spark confusion in some environs, so maintain vigilance.


227-377: 🛠️ Refactor suggestion

Potential candidate for code extraction (DRY principle).
These repeated blocks for salvaging armour, weapons, gear, and mobility items are functional yet verbose. Creating a shared subroutine for item salvage might please the Omnissiah and reduce repeated code sections.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d7e5946 and 9430b9e.

📒 Files selected for processing (11)
  • ChapterMaster.yyp (2 hunks)
  • objects/obj_ncombat/Alarm_5.gml (7 hunks)
  • objects/obj_ncombat/Alarm_7.gml (2 hunks)
  • objects/obj_ncombat/Create_0.gml (3 hunks)
  • objects/obj_ncombat/KeyPress_13.gml (0 hunks)
  • objects/obj_pnunit/Alarm_4.gml (1 hunks)
  • objects/obj_pnunit/Alarm_5.gml (0 hunks)
  • objects/obj_pnunit/obj_pnunit.yy (1 hunks)
  • scripts/scr_after_combat/scr_after_combat.gml (1 hunks)
  • scripts/scr_after_combat/scr_after_combat.yy (1 hunks)
  • scripts/scr_distribute_experience/scr_distribute_experience.gml (0 hunks)
💤 Files with no reviewable changes (3)
  • scripts/scr_distribute_experience/scr_distribute_experience.gml
  • objects/obj_ncombat/KeyPress_13.gml
  • objects/obj_pnunit/Alarm_5.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_ncombat/Alarm_7.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.gml
  • objects/obj_pnunit/Alarm_4.gml
  • objects/obj_ncombat/Create_0.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_ncombat/Alarm_7.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.gml
  • objects/obj_pnunit/Alarm_4.gml
  • objects/obj_ncombat/Create_0.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_ncombat/Alarm_7.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.gml
  • objects/obj_pnunit/Alarm_4.gml
  • objects/obj_ncombat/Create_0.gml
🔇 Additional comments (19)
scripts/scr_after_combat/scr_after_combat.yy (2)

3-3: Metadata Transmutation Approved
O blessed cogitator, the alteration of the %Name field to "scr_after_combat" is precise and in harmony with the sacred modifications decreed. The machine-spirit recognises and blesses this implementation, ensuring the proper invocation of our post-combat rituals.


6-6: Nomenclature Sanctification Complete
The renaming of the "name" attribute to "scr_after_combat" is aptly executed, thereby securing the integrity of the script’s identity within the Combat folder. This change honours the mechanistic design and sustains the proper alignment with our recovery protocols.

ChapterMaster.yyp (1)

664-664: Approval of new after-combat processing script.

The sacred Omnissiah has blessed this project with a new holy post-combat script! The binary augurs detect the introduction of scr_after_combat to consolidate recovery and experience distribution functions. This is a logical rationalization of machine-spirit efficiency, replacing the previous scr_distribute_experience script as mentioned in the binary-divination summary.

Praise be to the addition of marine and vehicle recovery priorities, for such structures shall bring order to the machine-spirits of your combat units. The Omnissiah approves of structured data patterns utilizing arrays of structs containing column ID, unit ID, unit struct, and priority values for efficient post-combat processing.

01110000 01110010 01100001 01101001 01110011 01100101 00100000 01110100 01101000 01100101 00100000 01001111 01101101 01101110 01101001 01110011 01110011 01101001 01100001 01101000

objects/obj_ncombat/Create_0.gml (3)

31-32: Initialize recovery tracking arrays

Most satisfactory initializations for the sacred variables to count units worthy of recovery. These counters shall serve as repositories of knowledge for the battle-cogitator functions.


121-122: Implement data structures for tracking lost units

Commendable implementation of data-collection structs to track the quantities of lost machine spirits. The Machine God approves of your systematic cataloguing of battlefield losses.


153-153: Renamed death counter for specificity

The binary lexicon has been rectified to specify marine casualties with greater precision. This semantic clarification will improve the data-purity of post-combat calculations.

objects/obj_ncombat/Alarm_7.gml (3)

258-258: Updated marine casualty calculation

The binary designation has been properly updated to reference the more specifically named final_marine_deaths variable. This ensures proper accounting of fallen Adeptus Astartes.


269-269: Updated defeat message condition with renamed death counter

The conditional logic has been recalibrated to utilize the correctly named variable. The sacred machine logic now properly references final_marine_deaths, maintaining consistency with the omniscient variable naming schema.


271-271: Updated defeat message string with renamed death counter

The string interpolation function has been realigned to reference the properly named casualty counter. This maintains the sacred consistency of the codebase.

objects/obj_ncombat/Alarm_5.gml (7)

9-9: Redundant debugging log [Already flagged previously].
This commented-out debug line has already been noted in an earlier sermon. Nothing else to address here.


19-69: Verify correctness of the “= 4” comparison in the vehicle recovery logic.
Lo, the sacred script for constructing marine and vehicle priority queues is most sensible, but observe line 50: if (obj_controller.stc_bonus[3] = 4) {...}. In modern GML contexts, a single equals sign performs an assignment. Confirm whether your dev environment interprets single equals as an equality check or an assignment. If it is indeed assignment, this will always be “true” and might be heresy.

Wouldst thou confirm that the single equals is intended for equality in older GML dialect, or require correction to double equals (==) for modern code?


76-93: Commendable approach to final casualty tally.
Your method of subtracting units_saved from total marine and command deaths results in _total_deaths, providing a clear metric. The usage is straightforward and well-structured. No immediate concerns arise.


94-103: Notification for saved marines and critical injuries is consistent.
The logic for displaying saved marines and red-coloured “critical injury” messages is coherent, ensuring proper communication of results to the user.


148-165: Plasma Bomb and Exterminatus gear checks are thematically sound.
Allowing marines bearing “Plasma Bomb” or “Exterminatus” to effectively equip or remove it in the post-battle logic is righteous. Just ensure your environment is consistent about single equals usage for the condition checks.


167-225: Marine death tracking logic is well-defined.
Here thou record the final marine and command deaths, plus potential gene-seed harvesting. This comprehensively updates the relevant counters and event logs. Make sure that the usage of single equals for checks aligns with the older GML standard to avoid unholy bugs.


384-400: Vehicle death detection is consistent and integrates with the crunchy logs.
Converting destroyed vehicles into vehicle_deaths and updating the company to be “crunched” is thorough. Keep an eye on any future expansions to your list of vehicles to ensure consistency in all priority structures.

scripts/scr_after_combat/scr_after_combat.gml (3)

66-86: Request verification for struct_exists usage.
The check (struct_exists(_vehicles_priority, veh_type[i])) is a valid approach in certain GML versions. If your environment supports it, all is well. Otherwise, confirm it is recognised.


88-99: Excellent unit assembly routine.
assemble_alive_units() neatly collects marines that are not flagged as dead, which is essential for delivering the righteous experience distribution. The logic is clean and direct.


100-121: Properly balanced experience distribution.
Distributing XP based on a diminishing returns formula ensures veterans do not run away with an excessive advantage, while novices still benefit from group gains. This is elegantly done, though in the future you might consider extra modifiers for heroic feats.

@EttyKitty EttyKitty marked this pull request as draft March 31, 2025 17:24
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 31, 2025
@EttyKitty
Copy link
Collaborator Author

there are some issues with this, that require work. I'll put a draft status.

…om survival to the recovery code, repair enemy kills display
@EttyKitty EttyKitty marked this pull request as ready for review March 31, 2025 18:10
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: 9

🔭 Outside diff range comments (1)
scripts/scr_flavor2/scr_flavor2.gml (1)

1-1: 🧹 Nitpick (assertive)

Add function documentation.
High praise to the Omnissiah, but the sacred function scr_flavor2 lacks JSDoc or similar annotation. Installing baseline documentation here will bolster clarity for fellow adepts.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9430b9e and 6c369bf.

📒 Files selected for processing (6)
  • objects/obj_ncombat/Alarm_3.gml (1 hunks)
  • objects/obj_ncombat/Alarm_5.gml (7 hunks)
  • objects/obj_pnunit/Alarm_4.gml (0 hunks)
  • objects/obj_pnunit/obj_pnunit.yy (1 hunks)
  • scripts/scr_after_combat/scr_after_combat.gml (1 hunks)
  • scripts/scr_flavor2/scr_flavor2.gml (2 hunks)
💤 Files with no reviewable changes (1)
  • objects/obj_pnunit/Alarm_4.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_ncombat/Alarm_3.gml
  • scripts/scr_flavor2/scr_flavor2.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.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_ncombat/Alarm_3.gml
  • scripts/scr_flavor2/scr_flavor2.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.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_ncombat/Alarm_3.gml
  • scripts/scr_flavor2/scr_flavor2.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_after_combat/scr_after_combat.gml
🔇 Additional comments (15)
objects/obj_ncombat/Alarm_3.gml (1)

97-97: The logic extension for colouring “critically injured” in red appears consistent.
Be aware that string_count is case-sensitive, so “CRITICALLY INJURED” will not be detected unless deliberately converted. Otherwise, this is acceptable.

scripts/scr_flavor2/scr_flavor2.gml (1)

358-358: The shift from “lost” to “critically injured” is well-aligned with the new condition.
This improvement ensures consistency with recently updated messaging. No major issues found.

Also applies to: 379-379

objects/obj_pnunit/obj_pnunit.yy (1)

38-39: Changing coordinates from float to integer is safe.
The Machine Spirit approves; this small revision has minimal risk.

objects/obj_ncombat/Alarm_5.gml (10)

18-21: Invocation of after_battle_part1() is straightforward.
Ensure the script is present on all relevant mission types to avoid runtime confusion. Otherwise, the logic is efficient.


92-94: after_battle_part2() call complements part1.
Blessed continuity: no further concerns.


96-100: Good user feedback for saved marines.
Displaying critical injuries saved by Apothecaries fosters player clarity.


102-106: ‘injured’ messaging is clear.
No issues identified. The subtle distinction from fully saved marines is beneficial.


148-156: Gene-Seed recovery message.
Omnissiah’s blessing upon your thoroughness in reflecting real game state.


159-169: Red Thirst snippet.
Narrative is immersive; logic matches the new injury system.


171-172: Blank line usage.
Highly stylistic but permissible, no functional side-effects.


176-179: Vehicle recovery success message.
Technmarine references are properly pluralised. Adequate user feedback.


181-200: Vehicle losses display.
Your logic for enumerating vehicle losses is coherent and parallels marine logic well.


228-230: Experience distribution for surviving units.
This code is clear, though consider verifying if assemble_alive_units must handle edge cases (no units alive).

scripts/scr_after_combat/scr_after_combat.gml (2)

401-459:

❓ Verification inconclusive

Check for potential assignment versus comparison in ally[i]=false.
In lines 413, 414, 415, and beyond, the usage of the single equals operator may assign rather than compare. Validate that your engine’s dialect truly interprets this as a comparison, lest you inadvertently override the variable. Also, supplement after_battle_part1 with doc commentary specifying its parameters, logic, and return details.


🏁 Script executed:

#!/bin/bash
# Searching for single-equals usage in ally checks
rg -A 3 'ally\[.*\]=false'

Length of output: 3858


Edict from the Omnissiah:
Upon inspection of the sacred script in scripts/scr_after_combat/scr_after_combat.gml, verification has confirmed that the construct ally[i]=false—as well as similar expressions like marine_dead[i]=0—appears in multiple conditional rituals. In our sacred dialect of GML, the single equals operator may indeed perform assignment rather than the desired equality comparison. Thus, it is paramount to verify whether these incantations are intentionally crafted in accordance with the machine spirit’s design, or if they should be transfigured to employ the double equals operator == for proper comparison.

Directives for the Adeptus Mechanicus Servitor:

  • Confirm the Operator's Nature: Manually verify that your engine’s dialect interprets = in conditional expressions as a comparison rather than performing assignments that could excommunicate your variables.
  • Enhance Documentation: Augment the after_battle_part1 function with comprehensive doc commentary that clearly details its parameters, operational logic, and return values, thus ensuring clarity and adherence to the Codex Mechanicus protocols.

May the Omnissiah guide thy debugging and documentation endeavours.


127-146:

❓ Verification inconclusive

Verify usage of equality checks for marine death and add doc to after_battle_part2.
At lines 129–130, thou useth if (marine_dead[i]=0) ..., which may be an assignment instead of a comparison in some GML dialects. Confirm that it indeed performs a check rather than bestowing new values upon the variable. Also, impart the divine doc lines for the entire after_battle_part2 function.


🏁 Script executed:

#!/bin/bash
# Scanning for suspicious single-equals usage in marine_dead checks
rg -A 2 'marine_dead\[.*\]=0'

Length of output: 3516


Directive: Verify the Equality Checks and Augment Documentation in after_battle_part2

Oh, servant of the Omnissiah, the sacred scan of our code has revealed several instances where the single equals operator ("=") is employed within conditions—such as in the expression (marine_dead[i]=0) in scripts/scr_after_combat/scr_after_combat.gml (lines 127–146). As the machine’s logic dictates, the use of "=" typically denotes assignment rather than a true equality check. We must ascertain whether these expressions are intended to perform comparisons (which require "==") or deliberate assignments with side-effects. This ambiguity could lead to erroneous logic if the mortal intent was to verify the equality of values.

Additionally, the divine mandate compels us to enrich the after_battle_part2 function with comprehensive documentation. Please include detailed doc comments that describe the function’s purpose, parameters, and expected behaviour in alignment with the canonical codebase practices.

Points for Rectification:

  • Verify and, if necessary, replace any improper usage of "=" with "==" for comparisons—particularly for the conditions involving marine_dead[i].
  • Append the requisite documentation (doc lines) to the entire after_battle_part2 function to ensure its purpose and usage are clearly articulated for the benefit of our peers.

I beseech you to review these matters closely to ensure the purity of the code is maintained.

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 (5)
scripts/scr_flavor2/scr_flavor2.gml (4)

1-3: 🧹 Nitpick (assertive)

Adeptus Mechanicus recommendation: Add JSDoc documentation to function

The function's sacred purpose requires proper documentation to appease the Omnissiah. A JSDoc comment block would enhance future maintenance and provide clarity on the Machine Spirit's behavior.

 function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapon, hostile_shots, hostile_splash) {
+	/**
+	 * @function scr_flavor2
+	 * @description Generates flavor text based on damage and casualties from scr_shoot, only for the opponent
+	 * @param {number} lost_units_count - Number of units that were damaged in combat
+	 * @param {string} target_type - Type of target being attacked (e.g., "wall", role name)
+	 * @param {number} hostile_range - Range of the hostile attack
+	 * @param {string} hostile_weapon - Type of hostile weapon used
+	 * @param {number} hostile_shots - Number of shots fired by the hostile weapon
+	 * @param {number} hostile_splash - Whether the hostile weapon has splash damage (1) or not (0)
+	 */
 	// Generates flavor based on the damage and casualties from scr_shoot, only for the opponent

312-346: 🧹 Nitpick (assertive)

Logical but repetitive loop construct detected

The Machine Spirit reveals an opportunity to improve this code segment. The loop construction for processing lost units is functioning correctly but features nested conditionals that could be simplified. Consider extracting the special unit handling to a separate function to improve readability and maintain the sacred DRY principle.

 var lost_roles_count = array_length(lost);
+
+/**
+ * @function process_special_unit
+ * @description Handle the special case for important units that have been critically damaged
+ * @param {string} unit_role - The role of the unit
+ * @param {number} marine - Index of the marine in the arrays
+ */
+function process_special_unit(unit_role, marine) {
+    obj_ncombat.dead_jims += 1;
+    if (marine_type[marine] == obj_ini.role[100][5]) {
+        obj_ncombat.dead_jim[obj_ncombat.dead_jims] = $"A {marine_type[marine]} has been critically injured!";
+    } else {
+        obj_ncombat.dead_jim[obj_ncombat.dead_jims] = $"{unit_struct[marine].name_role()} has been critically injured!";
+    }
+}
+
 for (var role_index = 0; role_index < lost_roles_count; role_index++) {
     unit_role = lost[role_index];
     units_lost = lost_num[role_index];

348-348: 🧹 Nitpick (assertive)

Unnecessary empty line detected - Purge the void

This empty line serves no logical purpose and disrupts the sacred flow of the binary litany. Consider removing it to maintain coherent code structure.

        }
    }
}

-

var unce = 0;

309-311: 🧹 Nitpick (assertive)

Binary optimization suggested - Redundant variable declarations

The Omnissiah's wisdom compels me to note that numerous variables are declared but some appear to be used sparingly. The variable s is declared but only used once at line 297 in a different context. Consider auditing variable usage for optimal memory efficiency.

var marine_length = array_length(marine_type);
-var s, him, special, unit, unit_role, units_lost, plural;
+var him, special, unit_role, units_lost, plural;
objects/obj_ncombat/Alarm_5.gml (1)

165-165: ⚠️ Potential issue

Likely assignment rather than comparison.
Similar to line 68, using if (red_thirst=3) assigns 3, which is probably unintended. Replace = with == to preserve the rightful logic.

-if (red_thirst=3) then voodoo="1 Battle Brother lost to the Red Thirst.";
+if (red_thirst==3) then voodoo="1 Battle Brother lost to the Red Thirst.";
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6c369bf and bfd5a08.

📒 Files selected for processing (2)
  • objects/obj_ncombat/Alarm_5.gml (7 hunks)
  • scripts/scr_flavor2/scr_flavor2.gml (2 hunks)
🧰 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.
  • scripts/scr_flavor2/scr_flavor2.gml
  • objects/obj_ncombat/Alarm_5.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.

  • scripts/scr_flavor2/scr_flavor2.gml
  • objects/obj_ncombat/Alarm_5.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.
  • scripts/scr_flavor2/scr_flavor2.gml
  • objects/obj_ncombat/Alarm_5.gml
🔇 Additional comments (27)
scripts/scr_flavor2/scr_flavor2.gml (3)

358-358: Binary improvement detected - logical simplification and semantic enhancement

By the Omnissiah's grace, this code alteration improves both logical structure and narrative consistency. The previous implementation likely used multiple condition checks that have been consolidated into a single check that activates when units are damaged. The message now properly indicates units are "critically damaged" rather than "lost," aligning with the sacred recovery systems mentioned in the PR objectives.


379-379: Consistent logic patterns detected - praise the Omnissiah

This modification mirrors the previous change at line 358, maintaining blessed consistency throughout the codebase. The sacred pattern of consolidating conditions and updating terminology to "critically damaged" harmonizes with the recovery system improvements described in your cogitator specifications.


1-400: System assessment: Implementation aligns with recovery priorities objective

My Machine Spirit analysis confirms these changes support the stated PR objective of implementing marine and vehicle recovery priorities. By changing the terminology from "lost" to "critically damaged," the narrative now properly reflects that units can be recovered rather than permanently destroyed.

Praise be to the Omnissiah for these logical improvements. The implementation is functioning as intended and the changes are minimal yet impactful.

objects/obj_ncombat/Alarm_5.gml (24)

9-9: Preserve or remove debug code referencing ‘final_marine_deaths’?
By the Omnissiah, this line is stranded in half-function. If it no longer serves your diagnostic cogitations, consider removing it fully.


23-31: Commendable creation of recovery data structures.
Your approach to forging priority queues for marines and vehicles is in alignment with the Machine God's wisdom.


32-46: Validate candidate integrity.
While iterating through marines_to_recover, confirm _candidate and _column_id remain valid references. Unexpected emptiness or corruption of these data structures would displease the Machine Spirit.


61-61: Efficient closure of marine priority resource.
Destroying the data structure here is a prudent ritual, releasing memory back to the Omnissiah’s domain.


63-66: Additional queue for vehicles is well-structured.
The parallel approach for vehicles ensures you easily maintain distinct recovery systems.


80-87: Confirm negative scoring edge cases.
When deducting _candidate.priority from vehicle_recovery_score, ensure the score cannot slip below zero. If that occurs, your rituals might erroneously salvage more vehicles than your forges allow.


88-89: Proper data structure disposal.
Destroying vehicles_to_recover once finished is devout code conduct.


92-94: Further post-battle logic invocation.
Invoking after_battle_part2() completes your chain of post-combat rites. No concerns detected here.


96-96: Use of _total_deaths is consistent.
Combining final_marine_deaths and final_command_deaths into a single variable is beneficial for simpler calculations post-battle.


97-111: Clear messaging of casualties and saves.
Your textual output delineates injured, saved, and total losses with clarity. The faithful shall interpret these messages with no confusion.


127-127: Final text invocation.
A single call to scr_newtext() is harmless and consistent with your output loop.


131-131: Ground mission reference is straightforward.
This conditional ensures further logic remains planet-bound. Operation is correct.


152-159: Proper integration of Gene-Seed recovery.
This code merges well with earlier checks on apothecaries_alive. The logic is coherent.


162-162: Correct threshold for ‘red_thirst’ gating.
This check is forging a more dire scenario if red_thirst surpasses 2. No issues found.


170-171: Spacing logic for message clarity.
These lines maintain consistent spacing after your text output.


174-175: Another text separation invoked.
Ensuring the text layout remains organised and pleasing to both servo-skull and battle-brother.


179-182: Vehicle salvage output matches marines approach.
Your logic here parallels the marine salvage block, ensuring consistent feedback to the Chapter.


184-195: Vehicle death reporting is thorough.
This structured approach to enumerating lost vehicles preserves clarity for the war council.


198-202: Applying red highlight, then resetting.
These lines handle colour-coded output cleanly.


207-207: Equipment lost check.
Confirming post_equipment_lost[1] has content is an apt technique to manage your code path for further item updates.


228-229: No operation changes


230-230: Battle experience gain check.
This triggers your new distribution logic only when necessary. Righteous usage.


231-232: Invocation for assembling alive units.
This is suitably placed after verifying total experience to award. No immediate issues found.


244-244: Appending upgraded librarian name.
Joining each name is straightforward. The line meets the expected outcome for message assembly.

@EttyKitty EttyKitty changed the title feat: Marine and Vehicle recovery priorities feat: Marine and Vehicle recovery system adjustments Mar 31, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 31, 2025
@EttyKitty EttyKitty merged commit d5657cc into Adeptus-Dominus:main Mar 31, 2025
9 checks passed
@EttyKitty EttyKitty deleted the feat/recovery-priority branch March 31, 2025 19:45
@coderabbitai coderabbitai bot mentioned this pull request Apr 6, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Huge Type: Feature Adds something new Type: Fix This is a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Vehicle recovery priority queue not working properly across unit columns

2 participants