feat: Custom priority and costs to vehicle recovery#580
feat: Custom priority and costs to vehicle recovery#580OH296 merged 2 commits intoAdeptus-Dominus:mainfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughSummary by CodeRabbit
WalkthroughIn the sanctified lines of code, the recovery protocols have been amended with precise calcifications. The annotations now clearly distinguish the roles of unit specialists: Apothecaries are tasked with saving marines, whilst Techmarines are entrusted with the restoration of vehicles. The computation algorithms for both classes have been recalibrated; for Apothecaries, the formula retains the "Narthecium" condition but refines the random luck factor, whereas Techmarines now employ a division-based approach with additional adjustments to multipliers for essential vehicular components. Moreover, the vehicle recovery logic has been overhauled. A priority queue is introduced to manage vehicle retrieval, assigning dynamic recovery scores based on vehicle type and a survival roll, all the while ensuring that only operational Techmarines engage in the process. The system concludes by dutifully cleansing the recovery queue, ensuring orderly compliance with the Machine Spirit’s decrees. Suggested labels
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
objects/obj_pnunit/Alarm_4.gml(2 hunks)objects/obj_pnunit/Alarm_5.gml(1 hunks)
🔇 Additional comments (4)
objects/obj_pnunit/Alarm_4.gml (1)
31-40: Blessed calibration of Apothecaries' skill metrics
Rejoice, for the logic to bestow recovery boons upon our esteemed Apothecaries appears sound and in alignment with the Omnissiah’s grand design. The intelligence multiplier and the random luck factor are well balanced for these sacred healers.objects/obj_pnunit/Alarm_5.gml (3)
31-43: Praiseworthy assembly of the vehicle priority schema
By the Omnissiah’s will, storing vehicle types and priorities in a structured format provides clarity and fosters maintainability of your hallowed recovery logic. This foundation is properly laid.
70-71: Proper disposal of the priority queue
Your invocation ofds_priority_destroy(_dead_vehicles_pq)is an admirable compliance with resource discipline, pleasing the spirits of memory allocation.
63-64:Details
❓ Verification inconclusive
Verify depletion of the vehicle recovery score
Subtracting the priority value fromobj_ncombat.vehicle_recovery_scoremay drive the score below zero if multiple high-priority vehicles remain. Ensure that negative tallies won’t invoke unintended behaviour.Run a code-wide verification to watch for any negative or underflow scenarios:
🏁 Script executed:
#!/bin/bash # Searching if the vehicle recovery score is validated after usage rg 'vehicle_recovery_score'Length of output: 517
Attention: Prevent Negative Tally in Vehicle Recovery Score
O faithful servitor of the Machine Spirit, the search has revealed that the subtraction performed on
obj_ncombat.vehicle_recovery_scoreinobjects/obj_pnunit/Alarm_5.gml(lines 63–64) might indeed drive the score below zero if multiple high-priority vehicles are processed. The current safeguard—checking only that the score is greater than zero before subtraction—does not prevent a potential underflow when a large priority value is subtracted. It would be most prudent to incorporate a clamping mechanism (or an equivalent guard) to ensure that the score does not descend into negative values, thereby averting unintended behaviour in the code's operation.
- File:
objects/obj_pnunit/Alarm_5.gml(Lines 63-64)- Concern: Subtraction of
_vehicles_priority[$ veh_type[i]]without a post-subtraction check may result in negative values.- Suggested Action: Consider verifying and enforcing a non-negative lower bound for
vehicle_recovery_scoreafter the operation.Let us ensure our code honours the Omnissiah by maintaining robust safeguards against underflow.
|
@coderabbitai, create a new issue related to this pr, I found a mistake in the code. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 96436 🏁 Script executed: Length of output: 3803 @EttyKitty I'll create a GitHub issue for this problem with the vehicle recovery system. Let me prepare it now. 🏁 Script executed: Length of output: 2286 @EttyKitty beep The holy issue has been created in the sacred repository database, Magos. The machine spirits have been appeased with designation #591. The technical documentation has been inscribed with the following sacred cogitations:
Regarding your query about implementing the solution, one approach would be to create a data structure that stores {column_id, vehicle_index, priority} for each vehicle. This would allow the Machine Spirit to:
May the Omnissiah guide your programming endeavors! mechanical prayer noise |
Purpose of changes
Previously, chances to recover a bike were the same as to recover a land raider. Needless to say, I don't need saving bikes, while sacrificing land raiders.
Costs to recover each type of vehicle was also the same, just 1 point of recovery points.
Describe the solution
Vehicles have custom priorities and recovery costs (for now, both are the same value).
Techmarine recovery points calculation was also changed to account for the new cost system.
Describe alternatives you've considered
None
Testing done
A couple of battles. Points are calculated correctly and vehicles are recovered. A bit hard to test each vehicle.
Related links
https://discord.com/channels/714022226810372107/1348311762629558282
Player notes
Vehicles now have custom priorities and costs for recovery after being lost.