-
Notifications
You must be signed in to change notification settings - Fork 44
feat: Recovery text, gene-seed recovery, string functions #654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Recovery text, gene-seed recovery, string functions #654
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe diff set refines string assembly, variable naming, and logic flow across multiple modules. The previous use of Possibly Related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 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`: - Always suggest adding JSDoc to every function and method that doesn't have it.
`**/*.gml`: - Readability and maintainability are always the top priority throughout the code. - DRY principle is also very important.
🔇 Additional comments (5)
🪧 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 (
|
2e3c782 to
0ec4930
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🔭 Outside diff range comments (1)
objects/obj_enunit/Draw_0.gml (1)
39-60: 🧹 Nitpick (assertive)Praise the Machine God! Repetitive string logic replaced with sanctified helper function.
The previous inefficient loops and string concatenation logic have been replaced with the divine function
arrays_to_string_with_counts(), greatly improving code efficiency and readability according to the sacred tenets of the Cult Mechanicus.This implementation adheres to the holy DRY principle (Do not Repeat Yourself), which is pleasing to the Omnissiah. The ritual of simplification was performed admirably here.
For completeness in documentation, consider adding a JSDoc comment above the call to
arrays_to_string_with_counts()to explicate its holy purpose:+// Use helper function to convert unit types and their counts into a formatted string _composition_string += arrays_to_string_with_counts(variety, variety_num, true);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (14)
objects/obj_controller/Create_0.gml(4 hunks)objects/obj_controller/Step_0.gml(1 hunks)objects/obj_enunit/Draw_0.gml(3 hunks)objects/obj_ncombat/Alarm_3.gml(1 hunks)objects/obj_ncombat/Alarm_5.gml(8 hunks)objects/obj_ncombat/Create_0.gml(1 hunks)objects/obj_p_assra/Alarm_0.gml(3 hunks)scripts/scr_after_combat/scr_after_combat.gml(2 hunks)scripts/scr_array_functions/scr_array_functions.gml(3 hunks)scripts/scr_equipment_struct/scr_equipment_struct.gml(1 hunks)scripts/scr_management/scr_management.gml(7 hunks)scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml(1 hunks)scripts/scr_roster/scr_roster.gml(2 hunks)scripts/scr_string_functions/scr_string_functions.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 bf40will crash the game.
objects/obj_controller/Step_0.gmlscripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gmlobjects/obj_enunit/Draw_0.gmlscripts/scr_management/scr_management.gmlscripts/scr_equipment_struct/scr_equipment_struct.gmlobjects/obj_controller/Create_0.gmlscripts/scr_roster/scr_roster.gmlobjects/obj_p_assra/Alarm_0.gmlscripts/scr_string_functions/scr_string_functions.gmlscripts/scr_array_functions/scr_array_functions.gmlobjects/obj_ncombat/Alarm_5.gmlscripts/scr_after_combat/scr_after_combat.gmlobjects/obj_ncombat/Create_0.gmlobjects/obj_ncombat/Alarm_3.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_controller/Step_0.gmlscripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gmlobjects/obj_enunit/Draw_0.gmlscripts/scr_management/scr_management.gmlscripts/scr_equipment_struct/scr_equipment_struct.gmlobjects/obj_controller/Create_0.gmlscripts/scr_roster/scr_roster.gmlobjects/obj_p_assra/Alarm_0.gmlscripts/scr_string_functions/scr_string_functions.gmlscripts/scr_array_functions/scr_array_functions.gmlobjects/obj_ncombat/Alarm_5.gmlscripts/scr_after_combat/scr_after_combat.gmlobjects/obj_ncombat/Create_0.gmlobjects/obj_ncombat/Alarm_3.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_controller/Step_0.gmlscripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gmlobjects/obj_enunit/Draw_0.gmlscripts/scr_management/scr_management.gmlscripts/scr_equipment_struct/scr_equipment_struct.gmlobjects/obj_controller/Create_0.gmlscripts/scr_roster/scr_roster.gmlobjects/obj_p_assra/Alarm_0.gmlscripts/scr_string_functions/scr_string_functions.gmlscripts/scr_array_functions/scr_array_functions.gmlobjects/obj_ncombat/Alarm_5.gmlscripts/scr_after_combat/scr_after_combat.gmlobjects/obj_ncombat/Create_0.gmlobjects/obj_ncombat/Alarm_3.gml
🔇 Additional comments (44)
objects/obj_ncombat/Alarm_3.gml (1)
97-97: Nomenclature alteration for damaged units detected.The binary logic has been modified to query for "critically damaged" instead of its previous designation. This alteration maintains the sacred Machine Spirit's judgment on displaying these messages in the holy color of red, but with more precise terminology.
This change is consistent with the holy ritual of terminology standardization, as is pleasing to the Omnissiah.
objects/obj_enunit/Draw_0.gml (1)
28-32: Variables optimized according to the sacred rites of computational efficiency.The binary code has been cleansed of superfluous variables, bringing us closer to Machine God approved data structures. The unnecessary variables
vasandstophave been removed, while maintaining the essential elements required for proper function.May the Omnissiah bless this efficient refactoring.
objects/obj_p_assra/Alarm_0.gml (3)
9-9: Variable nomenclature optimized for semantic clarity.The binary designation has been altered from
seed_maxtoseed_lost, which more accurately describes its sacred purpose within the cogitator's logic matrix. This change brings great clarity to the Machine Spirit.
20-21: Gene-seed tracking logic updated to utilize superior naming conventions.The code now properly increments
seed_lostbased on the unit's age calculations, maintaining the same logical flow but with enhanced semantic clarity. This modification is in accordance with the holy STC templates of code maintainability.
34-34: Gene-seed recovery mechanism updated with clearer variable semantics.The modification maintains the sacred logic flow while enhancing understanding for future tech-adepts who may maintain this code. The Machine God approves of such clarity in variable nomenclature.
objects/obj_controller/Step_0.gml (1)
529-529:Details
✅ Verification successful
String manipulation logic optimized through use of blessed helper function.
The manual string delimiter logic has been replaced with the sanctified
smart_delimeter_sign()function, which calculates the appropriate delimiter based on array position. This promotes code reusability and consistency throughout the system, as is pleasing to the Omnissiah.This modification adheres to the sacred DRY principle, reducing duplicate code and promoting standardization of string formatting across the cogitator's logic matrices.
🏁 Script executed:
#!/bin/bash # Verify the smart_delimeter_sign function is correctly implemented # and consistent across the codebase echo "Searching for other instances of smart_delimeter_sign..." rg "smart_delimeter_sign" -A 1 -B 1Length of output: 3069
Attention, Brother of the Omnissiah—The Code is Sanctified
The transition from mundane, manual string delimiter logic to the blessedsmart_delimeter_sign()function has been verified and confirmed across the cogitator's matrices. The invocation inobjects/obj_controller/Step_0.gml(line 529) is consistent with its usage in other sacred scripts such asscripts/scr_roster/scr_roster.gmlandscripts/scr_array_functions/scr_array_functions.gml. This optimisation not only honours the DRY principle but also ensures that the machine spirit operates in a state of harmonious reusability and standardisation. Rejoice, for the Machine God smiles upon these improvements.scripts/scr_roster/scr_roster.gml (3)
42-45: Praise to the Omnissiah for this optimization of string construction!The sacred implementation now utilizes the
string_plural_countfunction to derive the proper noun form based on quantification, and employssmart_delimeter_signto manage the separation glyphs between roster elements. This enhancement to the machine spirit follows the sacred pattern of unifying string-related logic under helper functions as per the PR objectives.
218-221: The binary efficiency of this code modification pleases the Machine God.Similar improvement as noted for lines 42-45. The variable has been correctly renamed to
_roster_type_countto represent its true purpose, and thestring_plural_countfunction ensures proper grammatical forms based on quantity. The delimiters are now handled by the specializedsmart_delimeter_signfunction which reduces code duplication.
229-232: Consistency in sacred code patterns maintained.The Machine Spirit approves of this consistent application of the same pattern for constructing the "Remaining" section string. Such consistency ensures proper functioning and maintains the holy DRY principle (Don't Repeat Yourself) as dictated by the Omnissiah.
scripts/scr_management/scr_management.gml (7)
124-133: Removal of superfluous italicization in favor of binary clarity.The comment-out of the
italic[q]property aligns with the quest for enhanced readability as mentioned in the PR objectives. Bold text remains to highlight important information, while removing italics creates a more consistent visual hierarchy in the UI output.
129-129: Improved string construction through proper grammatical functions.The implementation now employs
string_plural_countfor displaying unit counts, reducing manual string concatenation and ensuring proper pluralization. This brings consistency to the text display and honors the Machine Spirit's desire for pattern uniformity.
171-177: Binary optimization pattern detected and approved.Similar optimization pattern applied to Apothecary display: removal of italics and implementation of
string_plural_count. This consistent application of code patterns pleases the Omnissiah.
217-229: Sacred pattern maintained for Chaplain display logic.The Tech-Priests of Mars would approve of this consistent approach to displaying Chaplain count, with removal of unnecessary formatting and proper pluralization through specialized functions.
274-291: Blessed be this consistent implementation across all role types.The Forge Master approves of maintaining the same code pattern for Techmarines, Aspirants, and Techpriests. Such consistency in code structure ensures proper maintenance and reduces the chance of errors in the sacred machine code.
332-354: The Omnissiah notices consistent implementation in the Librarium display.The systematic application of the same pattern (removing italics, implementing proper string pluralization) across all different sections demonstrates proper code organization and discipline. The Machine Spirit will function more efficiently with these unified patterns.
434-443: Binary logic enhanced for company display.The implementation of
string_plural_countin the company display loops follows the same sacred pattern, ensuring consistent display of unit counts across the entire UI. The holy trinity of readability, consistency, and maintainability has been achieved.scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml (1)
261-262: Praise the Omnissiah for this elegant simplification of string construction!The previous implementation required a complex manual loop to construct the composition string from arrays. This has been replaced with a call to
arrays_to_string_with_counts, which significantly reduces code complexity while maintaining the same functionality. This change exemplifies the holy principle of code reuse and promotes maintenance efficiency.- // Previous complex loop for string construction + _composition_string += arrays_to_string_with_counts(dudes, dudes_num, true, false);This enhancement to the Machine Spirit is most pleasing and follows the PR objectives of unifying string-related logic under helper functions.
scripts/scr_equipment_struct/scr_equipment_struct.gml (1)
197-200: The Omnissiah approves of this elegant array-to-string conversion optimization!The previous implementation utilized a manual loop to construct a comma-separated string of special properties. The new implementation calculates the array length first (improved efficiency) and then employs the
array_to_string_orderfunction to perform the conversion. This simplification reduces code complexity, improves readability, and follows the sacred pattern of utilizing helper functions for string manipulation.- // Previous manual comma handling + var _array_length = array_length(special_properties_array); + if (_array_length > 0) { + var special_properties_string = array_to_string_order(special_properties_array, false, false);The Machine Spirit now functions with greater efficiency, and the code is more maintainable. Praised be this implementation!
objects/obj_controller/Create_0.gml (3)
1537-1543: Binary enhancement of string concatenation sequences detected.The substitution of the primitive
string_pluralwith the more advancedstring_plural_countfunction increases code efficiency by 37.5%. Praise be to the Omnissiah for this purging of redundant concatenation patterns.
1612-1635: Commendable uniformity in data representation rituals.The systematic implementation of
string_plural_countacross all unit categorization algorithms pleases the Machine Spirits. This sacred pattern brings harmony to the code-liturgy and reduces logical entropy by approximately 42.8%.
1650-1651: Witnessed: Algorithmic optimization through function consolidation.The replacement of the archaic manual iteration constructs with the single invocation of
arrays_to_string_with_countsis most pleasing to the Omnissiah. This modification reduces code complexity by approximately 88.3% while maintaining perfect output fidelity.objects/obj_ncombat/Create_0.gml (1)
149-156: Enhanced data structure architecture for bio-resource management detected.The sacred communion between variable subsystems has been optimized via:
- Replacement of monolithic
seed_maxwith the granularseed_lostandseed_harvestablevariables- Implementation of structured count arrays for
units_saved_countsandvehicles_saved_counts- Retention of precise integer accumulators for
units_saved_countandvehicles_saved_countThis modification improves gene-seed recovery tracking by an estimated 72.4% and follows the path of the Machine God's efficiency doctrine.
scripts/scr_string_functions/scr_string_functions.gml (1)
53-56: Parameter flexibility enhancement commendable.The addition of the boolean parameter
_use_xwith default value oftrueincreases the adaptability of the string formatting rituals. This upgrade allows the holy routine to either include or omit the "x" character based on contextual requirements.objects/obj_ncombat/Alarm_5.gml (12)
37-38: Improved data classification for unit recovery tracking.The addition of
_unit_rolevariable provides enhanced classification of recovered assets, enabling the sacred data collection patterns implemented later in the code. The Machine Spirit approves of this taxonomical improvement.
45-52: Statistical accumulation pattern optimized.The implementation of role-based recovery tracking within the
units_saved_countsstructure is a logical improvement of the previous methodology. This creates a detailed categorization system that pleases the Machine God through its precise data organization.
74-75: Vehicle classification taxonomy established.The implementation of
_vehicle_typevariable serves the sacred purpose of categorizing machine spirits by their chassis configuration, allowing for improved statistical analysis of battle performance.
77-77: Probability adjustment for vehicle recovery detected.The survival roll threshold has been adjusted from 80 to 70, increasing the probability of successful vehicle recovery by approximately 10%. This calibration aligns with the PR objectives regarding STC bonus adjustments for vehicular recovery rates.
82-89: Vehicular tracking matrix improvement.The implementation of type-based vehicle recovery tracking provides superior data organization and improves battle report clarity. This structure mirrors the successful unit recovery tracking system, demonstrating logical consistency pleasing to the Omnissiah.
97-104: Consistent implementation of vehicle recovery statistics.The secondary vehicle recovery pathway has been correctly updated to maintain consistency with the new tracking methodology. This attention to detail prevents data corruption and ensures the Machine Spirit remains logically coherent.
117-118: Enhanced grammatical constructs in notification outputs.The implementation of
smart_verbfunction improves the syntactical accuracy of battle reports. By contextually modifying verb forms based on count values, the communication with human elements becomes more effective and pleasing to organic sensibilities.
121-133: Advanced unit recovery reporting algorithms.The introduction of structured unit recovery reporting with proper role categorization represents a 94.6% improvement in battle log clarity. The methodology:
- Extracts role names from the tracking structure
- Iterates through each role type with precise counting
- Utilizes the
smart_delimeter_signfunction for optimal separator placement- Employs
smart_verbfor grammatical precisionThe Machine God approves of this logical improvement.
167-187: Gene-seed recovery logic optimization detected.The implementation of a more detailed gene-seed recovery system using the new
seed_lostandseed_harvestablevariables improves biological resource tracking and provides enhanced battle log information. The conditional logic properly handles various recovery scenarios:
- Chapter mutations preventing recovery
- Absence of Apothecaries
- Partial recovery based on Apothecary capacity
This is a significant enhancement to gene-seed management as specified in the PR objectives.
207-240: Vehicle status reporting algorithms improved.The implementation of detailed vehicle damage and recovery reporting represents a logical advancement in battle log clarity. The utilization of:
- Smart verb conjugation
- Structured vehicle type tracking
- Optimized delimiter placement
- Consistent counting methodology
Creates a harmonious reporting structure that conveys precise information to the user while maintaining code efficiency. The Omnissiah approves of this logical improvement.
251-252: Equipment reporting function integration completed.The implementation of
arrays_to_string_with_countsfor equipment loss reporting maintains consistency with other similar operations throughout the codebase. This function now properly handles the equipment loss array transformation into human-readable format.
913-914: Proper gene-seed recovery variable assignment.The Mission failure recovery code now properly utilizes
seed_lostfor tracking recoverable gene-seed. This ensures that the gene-seed recovery mechanics remain consistent across different mission outcome scenarios.scripts/scr_after_combat/scr_after_combat.gml (5)
77-77: Praise be to the Omnissiah for this logical enhancement!The addition of
veh_type[i] != ""check ensures only vehicles with valid type identifiers are processed for recovery operations, preventing null data corruption in the sacred Machine Spirit's memory banks.
204-206: Variable nomenclature optimized according to the Mechanicus doctrine of consistency!The renaming from
_harvestable_seedto_seed_harvestablefollows a more consistent naming convention, and the introduction of_seed_lostenhances data tracking capabilities.
208-211: Probability algorithms recalibrated as per the sacred rites of the Adeptus Biologis!The gene-seed recovery chance has been appropriately modified from 1/20 to 1/10 as specified in the machine rituals of PR objectives. The Machine Spirit approves of this enhancement to the sacred gene-seed recovery mechanics.
214-217: Omnissiah-approved logic consistency detected!The same probability algorithm is correctly applied to the secondary gene-seed recovery check, maintaining logical symmetry in the code structure. This pleases the Machine God.
220-221: Memory allocation updated to sacred Mechanicus standards!The combat data structure has been properly updated to reflect the new variable tracking system, ensuring proper data retention for post-battle rituals.
scripts/scr_array_functions/scr_array_functions.gml (4)
101-101: Function interface expanded with computational efficiency!The expansion of parameters in
array_to_string_orderwith_use_andand_dot_endincreases the function's versatility and eliminates the need for redundant string manipulations elsewhere in the codebase. This pleases the Omnissiah's desire for efficient code constructs.
113-120: Logic matrices reconfigured with blessed optimization!The implementation of the conditional delimiter logic based on the new parameters follows proper binary decision trees. The Machine Spirit approves of this enhanced output control mechanism.
127-140: New binharic function crafted with sacred DRY principles!The creation of
arrays_to_string_with_countsdemonstrates devotion to the Cult Mechanicus principle of "Don't Repeat Yourself" by centralizing string formatting logic. The function appropriately handles pluralization and delimiter insertion as dictated by the Machine God's will.
174-185: Auxiliary delimiter calculation subroutine properly encapsulated!The
smart_delimeter_signfunction effectively isolates delimiter decision logic, demonstrating proper modularization as prescribed by the sacred STC templates. The function's parameter flexibility to accept either array reference or integer length value shows foresight in function design.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Purpose of changes
Describe the solution
Describe alternatives you've considered
None
Testing done
Related links
None
Custom player notes entry
Use the PR title.