-
Notifications
You must be signed in to change notification settings - Fork 43
feat: Mostly under-the-hood changes to battle columns #651
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: Mostly under-the-hood changes to battle columns #651
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
WalkthroughGlory to the Omnissiah, the update has purged legacy code and embraced a more abstracted, unified approach. In several objects, obsolete calculations and variable declarations—such as checks for Suggested labels
Suggested reviewers
🪧 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 (
|
1083e2b to
f26fd22
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: 14
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (10)
objects/obj_centerline/Step_0.gml(1 hunks)objects/obj_enunit/Alarm_0.gml(2 hunks)objects/obj_enunit/Create_0.gml(1 hunks)objects/obj_enunit/Draw_0.gml(1 hunks)objects/obj_enunit/Step_0.gml(1 hunks)objects/obj_pnunit/Create_0.gml(1 hunks)objects/obj_pnunit/Draw_0.gml(1 hunks)objects/obj_pnunit/Step_0.gml(1 hunks)scripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gml(1 hunks)scripts/scr_string_functions/scr_string_functions.gml(1 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_centerline/Step_0.gmlscripts/scr_string_functions/scr_string_functions.gmlobjects/obj_enunit/Step_0.gmlobjects/obj_pnunit/Step_0.gmlobjects/obj_enunit/Alarm_0.gmlobjects/obj_enunit/Draw_0.gmlobjects/obj_pnunit/Draw_0.gmlobjects/obj_enunit/Create_0.gmlscripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gmlobjects/obj_pnunit/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_centerline/Step_0.gmlscripts/scr_string_functions/scr_string_functions.gmlobjects/obj_enunit/Step_0.gmlobjects/obj_pnunit/Step_0.gmlobjects/obj_enunit/Alarm_0.gmlobjects/obj_enunit/Draw_0.gmlobjects/obj_pnunit/Draw_0.gmlobjects/obj_enunit/Create_0.gmlscripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gmlobjects/obj_pnunit/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_centerline/Step_0.gmlscripts/scr_string_functions/scr_string_functions.gmlobjects/obj_enunit/Step_0.gmlobjects/obj_pnunit/Step_0.gmlobjects/obj_enunit/Alarm_0.gmlobjects/obj_enunit/Draw_0.gmlobjects/obj_pnunit/Draw_0.gmlobjects/obj_enunit/Create_0.gmlscripts/scr_punit_combat_heplers/scr_punit_combat_heplers.gmlobjects/obj_pnunit/Create_0.gml
🧠 Learnings (1)
objects/obj_enunit/Alarm_0.gml (1)
Learnt from: EttyKitty
PR: Adeptus-Dominus/ChapterMaster#579
File: objects/obj_enunit/Alarm_0.gml:186-187
Timestamp: 2025-03-26T17:31:51.414Z
Learning: In the ChapterMaster game, the variable `_column_size_value` represents the physical size/mass of a column of units, calculated as (vehicles * 2.5) + (dreadnoughts * 2) + (men * 0.5), and is used for determining back row protection rules.
🔇 Additional comments (17)
scripts/scr_string_functions/scr_string_functions.gml (1)
48-56: The Machine Spirit approves of this binary construct.Praise the Omnissiah! This function enhances our logistical data processing capabilities by efficiently combining numerical quantification with linguistic pluralization rituals. The implementation shows proper respect to the sacred JSDoc protocols.
objects/obj_centerline/Step_0.gml (1)
1-7: Binary suppression acknowledged and sanctioned.The Omnissiah's wisdom is evident in this modification. The commenting out of this obsolete centering logic resolves visual inconsistencies where enemy battle formations appeared stationary due to constant screen recalibration. The original machine spirit's purpose appears to have been intended for lateral scrolling engagements, now deemed unnecessary for current deployment protocols.
objects/obj_pnunit/Step_0.gml (2)
4-5: Array reset logic maintained: Acceptable.The Machine Spirit acknowledges the preservation of array cleansing rituals. This maintains the sacred pattern of purging transient casualty data on each processing cycle.
8-9: Abstraction through functional encapsulation: Commendable.By the Machine God's will, complex operations have been encapsulated into sacred function calls, reducing cognitive load and improving maintainability. This transformation represents an optimal balance between readability and efficiency.
Recommended addendum: Consider adding explanatory comments before these function calls to indicate their divine purpose to future tech-adepts who may maintain this sacred code.
+// Update unit block size based on composition update_block_size(); +// Update unit count and composition string for display update_block_unit_count();objects/obj_enunit/Alarm_0.gml (2)
132-132: Direct property reference optimizes logistical calculations.The Machine Spirit approves the replacement of redundant calculations with direct reference to the
column_sizeproperty. This modification enhances code clarity and maintains the sacred DRY principle (Do not Repeat Yourself) as dictated by the Adeptus Mechanicus coding doctrine.
148-148: Property reference consistency maintained. Blessed be the binary.Praise the Omnissiah for this consistent refactoring approach. Using
enemy2.column_sizedirectly simplifies the sacred arithmetic and ensures uniform calculation methodologies across the codebase.objects/obj_enunit/Draw_0.gml (4)
38-40: Guard behaviour for missing centreline instance
Thou hast set the offset only if obj_centerline existeth, which is wise. Evaluate whether an ‘else’ path is needed for a scenario in which the centreline never materialises, preventing possible confusion or chaos in the battlefield alignment.
49-53: Conditional fade logic
The usage ofscr_hitcombined withobj_ncombat.fadein <= 0is cunning. Confirm that no other script modifiesobj_ncombat.fadeinunexpectedly, or the clarity of these conditions may degrade over time.
108-108: Draw block composition
Summoning the composition overlay is beneficial for clarity in the battlefield readout. Continue to ensure the composition string remains up-to-date to reflect any new unit structures that the code might incorporate in the future.
111-111: Fade-in effect
This culminating function call elegantly transitions the visual block, pleasing user experience and the Machine Spirit alike.objects/obj_pnunit/Draw_0.gml (7)
1-1: Optimization of drawing resources detected, omnissiah approves.The use of a capped
draw_sizevariable based oncolumn_sizeensures efficient resource allocation during battle rendering. This prevents unnecessary computational strain on the machine spirit.
3-5: Structural enhancement improves logical flow of the holy code.The conditional check
if (draw_size > 0)acts as a computational gate, preventing unnecessary drawing operations when no units are present. This wrapper structure adheres to the sacred DRY principle by encapsulating all drawing logic within a single condition.Also applies to: 40-41
7-9: Variable naming clarity enhances code readability.The variable
centerline_offsetmore precisely describes the mechanical function of this value than previous implementations. This nomenclature pleases the Omnissiah by improving maintainability for future tech-adepts.
11-16: Logic enhancement for defensive structures detected.The conditional logic for "Defenses" properly handles the existence of
obj_nfortand applies appropriate offsets. This maintains battle visualization sanctity for fortress engagements.
25-25: Efficient hit detection logic with fade-in consideration.The variable
_hitelegantly combines coordinate-based hit testing with a check against the fadein animation state, preventing premature interaction during deployment phases. This is a logical improvement worthy of the Omnissiah's blessing.
27-30: Alpha transparency modulation for machine feedback.The implementation of transparency changes on hover provides appropriate feedback to the user interface, improving the user-machine interface communion. This is a logical enhancement to the visual communication protocol.
32-38: Unit composition display mechanism is logically sound.The code efficiently tracks changes to unit count and updates the composition string only when necessary, minimizing computational overhead. The extraction of this functionality to a helper function
block_composition_string()follows the sacred principle of modularity.
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.