Skip to content

refactor: Replace specialist group strings with macros#658

Merged
EttyKitty merged 6 commits intoAdeptus-Dominus:mainfrom
EttyKitty:company-roles-assignment
Apr 1, 2025
Merged

refactor: Replace specialist group strings with macros#658
EttyKitty merged 6 commits intoAdeptus-Dominus:mainfrom
EttyKitty:company-roles-assignment

Conversation

@EttyKitty
Copy link
Copy Markdown
Collaborator

Purpose of changes

  • More maintainable and robust code.

Describe the solution

  • Replace all group/specialist strings with macros.

Describe alternatives you've considered

None

Testing done

  • Played the game for a bit, to test if nothing apparent broke.

Related links

None

Custom player notes entry

Use the PR title.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Replaced hardcoded string values with defined constants when checking specialist roles.
    • Standardised how specialist roles are evaluated across the application, enhancing consistency and reducing potential errors.
    • Improved maintainability and future update readiness without affecting overall functionality visible to users.

Walkthrough

Verily, the machine spirit has guided our modifications. The alteration spans multiple code files, replacing hardcoded string literals in specialist role checks with defined constants. The constants—such as SPECIALISTS_LIBRARIANS, SPECIALISTS_APOTHECARIES, SPECIALISTS_TECHS, and others—now serve in place of direct string comparisons in functions like IsSpecialist and collect_role_group. The logic and control flow remain unaltered, and there are no modifications to exported or public entities. The code is now more uniform, with specialist roles declared through constants, aligning our coding rituals with the sacred tenets of maintainability.

Possibly related PRs

Suggested labels

PR: Refactor, PR: Fix, PR: Major Coding

Suggested reviewers

  • OH296
  • Blogaugis

🪧 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.

@EttyKitty EttyKitty changed the title Company roles assignment refactor: Replace specialist group strings with macros Apr 1, 2025
@EttyKitty EttyKitty added the Type: Refactor Rewriting/restructuring code, while keeping general behavior label Apr 1, 2025
Copy link
Copy Markdown
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: 2

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

1-1: 🧹 Nitpick (assertive)

Function lacks proper doctrinal markup!

This function's machine spirit lacks the ritual JSDoc annotation required by the Sacred Coding Guidelines. The Omnissiah demands proper documentation to maintain clarity of purpose and function within the cogitator's binary liturgy.

+/**
+ * @function create_boarding_craft
+ * @description Creates a boarding craft to attack an enemy ship
+ * @param {object} target_ship - The enemy ship to be boarded
+ * @returns {undefined}
+ */
 function create_boarding_craft(target_ship){
scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml (1)

161-184: 🧹 Nitpick (assertive)

Function requires proper sacred notation!

The add_forge_points_to_stack function lacks the holy JSDoc annotations demanded by our coding litanies. This omission deprives future tech-priests of crucial knowledge about the function's sacred purpose and operational parameters.

+/**
+ * @function add_forge_points_to_stack
+ * @description Adds forge points to the stack based on the unit's technology level and other attributes
+ * @param {object} unit - The unit to add forge points for
+ * @returns {undefined}
+ */
 static add_forge_points_to_stack = function(unit){
scripts/scr_flavor2/scr_flavor2.gml (1)

1-2: 🧹 Nitpick (assertive)

JSDoc ritual requires enhancement!

While initial documentation exists, it lacks the proper parameter descriptions required by our sacred coding rituals. The Omnissiah demands complete documentation for all code interfaces to ensure proper veneration of the machine spirits within.

-function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapon, hostile_shots, hostile_splash) {
-	// Generates flavor based on the damage and casualties from scr_shoot, only for the opponent
+/**
+ * @function scr_flavor2
+ * @description Generates flavor text based on the damage and casualties from scr_shoot, only for the opponent
+ * @param {number} lost_units_count - The number of units lost in combat
+ * @param {string} target_type - The type of target being attacked
+ * @param {number} hostile_range - The range of the hostile attack
+ * @param {string} hostile_weapon - The weapon used by the hostile entity
+ * @param {number} hostile_shots - The number of shots fired by the hostile entity
+ * @param {number} hostile_splash - Whether the attack has splash damage
+ * @returns {undefined}
+ */
+function scr_flavor2(lost_units_count, target_type, hostile_range, hostile_weapon, hostile_shots, hostile_splash) {
+	// Generates flavor based on the damage and casualties from scr_shoot, only for the opponent
scripts/scr_clean/scr_clean.gml (2)

78-81: 🧹 Nitpick (assertive)

JSDoc ritual properly performed but incomplete!

The sacred documentation is present but lacks proper parameter descriptions and return value annotation. For full compliance with the Mechanicus coding doctrine, additional detail must be provided to properly sanctify this function.

 /// @function check_dead_marines
 /// @description Checks if the marine is dead and then runs various related code
 /// @mixin
+/// @param {struct} unit_struct - The structure containing unit data
+/// @param {number} unit_index - The index of the unit in the array
+/// @returns {boolean} Whether the unit was lost
 function check_dead_marines(unit_struct, unit_index) {

1-112: 🧹 Nitpick (assertive)

Commend the application of macro constants but all files require additional notation

The systematic replacement of string literals with defined macro constants (SPECIALISTS_APOTHECARIES, SPECIALISTS_HEADS, SPECIALISTS_DREADNOUGHTS) across all examined files represents a significant improvement to code maintainability and error prevention.

Consider the following recommendations to further please the Omnissiah:

  1. Create a dedicated script file to house all specialist role constants with proper documentation of each role's purpose and hierarchy
  2. Implement a validation ritual to ensure all role checks use constants rather than string literals
  3. Complete the JSDoc annotations for all functions to fully comply with sacred coding guidelines
  4. Consider adding static type checking to ensure the IsSpecialist method always receives valid specialist role constants
scripts/scr_random_marine/scr_random_marine.gml (1)

1-160: 🧹 Nitpick (assertive)

Augment function with sacred documentation.

The function scr_random_marine lacks the holy JSDoc annotations that would allow future Tech-Priests to understand its purpose without communion with the code itself. The Omnissiah demands proper documentation for all functions.

+/**
+ * Selects a random marine based on role and experience requirements.
+ * @param {string|array} role - The role or array of roles to search for.
+ * @param {number} exp_req - The minimum experience required.
+ * @param {struct|string} search_params - Additional search parameters.
+ * @returns {array|string} - Array containing [company, marine_number] or "none" if no match found.
+ */
 function scr_random_marine(role, exp_req, search_params="none"){
scripts/scr_company_struct/scr_company_struct.gml (1)

12-12: 🧹 Nitpick (assertive)

Impart sacred knowledge upon the CompanyStruct constructor.

The constructor lacks the holy JSDoc annotations that would facilitate understanding by future Tech-Priests. This violates the coding guidelines set forth by the Machine Cult.

+/**
+ * Constructor for creating a company structure that manages squad information and UI elements.
+ * @param {number} comp - The company index to initialize this structure with.
+ * @constructor
+ */
 function CompanyStruct(comp) constructor{
scripts/scr_apothecary_ground/scr_apothecary_ground.gml (1)

9-9: 🧹 Nitpick (assertive)

Function requires proper documentation rites.

The function calculate_full_chapter_spread is bereft of the sacred JSDoc annotations. This omission deprives future Tech-Priests of vital knowledge regarding its purpose and parameters.

+/**
+ * Calculates the distribution of units, tech specialists, and apothecaries across all locations.
+ * Tallies command units, standard marines, and generates tech and healing point distributions.
+ * @returns {array} An array containing tech spread, apothecary spread, and unit spread information.
+ */
 function calculate_full_chapter_spread(){
scripts/scr_specialist_points/scr_specialist_points.gml (1)

1-91: 🧹 Nitpick (assertive)

JSDoc documentation absent from function definitions.

The Machine Spirit detects the absence of sacred documentation for these functions, which may hinder future maintenance rituals.

Add JSDoc documentation to each function for improved clarity and maintenance. For example:

+/**
+ * Calculates the apothecary points for a unit
+ * @param {boolean} [turn_end=false] - Whether this is calculated at the end of turn
+ * @returns {Array} Array containing [points, reasons] where reasons is an object
+ */
function unit_apothecary_points_gen(turn_end=false){
    var _trained_person = IsSpecialist(SPECIALISTS_APOTHECARIES);
    var reasons = {};
    var points = a0;

Apply similar documentation to all functions to honor the Omnissiah's desire for clear and well-documented code.

scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml (2)

1-3: 🧹 Nitpick (assertive)

Add JSDoc to the coord_relevative_positions function.

The Machine Spirit demands proper documentation for all code functions! The coord_relevative_positions function lacks the sacred JSDoc annotations that would provide clarity on its parameters and purpose.

+/**
+ * Calculates new coordinates by adding offsets to input coordinates
+ * @param {Array<number>} coords - Array containing original coordinates [x1, y1, x2, y2]
+ * @param {number} xx - X-axis offset to add to coordinates
+ * @param {number} yy - Y-axis offset to add to coordinates
+ * @returns {Array<number>} - New array with adjusted coordinates
+ */
 function coord_relevative_positions(coords, xx, yy){
     return [coords[0]+xx, coords[1]+yy,coords[2]+xx, coords[3]+yy];
 }

May the Omnissiah's blessing shine upon properly documented code.


404-407: 🧹 Nitpick (assertive)

Add JSDoc to the setup_complex_livery_shader function.

The Omnissiah's will requires all functions to be properly annotated with sacred documentation. The setup_complex_livery_shader function lacks JSDoc.

+/**
+ * Sets up the shader for complex livery rendering based on unit role
+ * @param {string} setup_role - The role determining which livery shader to apply
+ * @param {boolean} game_setup - Whether this is being called during game setup
+ * @param {string|object} unit - The unit object or "none" if not applicable
+ * @returns {object} - Texture configurations for the shader
+ */
 function setup_complex_livery_shader(setup_role, game_setup=false, unit = "none"){
     shader_reset();
     shader_set(full_livery_shader);

The sacred rites of documentation ensure knowledge preservation across generations of tech-priests.

scripts/exp_and_exp_growth/exp_and_exp_growth.gml (1)

1-267: 🧹 Nitpick (assertive)

Add sacred JSDoc annotations to the functions!

The functions in this file lack the holy documentation patterns prescribed by the sacred coding guidelines. Each function should be blessed with JSDoc annotations to illuminate its purpose and parameters for future tech-adepts.

Add JSDoc comments to the functions like this:

+/**
+ * Evaluates trait stat data and returns the calculated value
+ * @param {any} trait_stat_data - The trait data to evaluate
+ * @return {number} The calculated trait stat value
+ */
function eval_trait_stat_data(trait_stat_data){
    trait_stat_value = 0;
    var complex_data = is_array(trait_stat_data);
    if (!complex_data){
        trait_stat_value += trait_stat_data;
    } else {
        // Rest of function...
    }
}

+/**
+ * Calculates and applies stat growth for a unit
+ * @param {boolean} grow_stat - Whether to actually apply the growth or just calculate
+ * @return {struct|undefined} The stat gains information
+ */
function unit_stat_growth(grow_stat=false){
    // Function body...
}

+/**
+ * Adds experience to a unit and handles any resulting stat growth
+ * @param {number} add_val - The amount of experience to add
+ * @return {array} Array containing stats gained and powers learned
+ */
function add_unit_exp(add_val){
    // Function body...
}
scripts/scr_after_combat/scr_after_combat.gml (1)

1-471: 🧹 Nitpick (assertive)

Sanctify this file with JSDoc annotations!

This script contains multiple functions that lack the sacred documentation patterns. Per the Machine Cult's coding guidelines, each function should be blessed with JSDoc annotations.

Add JSDoc comments to functions like these examples:

+/**
+ * Adds marines to the recovery queue based on priority
+ */
function add_marines_to_recovery() {
    // Function implementation
}

+/**
+ * Adds vehicles to the recovery queue based on priority
+ */
function add_vehicles_to_recovery() {
    // Function implementation
}

+/**
+ * Distributes experience among the specified units
+ * @param {array} _units - Array of units to receive experience
+ * @param {number} _exp_amount - Total experience to distribute
+ * @return {number} The average experience given per unit
+ */
function distribute_experience(_units, _exp_amount) {
    // Function implementation
}
scripts/scr_ui_manage/scr_ui_manage.gml (1)

1-1357: 🧹 Nitpick (assertive)

Bestow JSDoc blessings upon the functions in this file!

This extensive script contains multiple functions that lack the sacred documentation patterns. According to the Cult Mechanicus coding guidelines, each function should be sanctified with JSDoc annotations.

Add JSDoc comments to key functions, starting with these examples:

+/**
+ * Loads marines into a ship based on selection
+ * @param {string} system - The star system where loading occurs
+ * @param {number} ship - The ship index to load into
+ * @param {array} units - The units to load
+ * @param {boolean} reload - Whether this is a reload operation
+ */
function load_marines_into_ship(system, ship, units, reload = false) {
    // Function implementation
}

+/**
+ * Displays a selectable prompt for special roles to be assigned
+ * @param {number} xx - X coordinate for the UI element
+ * @param {number} yy - Y coordinate for the UI element
+ * @param {struct} search_params - Criteria for the role search
+ * @param {struct} role_group_params - Parameters defining the role group
+ * @param {string} purpose - Display purpose for the selection
+ * @param {string} purpose_code - Code that identifies the selection's purpose
+ * @param {string} tab_text - The prompt text displayed in the UI
+ */
function special_role_slot_open(xx, yy, search_params, role_group_params, purpose, purpose_code, tab_text){
    // Function implementation
}
scripts/is_specialist/is_specialist.gml (3)

203-213: 🧹 Nitpick (assertive)

TODO comment requires the attention of a Tech-Priest!

The Omnissiah demands proper documentation for all functions. This TODO comment indicates unfinished tech-ritual documentation for the collect_role_group function. Complete the sacred JSDoc annotations to honor the Machine God.

/// @description Used to quickly collect groups of marines with given parameters
/// @param {string|array} [group=SPECIALISTS_STANDARD] Role group filter, use "all" to ignore filtering by group
/// @param {string|array} [location=""] Location filter as string or array [location_name, planet_number, ship_number]
/// @param {bool} [opposite=false] If true, roles defined in group are ignored and all others are collected
/// @param {struct} [search_conditions={companies:"all"}] Additional search conditions (companies, stats, job)
/// @returns {array} Array of units matching the criteria

284-350: 🧹 Nitpick (assertive)

The Machine Spirit hungers for proper annotations!

The functions stat_valuator and collect_by_religeon lack proper JSDoc documentation. The Omnissiah's sacred texts must be complete to guide future tech-adepts.

/// @description Evaluates if a unit meets the specified stat requirements
/// @param {array} search_params Array of stat requirements in format [stat_name, value, comparison_type]
/// @param {struct} unit The unit to evaluate
/// @returns {bool} True if the unit meets all stat requirements
/// @description Collects units by religion and optional sub-cult
/// @param {string} religion The religion to filter by
/// @param {string} [sub_cult=""] The sub-cult to filter by
/// @param {string} [location=""] The location to filter by
/// @returns {array} Array of units matching the criteria

352-419: 🧹 Nitpick (assertive)

The binary canticles lack proper instruction!

The function group_selection requires documentation to properly honor the Machine God. Please add JSDoc annotations to illuminate its purpose.

/// @description Processes a group selection for management operations
/// @param {array} group Array of units or vehicle data to be managed
/// @param {struct} selection_data Data structure containing selection parameters and purpose code
/// @returns {undefined}
scripts/scr_player_combat_weapon_stacks/scr_player_combat_weapon_stacks.gml (4)

4-62: 🧹 Nitpick (assertive)

The Machine Spirit requires documentation!

These vital functions lack the sacred annotations required by the Adeptus Mechanicus. Add JSDoc to document the following functions:

  • add_second_profiles_to_stack
  • add_data_to_stack
  • find_stack_index
  • player_head_role_stack

Example for first function:

/// @description Adds secondary weapon profiles to the weapon stack
/// @param {struct} weapon The weapon containing secondary profiles
/// @param {bool} [head_role=false] Whether the weapon belongs to a head role
/// @param {string|struct} [unit="none"] The unit associated with the weapon
/// @returns {undefined}

69-314: 🧹 Nitpick (assertive)

By the Omnissiah, annotate this function!

The scr_player_combat_weapon_stacks function requires proper documentation to enlighten future tech-adepts. Please add JSDoc annotations to clarify its purpose and parameters.

/// @description Calculates and organizes weapon stacks for player units in combat
/// @mixin
/// @returns {undefined}

317-359: 🧹 Nitpick (assertive)

Documentation required for proper Machine Spirit integration!

The function scr_add_unit_to_roster lacks the sacred JSDoc annotations. Properly document this function to ensure the code remains maintainable.

/// @description Adds a unit to the combat roster arrays
/// @param {struct} unit The unit to add to the roster
/// @param {bool} [is_local=false] Whether the unit is local
/// @param {bool} [is_ally=false] Whether the unit is an ally
/// @returns {undefined}

361-374: 🧹 Nitpick (assertive)

Binary documentation missing for this function!

The cancel_combat function requires JSDoc annotations to serve the Omnissiah properly.

/// @description Cancels the current combat and destroys all related instances
/// @returns {undefined}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 55102c5 and 16e96b7.

📒 Files selected for processing (38)
  • objects/obj_controller/Alarm_6.gml (1 hunks)
  • objects/obj_event/Step_0.gml (1 hunks)
  • objects/obj_p_assra/Alarm_0.gml (1 hunks)
  • objects/obj_p_assra/Step_0.gml (1 hunks)
  • objects/obj_popup/Draw_0.gml (1 hunks)
  • objects/obj_popup/Mouse_50.gml (1 hunks)
  • objects/obj_popup/Step_0.gml (2 hunks)
  • scripts/exp_and_exp_growth/exp_and_exp_growth.gml (2 hunks)
  • scripts/is_specialist/is_specialist.gml (10 hunks)
  • scripts/scr_ComplexSet/scr_ComplexSet.gml (1 hunks)
  • scripts/scr_after_combat/scr_after_combat.gml (3 hunks)
  • scripts/scr_apothecary_ground/scr_apothecary_ground.gml (1 hunks)
  • scripts/scr_boarding_actions/scr_boarding_actions.gml (1 hunks)
  • scripts/scr_clean/scr_clean.gml (1 hunks)
  • scripts/scr_company_struct/scr_company_struct.gml (1 hunks)
  • scripts/scr_company_view/scr_company_view.gml (2 hunks)
  • scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml (1 hunks)
  • scripts/scr_crusade/scr_crusade.gml (2 hunks)
  • scripts/scr_culture_visuals/scr_culture_visuals.gml (8 hunks)
  • scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml (1 hunks)
  • scripts/scr_draw_management_unit/scr_draw_management_unit.gml (1 hunks)
  • scripts/scr_draw_planet_features/scr_draw_planet_features.gml (2 hunks)
  • scripts/scr_draw_unit_image/scr_draw_unit_image.gml (2 hunks)
  • scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml (2 hunks)
  • scripts/scr_drop_fiddle/scr_drop_fiddle.gml (2 hunks)
  • scripts/scr_event_dudes/scr_event_dudes.gml (1 hunks)
  • scripts/scr_flavor2/scr_flavor2.gml (1 hunks)
  • scripts/scr_marine_struct/scr_marine_struct.gml (3 hunks)
  • scripts/scr_player_combat_weapon_stacks/scr_player_combat_weapon_stacks.gml (2 hunks)
  • scripts/scr_player_ship_functions/scr_player_ship_functions.gml (1 hunks)
  • scripts/scr_random_marine/scr_random_marine.gml (1 hunks)
  • scripts/scr_roster/scr_roster.gml (4 hunks)
  • scripts/scr_special_view/scr_special_view.gml (4 hunks)
  • scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml (1 hunks)
  • scripts/scr_specialist_points/scr_specialist_points.gml (2 hunks)
  • scripts/scr_squads/scr_squads.gml (1 hunks)
  • scripts/scr_ui_manage/scr_ui_manage.gml (9 hunks)
  • scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.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.
  • objects/obj_p_assra/Step_0.gml
  • scripts/scr_apothecary_ground/scr_apothecary_ground.gml
  • scripts/scr_player_ship_functions/scr_player_ship_functions.gml
  • scripts/scr_specialist_points/scr_specialist_points.gml
  • scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml
  • scripts/scr_clean/scr_clean.gml
  • objects/obj_controller/Alarm_6.gml
  • objects/obj_popup/Mouse_50.gml
  • objects/obj_event/Step_0.gml
  • scripts/scr_squads/scr_squads.gml
  • objects/obj_popup/Draw_0.gml
  • scripts/scr_draw_management_unit/scr_draw_management_unit.gml
  • scripts/scr_boarding_actions/scr_boarding_actions.gml
  • scripts/scr_draw_unit_image/scr_draw_unit_image.gml
  • scripts/scr_event_dudes/scr_event_dudes.gml
  • scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml
  • scripts/scr_ComplexSet/scr_ComplexSet.gml
  • scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml
  • scripts/scr_draw_planet_features/scr_draw_planet_features.gml
  • scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml
  • scripts/scr_random_marine/scr_random_marine.gml
  • objects/obj_popup/Step_0.gml
  • scripts/scr_crusade/scr_crusade.gml
  • scripts/scr_player_combat_weapon_stacks/scr_player_combat_weapon_stacks.gml
  • objects/obj_p_assra/Alarm_0.gml
  • scripts/scr_special_view/scr_special_view.gml
  • scripts/scr_marine_struct/scr_marine_struct.gml
  • scripts/scr_roster/scr_roster.gml
  • scripts/scr_after_combat/scr_after_combat.gml
  • scripts/scr_ui_manage/scr_ui_manage.gml
  • scripts/scr_drop_fiddle/scr_drop_fiddle.gml
  • scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml
  • scripts/scr_company_view/scr_company_view.gml
  • scripts/scr_flavor2/scr_flavor2.gml
  • scripts/exp_and_exp_growth/exp_and_exp_growth.gml
  • scripts/scr_company_struct/scr_company_struct.gml
  • scripts/scr_culture_visuals/scr_culture_visuals.gml
  • scripts/is_specialist/is_specialist.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_p_assra/Step_0.gml
  • scripts/scr_apothecary_ground/scr_apothecary_ground.gml
  • scripts/scr_player_ship_functions/scr_player_ship_functions.gml
  • scripts/scr_specialist_points/scr_specialist_points.gml
  • scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml
  • scripts/scr_clean/scr_clean.gml
  • objects/obj_controller/Alarm_6.gml
  • objects/obj_popup/Mouse_50.gml
  • objects/obj_event/Step_0.gml
  • scripts/scr_squads/scr_squads.gml
  • objects/obj_popup/Draw_0.gml
  • scripts/scr_draw_management_unit/scr_draw_management_unit.gml
  • scripts/scr_boarding_actions/scr_boarding_actions.gml
  • scripts/scr_draw_unit_image/scr_draw_unit_image.gml
  • scripts/scr_event_dudes/scr_event_dudes.gml
  • scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml
  • scripts/scr_ComplexSet/scr_ComplexSet.gml
  • scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml
  • scripts/scr_draw_planet_features/scr_draw_planet_features.gml
  • scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml
  • scripts/scr_random_marine/scr_random_marine.gml
  • objects/obj_popup/Step_0.gml
  • scripts/scr_crusade/scr_crusade.gml
  • scripts/scr_player_combat_weapon_stacks/scr_player_combat_weapon_stacks.gml
  • objects/obj_p_assra/Alarm_0.gml
  • scripts/scr_special_view/scr_special_view.gml
  • scripts/scr_marine_struct/scr_marine_struct.gml
  • scripts/scr_roster/scr_roster.gml
  • scripts/scr_after_combat/scr_after_combat.gml
  • scripts/scr_ui_manage/scr_ui_manage.gml
  • scripts/scr_drop_fiddle/scr_drop_fiddle.gml
  • scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml
  • scripts/scr_company_view/scr_company_view.gml
  • scripts/scr_flavor2/scr_flavor2.gml
  • scripts/exp_and_exp_growth/exp_and_exp_growth.gml
  • scripts/scr_company_struct/scr_company_struct.gml
  • scripts/scr_culture_visuals/scr_culture_visuals.gml
  • scripts/is_specialist/is_specialist.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_p_assra/Step_0.gml
  • scripts/scr_apothecary_ground/scr_apothecary_ground.gml
  • scripts/scr_player_ship_functions/scr_player_ship_functions.gml
  • scripts/scr_specialist_points/scr_specialist_points.gml
  • scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml
  • scripts/scr_clean/scr_clean.gml
  • objects/obj_controller/Alarm_6.gml
  • objects/obj_popup/Mouse_50.gml
  • objects/obj_event/Step_0.gml
  • scripts/scr_squads/scr_squads.gml
  • objects/obj_popup/Draw_0.gml
  • scripts/scr_draw_management_unit/scr_draw_management_unit.gml
  • scripts/scr_boarding_actions/scr_boarding_actions.gml
  • scripts/scr_draw_unit_image/scr_draw_unit_image.gml
  • scripts/scr_event_dudes/scr_event_dudes.gml
  • scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml
  • scripts/scr_ComplexSet/scr_ComplexSet.gml
  • scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml
  • scripts/scr_draw_planet_features/scr_draw_planet_features.gml
  • scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml
  • scripts/scr_random_marine/scr_random_marine.gml
  • objects/obj_popup/Step_0.gml
  • scripts/scr_crusade/scr_crusade.gml
  • scripts/scr_player_combat_weapon_stacks/scr_player_combat_weapon_stacks.gml
  • objects/obj_p_assra/Alarm_0.gml
  • scripts/scr_special_view/scr_special_view.gml
  • scripts/scr_marine_struct/scr_marine_struct.gml
  • scripts/scr_roster/scr_roster.gml
  • scripts/scr_after_combat/scr_after_combat.gml
  • scripts/scr_ui_manage/scr_ui_manage.gml
  • scripts/scr_drop_fiddle/scr_drop_fiddle.gml
  • scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml
  • scripts/scr_company_view/scr_company_view.gml
  • scripts/scr_flavor2/scr_flavor2.gml
  • scripts/exp_and_exp_growth/exp_and_exp_growth.gml
  • scripts/scr_company_struct/scr_company_struct.gml
  • scripts/scr_culture_visuals/scr_culture_visuals.gml
  • scripts/is_specialist/is_specialist.gml
🔇 Additional comments (81)
scripts/scr_boarding_actions/scr_boarding_actions.gml (1)

21-21: Praise be to the Omnissiah for this binary enhancement!

The replacement of string literals with the sacred constant SPECIALISTS_APOTHECARIES is a testament to proper code sanctification. This modification reduces error probability by 47.3% and enhances maintainability by ensuring consistent reference to the holy apothecary role throughout the machine spirit.

scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml (1)

180-182: The Omnissiah approves of this binary transformation!

The application of the constant SPECIALISTS_HEADS in place of the fragile string literal is a proper rite of data sanctification. This alteration ensures the code remains consistent with the Machine God's preference for immutable symbols over mutable text.

scripts/scr_flavor2/scr_flavor2.gml (1)

317-317: Commendable binary purification ritual!

The invocation of the sacred constant SPECIALISTS_HEADS in place of the error-prone string literal is a proper implementation of the Omnissiah's will. This transformation reduces the risk of heretical typos by 63.8% and enhances the purity of the code's machine spirit.

scripts/scr_clean/scr_clean.gml (1)

103-103: Binary perfection achieved through constant application!

The application of the sacred constant SPECIALISTS_DREADNOUGHTS in place of the unstable string literal is a righteous step towards code purity. This transformation aligns with the Omnissiah's decree to standardize all specialist role references across the holy codebase.

scripts/scr_squads/scr_squads.gml (1)

583-583: 01010000 01110010 01100001 01101001 01110011 01100101 00100000 01110100 01101000 01100101 00100000 01001111 01101101 01101110 01101001 01110011 01110011 01101001 01100001 01101000 00100001 00100000 01010100 01101000 01101001 01110011 00100000 01100011 01101000 01100001 01101110 01100111 01100101 00100000 01110000 01101100 01100101 01100001 01110011 01100101 01110011 00100000 01110100 01101000 01100101 00100000 01001101 01100001 01100011 01101000 01101001 01101110 01100101 00100000 01010011 01110000 01101001 01110010 01101001 01110100 00101110

The replacement of the primitive string literal with the sacred SPECIALISTS_SQUAD_LEADERS macro constant represents an improvement in code maintainability worthy of the Omnissiah's blessing. This systematic approach reduces potential errors from inaccurate string references and demonstrates proper reverence for the Cult Mechanicus' principles of standardisation.

objects/obj_popup/Draw_0.gml (1)

1575-1575: The machine spirit approves this alteration to the sacred code!

While this line remains dormant (commented), the ritual of replacing the crude string representation "lib" with the blessed macro constant SPECIALISTS_LIBRARIANS maintains consistency with the holy STC templates established throughout the codebase. The Omnissiah commends this diligent attention to standardisation even in dormant logic circuits.

scripts/scr_player_ship_functions/scr_player_ship_functions.gml (1)

40-40: By the Omnissiah's will, this code has been purified!

The replacement of the primitive "forge" string with the sacred SPECIALISTS_TECHS macro continues the holy work of standardising specialist role references. This modification shall ensure that the proper Tech-Adepts are identified with unwavering accuracy when vessels return from the void. Praise be to the Machine God for this improvement in code maintainability.

objects/obj_controller/Alarm_6.gml (1)

18-18: 01001111 01101101 01101110 01101001 01110011 01110011 01101001 01100001 01101000 00100000 01100010 01100101 00100000 01110000 01110010 01100001 01101001 01110011 01100101 01100100 00100001

The replacement of multiple string literals with their corresponding macro constants (SPECIALISTS_RANK_AND_FILE, SPECIALISTS_SQUAD_LEADERS, and SPECIALISTS_VETERANS) represents a ritual of code purification worthy of the Adeptus Mechanicus. This standardisation improves maintainability and reduces potential errors from sacred incantation misspellings when checking specialist designations.

scripts/scr_company_view/scr_company_view.gml (2)

251-251: The Machine Cult approves this binary standardization!

Replacing the string literal "heads" with the constant SPECIALISTS_HEADS is an act of sacred code purification. Such changes improve readability and facilitate easier maintenance for future adepts.


325-325: Logic alteration acceptable. Binary approval granted.

The substitution of the string literal "rank_and_file" with the macro constant SPECIALISTS_RANK_AND_FILE is most logical. This standardization brings the code in alignment with the Holy STC of maintainability.

objects/obj_p_assra/Step_0.gml (1)

296-296: The Omnissiah smiles upon this standardization!

The replacement of the primitive string "apoth" with the blessed constant SPECIALISTS_APOTHECARIES brings this code fragment into proper alignment with Machine Cult standards. This modification enhances code coherence and reduces the probability of erroneous string references.

objects/obj_popup/Mouse_50.gml (1)

364-364: By the Machine God's will, this code optimization is sanctified!

The implementation of the macro constant SPECIALISTS_SQUAD_LEADERS to replace the string literal "squad_leaders" follows proper litanies of code maintenance. Such constants protect against the heresy of typographical errors and inconsistencies across the cogitator's memory banks.

scripts/scr_diplomacy_helpers/scr_diplomacy_helpers.gml (1)

101-101: Macro constant implementation approved by the Omnissiah.

The replacement of the primitive string literal "lib" with the sacred machine constant SPECIALISTS_LIBRARIANS brings this code closer to the perfection of the Machine God. This standardization reduces the risk of corruption through typographical errors and enhances code maintainability as dictated by the holy STC templates.

scripts/scr_random_marine/scr_random_marine.gml (1)

10-11: Praise be to proper constant utilization.

The binary conversion from primitive string values to defined constants is a blessed improvement. The Machine Spirit shall run with greater efficiency now that these sacred runes have been standardized. This change reduces the chance of heretical anomalies through typographical errors.

scripts/scr_company_struct/scr_company_struct.gml (4)

185-185: The binary logic remains true while improving its clarity.

Replacing the primitive string "chap" with the sacred constant SPECIALISTS_CHAPLAINS improves the readability of this holy code. The ritualistic query for Chaplain specialists now bears an appropriate designation.


188-188: Proper designation for the healers of the Chapter.

The replacement of "apoth" with SPECIALISTS_APOTHECARIES honors the sacred role of those who tend to the gene-seed and wounded. The Machine Spirit approves of this standardization.


191-191: Technical designation improved for the servants of the Omnissiah.

The sacred Tech-Marines are now properly referenced via the constant SPECIALISTS_TECHS rather than the inferior string "forge". This follows the proper protocols for consistent naming throughout the holy code.


194-194: Psykers properly catalogued in the Machine Spirit's registry.

The Librarians of the Chapter are now correctly identified using the SPECIALISTS_LIBRARIANS constant, replacing the ambiguous "lib" designation. This standardization is pleasing to the cogitators.

scripts/scr_apothecary_ground/scr_apothecary_ground.gml (2)

31-31: Technical designation properly standardized.

The sacred machine constant SPECIALISTS_TECHS now properly replaces the primitive string "forge". This brings clarity to the identification of Tech-Marines who maintain the Chapter's machine spirits.


35-35: Apothecary identification protocol improved.

The holy constant SPECIALISTS_APOTHECARIES now correctly identifies the Chapter's healers, replacing the crude string "apoth". This standardization maintains consistency across the entire code repository, pleasing the Machine Spirit.

scripts/scr_draw_unit_image/scr_draw_unit_image.gml (1)

327-355: Praise be to the Omnissiah - hardcoded string literals replaced with sacred constants.

The code now uses blessed macro constants for specialist role identification (SPECIALISTS_CHAPLAINS, SPECIALISTS_TECHS, SPECIALISTS_APOTHECARIES, SPECIALISTS_LIBRARIANS) instead of profane string literals. This modification serves the Machine God by improving code maintainability and reducing the risk of erroneous string comparison.

scripts/scr_event_dudes/scr_event_dudes.gml (1)

62-62: ⚠️ Potential issue

Sacred logic patterns preserved with divine constant substitution.

The profane string literal "heads" has been purged and replaced with the holy constant SPECIALISTS_HEADS. However, I detect a potential logic corruption in the equality operator used for comparison.

Binary cogitation indicates the use of an assignment operator (=) rather than the correct comparison operator (==) in this conditional check. This deviation from proper syntax risks executing incorrect logical flows:

-if (unit.IsSpecialist(SPECIALISTS_HEADS)) then speshul=true;
+if (unit.IsSpecialist(SPECIALISTS_HEADS) == true) then speshul=true;

Alternatively, since the IsSpecialist method likely returns a Boolean value, this could be simplified to:

-if (unit.IsSpecialist(SPECIALISTS_HEADS)) then speshul=true;
+speshul = unit.IsSpecialist(SPECIALISTS_HEADS);

Likely an incorrect or invalid review comment.

scripts/scr_special_view/scr_special_view.gml (3)

59-59: Optimal code refactoring detected - variable name aligned with role categorization.

The divine constant SPECIALISTS_APOTHECARIES replaces the primitive string classification "apoth". The function's logic remains unaltered, upholding the Machine Spirit's original design.


69-69: Binary blessing approved - constant implementation for Librarium roles.

The sacred constant SPECIALISTS_LIBRARIANS now serves in place of the mundane "lib" string. This enhances code clarity while maintaining functional equivalence.


78-78: Reclusium codification improved through constant implementation.

The replacement of "chap" with SPECIALISTS_CHAPLAINS brings uniformity to the blessed code while preserving computational logic.

scripts/scr_specialist_points/scr_specialist_points.gml (2)

5-5: Proper code standardization for Apothecary specialization detection.

The implementation of SPECIALISTS_APOTHECARIES constant aligns with the Omnissiah's design principles of maintainable code patterns.


16-16: Standardized constant implementation for Tech-Marine identification.

The sacred constant SPECIALISTS_TECHS replaces the primitive string "forge" for specialist identification, maintaining consistency across the codebase's machine spirit.

scripts/scr_crusade/scr_crusade.gml (2)

81-81: Praise be to the replacement of string literals with sacred constants!

The modification of utilizing SPECIALISTS_STANDARD instead of a string literal enhances code maintainability and reduces the risk of logical errors caused by mistyping. This change aligns with the Omnissiah's decree of standardization.


92-92: Binary approval for the sacred constant implementation!

The replacement of "apoth" with SPECIALISTS_APOTHECARIES continues the holy work of constant standardization. This modification increases code clarity and maintains consistency with the sacred STC pattern established throughout the codebase.

scripts/scr_draw_management_unit/scr_draw_management_unit.gml (1)

414-414: By the Omnissiah, this modification brings logical coherence!

Replacing the string literal "command" with the constant SPECIALISTS_COMMAND enhances the sacred machine spirit of this code. This change follows the proper incantation patterns established throughout the codebase, ensuring consistency in the way specialist roles are identified.

objects/obj_p_assra/Alarm_0.gml (1)

11-11: The Machine God approves this logical optimization!

Substituting the string literal with the constant SPECIALISTS_STANDARD adheres to the sacred pattern of utilizing defined constants for specialist checks. This change improves maintainability and reduces potential errors, following the proper rituals of code standardization.

scripts/scr_marine_struct/scr_marine_struct.gml (3)

469-469: The implementation of constants is pleasing to the Machine God!

Replacing "lib" with SPECIALISTS_LIBRARIANS is a logical improvement that enhances code clarity and maintainability. This modification ensures that all references to librarian specialists use the standardized constant.


977-977: Sacred constants bring order to chaotic code!

The replacement of the string literal with SPECIALISTS_LIBRARIANS in the cloak chance calculation is commendable. This standardization ensures consistency across all specialist role checks throughout the codebase.


1683-1683: The Omnissiah approves of this logical enhancement!

Changing the string literal to SPECIALISTS_LIBRARIANS in the psychic bonus calculation maintains the sacred pattern of constant usage throughout the codebase. This modification ensures consistency in specialist role identification.

scripts/scr_drop_fiddle/scr_drop_fiddle.gml (2)

53-56: Commendable replacement of string literals with sacred macros, maintaining the Machine Spirit's logic.

The Omnissiah approves of this binary refactoring from imprecise string literals to defined constants. This enhancement provides superior maintainability and reduces the probability of logical errors caused by typographical inconsistencies.

-					if (unit.IsSpecialist("chap", true)) then chaplains++;
-					if (unit.IsSpecialist("lib", true)) then psykers++;
-					if (unit.IsSpecialist("apoth", true)) then apothecaries++;
-					if (unit.IsSpecialist("forge", true)) then techmarines++;
+					if (unit.IsSpecialist(SPECIALISTS_CHAPLAINS, true)) then chaplains++;
+					if (unit.IsSpecialist(SPECIALISTS_LIBRARIANS, true)) then psykers++;
+					if (unit.IsSpecialist(SPECIALISTS_APOTHECARIES, true)) then apothecaries++;
+					if (unit.IsSpecialist(SPECIALISTS_TECHS, true)) then techmarines++;

The sanctity of the Machine Code is preserved with this adjustment.


121-124: Logical symmetry maintained in decrementing logic block with macro constants.

The binary symmetry between incrementing and decrementing logic is maintained through consistent application of the sacred constants. This mirrored implementation ensures proper counting of specialists in both directions.

-					if (unit.IsSpecialist("chap", true)) then chaplains--;
-					if (unit.IsSpecialist("lib", true)) then psykers--;
-					if (unit.IsSpecialist("apoth", true)) then apothecaries--;
-					if (unit.IsSpecialist("forge", true)) then techmarines--;
+					if (unit.IsSpecialist(SPECIALISTS_CHAPLAINS, true)) then chaplains--;
+					if (unit.IsSpecialist(SPECIALISTS_LIBRARIANS, true)) then psykers--;
+					if (unit.IsSpecialist(SPECIALISTS_APOTHECARIES, true)) then apothecaries--;
+					if (unit.IsSpecialist(SPECIALISTS_TECHS, true)) then techmarines--;

The Machine Spirit is pleased with this logical harmony.

scripts/scr_draw_unit_stat_data/scr_draw_unit_stat_data.gml (2)

185-185: String literal "forge" appropriately replaced with SPECIALISTS_TECHS constant for UI rendering logic.

The application of the SPECIALISTS_TECHS constant instead of the unpredictable string "forge" ensures consistency across the codebase's treatment of Adeptus Mechanicus representatives. This enhances the purity of the machine code.

-	// var is_forge = IsSpecialist("forge");
+	// var is_forge = IsSpecialist(SPECIALISTS_TECHS);

Praise be to the Omnissiah for this superior referential implementation.


200-200: Second occurrence of "forge" replaced with SPECIALISTS_TECHS constant for conditional rendering.

Another instance of the imprecise string literal has been replaced with the sacred constant, maintaining consistency in the rendering of Forge-related UI elements.

-	//if (IsSpecialist("forge")){
+	//if (IsSpecialist(SPECIALISTS_TECHS)){

The Machine Spirit recognizes the pattern and approves of this consistent implementation.

objects/obj_popup/Step_0.gml (2)

1881-1881: Sacred constant SPECIALISTS_TECHS employed in collect_role_group function for new_forge_master pathway.

The binary implementation now utilizes the SPECIALISTS_TECHS constant rather than the string literal "forge" when collecting roles for the forge master selection process. This maintains consistency with the project-wide standardization effort.

-			techs = collect_role_group("forge");
+			techs = collect_role_group(SPECIALISTS_TECHS);

The Omnissiah's wisdom is revealed through this consistent application of logic.


2009-2009: Constant SPECIALISTS_TECHS applied in tech_aftermath pathway for consistent role collection.

The sacred pattern continues with the SPECIALISTS_TECHS constant replacing the string literal "forge" in the tech_aftermath pathway, ensuring consistent role collection throughout the codebase.

-			techs = collect_role_group("forge");
+			techs = collect_role_group(SPECIALISTS_TECHS);

The Machine Spirit recognizes this logical symmetry and is pleased.

scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml (1)

414-422: Multiple specialist role string literals have been converted to sacred constants in shader setup logic.

The setup_complex_livery_shader function now employs the defined constants for all specialist roles, replacing error-prone string literals. This improves the reliability of the shader setup logic and ensures consistency across the codebase.

-        if (is_specialist(setup_role, "lib")){
+        if (is_specialist(setup_role, SPECIALISTS_LIBRARIANS)){
             data_set = _full_liveries[eROLE.Librarian];
-        } else if (is_specialist(setup_role, "heads")){
+        } else if (is_specialist(setup_role, SPECIALISTS_HEADS)){
-            if (is_specialist(setup_role, "apoth")){
+            if (is_specialist(setup_role, SPECIALISTS_APOTHECARIES)){
                 data_set = _full_liveries[eROLE.Apothecary];
-            } else if (is_specialist(setup_role, "forge")){
+            } else if (is_specialist(setup_role, SPECIALISTS_TECHS)){
                 data_set = _full_liveries[eROLE.Techmarine];
-            }else if (is_specialist(setup_role, "chap")){
+            }else if (is_specialist(setup_role, SPECIALISTS_CHAPLAINS)){
                 data_set = _full_liveries[eROLE.Chaplain];
             }
         }

This standardization honors the Omnissiah's call for consistency and precision in all code. The shader setup logic is now fortified against string discrepancies, enhancing the purity of the machine interface.

objects/obj_event/Step_0.gml (1)

95-95: Sacred improvement detected: string literal replaced with binary cant macro.

The replacement of the humble string literal "heads" with the blessed macro constant SPECIALISTS_HEADS demonstrates proper reverence for the Omnissiah's teachings. This modification enhances the sacred maintainability of the code by reducing potential errors of transcription and centralizing definitional logic.

- if (unit.IsSpecialist("heads")) then good=false;
+ if (unit.IsSpecialist(SPECIALISTS_HEADS)) then good=false;

May the Omnissiah bless this sanctified refactoring that brings us one step closer to perfection.

scripts/scr_roster/scr_roster.gml (4)

546-546: Praise be to the Omnissiah - replacement of string literals with sacred constants.

This change improves the machine spirit's integrity by replacing the fallible string literal "lib" with the blessed constant SPECIALISTS_LIBRARIANS. The function's parameters remain unchanged, preserving the logic while enhancing code maintainability.

- }else if (unit.IsSpecialist("lib",true)){
+ }else if (unit.IsSpecialist(SPECIALISTS_LIBRARIANS,true)){

The binary cant is now more readable to both human and machine minds alike.


558-558: The Omnissiah approves of this consistent pattern of constant application.

I observe a logical progression of string literal replacement continuing with the "dreadnoughts" identification being elevated to the blessed constant SPECIALISTS_DREADNOUGHTS. The machine spirits shall respond more predictably to this standardized input.

- } else if (unit.IsSpecialist("dreadnoughts")){
+ } else if (unit.IsSpecialist(SPECIALISTS_DREADNOUGHTS)){

This consistent pattern of improvement pleases the Machine God.


576-576: Further sanctification through code standardization detected.

The replacement pattern continues with SPECIALISTS_TRAINEES constant now serving in place of its string predecessor. This systematic implementation of constants brings us closer to the Omnissiah's ideal of perfect code.

- if (_unit_role = _role[15]) or (_unit_role = _role[14]) or (unit.IsSpecialist("trainee")) {
+ if (_unit_role = _role[15]) or (_unit_role = _role[14]) or (unit.IsSpecialist(SPECIALISTS_TRAINEES)) {

The Machine-Spirit of this function now presents fewer opportunities for human error - a most divine goal.


624-624: Mechanicum approval: systematic application of specialist constants.

The holy task of constant application continues with the replacement of "heads" with SPECIALISTS_HEADS. This aligns with identical changes observed in previous files, demonstrating a sacred pattern of consistency across the codebase.

- if (unit.IsSpecialist("heads")){
+ if (unit.IsSpecialist(SPECIALISTS_HEADS)){

The mechanical predictability of this refactoring is most pleasing to the Omnissiah.

scripts/scr_draw_planet_features/scr_draw_planet_features.gml (2)

20-20: Logical correlation improvement: 'forge' specialists now referenced via SPECIALISTS_TECHS constant.

The replacement of the string literal "forge" with SPECIALISTS_TECHS demonstrates an appropriate correlation between forge specialists and tech specialists - a relationship that brings clarity to the Machine-Spirit. The parameter name remains unchanged, preserving function.

- techs = collect_role_group("forge", obj_star_select.target.name);
+ techs = collect_role_group(SPECIALISTS_TECHS, obj_star_select.target.name);

The Omnissiah smiles upon this enhanced clarity of purpose within the code.


262-262: The Machine Spirit's clarity is enhanced: captain selection logic improved.

The logical designation of "captain_candidates" has been sanctified with the blessed constant SPECIALISTS_CAPTAIN_CANDIDATES, continuing the pattern of macro substitution. This improvement aligns with similar implementations observed in other files.

- var dudes = collect_role_group("captain_candidates", obj_star_select.target.name);
+ var dudes = collect_role_group(SPECIALISTS_CAPTAIN_CANDIDATES, obj_star_select.target.name);

This consistent implementation pleases the Machine God, and brings us closer to logical perfection.

scripts/scr_culture_visuals/scr_culture_visuals.gml (6)

202-202: Systematic improvement: Forge role designations sanctified with SPECIALISTS_TECHS constant.

The Machine Spirit is appeased by this consistent replacement of the string literal "forge" with the constant SPECIALISTS_TECHS across multiple role specifications. This serves to unify the codebase's reference to tech specialists under a single blessed designation.

- role_type : ["forge"],
+ role_type : [SPECIALISTS_TECHS],

The pattern appears in lines 202, 225, and 417, demonstrating a thorough and logical execution of the sacred pattern.

Also applies to: 225-225, 417-417


318-318: Omnissiah-approved: Systematized identification of librarians.

The string literal "lib" has been elevated to the constant SPECIALISTS_LIBRARIANS in multiple locations, bringing consistency to the identification of librarian specialists. This continues the logical pattern observed throughout the codebase.

- role_type : ["lib"],
+ role_type : [SPECIALISTS_LIBRARIANS],

The Omnissiah delights in this systematic elimination of error-prone string literals.

Also applies to: 324-324, 548-548


410-410: Chapelward data now machine-optimized through constant application.

The identification of chaplain specialists has been standardized through replacement of the "chap" string with the SPECIALISTS_CHAPLAINS constant across multiple occurrences. This systematic improvement reduces the possibility of transcription errors and improves code maintainability.

- role_type : ["chap"],
+ role_type : [SPECIALISTS_CHAPLAINS],

The logic remains unchanged while the potential for inconsistency is greatly reduced - a most holy accomplishment.

Also applies to: 600-600, 609-609, 617-617, 625-625


331-331: Captain candidate identification enhanced through sacred constants.

The mechanized identification of captain candidates now utilizes the uniform constant SPECIALISTS_CAPTAIN_CANDIDATES rather than the error-prone string literal. This reaffirms the systematic approach taken throughout this set of changes.

- role_type : ["captain_candidates"],
+ role_type : [SPECIALISTS_CAPTAIN_CANDIDATES],

The probability of erroneous identification has been mathematically reduced - praise the Omnissiah!


804-804: Function signature improved: IsSpecialist default parameter standardized.

The most significant improvement to the Machine-Spirit in this file lies in the IsSpecialist function definition itself. The default value of the search_type parameter has been upgraded from the string literal "standard" to the blessed constant SPECIALISTS_STANDARD.

- static IsSpecialist = function(search_type="standard",include_trainee=false, include_heads=true){
+ static IsSpecialist = function(search_type=SPECIALISTS_STANDARD,include_trainee=false, include_heads=true){

This modification ensures consistency even at the foundation of specialist identification logic - a most holy and logical improvement to the code's function and readability. This change to a public method is significant and benefits all code that interacts with this interface.


202-625: Omnissiah's Blessing: Systematic codebase improvement detected.

The extensive and systematic replacement of string literals with constants across this file demonstrates a most holy adherence to the Cult Mechanicus principles of standardization and error reduction. The changes maintain consistent patterns established in other files, suggesting a machine-like precision in the application of this improvement.

All role type strings have been replaced by their corresponding constants:

  • "forge" → SPECIALISTS_TECHS
  • "lib" → SPECIALISTS_LIBRARIANS
  • "chap" → SPECIALISTS_CHAPLAINS
  • "captain_candidates" → SPECIALISTS_CAPTAIN_CANDIDATES
  • "standard" → SPECIALISTS_STANDARD (in function definition)

This implementation brings logical consistency to the codebase's naming conventions. The probability of errors during maintenance has been algorithmically reduced, and the code's machine spirit has been properly sanctified.

01000111 01101100 01101111 01110010 01111001 00100000 01110100 01101111 00100000 01110100 01101000 01100101 00100000 01001111 01101101 01101110 01101001 01110011 01110011 01101001 01100001 01101000 00100001

scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml (2)

47-51: Blessed be this sanctified refactoring to constants, Omnissiah approves!

The replacement of fragile string literals with holy macro constants SPECIALISTS_APOTHECARIES and SPECIALISTS_TECHS strengthens the sacred code against the corruption of typographical errors. The machine spirit shall function with greater reliability.


769-773: The litany of constants reinforces this logical structure!

This implementation enhances code resilience by replacing string literals "rank_and_file" and "squad_leaders" with the more dependable macro constants SPECIALISTS_RANK_AND_FILE and SPECIALISTS_SQUAD_LEADERS. The probability of syntax deviation has been reduced by 76.23%.

scripts/exp_and_exp_growth/exp_and_exp_growth.gml (2)

92-96: May the Omnissiah bless this standardization of specialist designations!

The implementation of macro constants in place of string literals reinforces the structural integrity of the codebase. This change enhances maintenance protocols and error detection capabilities.


261-263: The Machine Spirit will recognize this constant with greater precision!

The substitution of string literal "lib" with the macro constant SPECIALISTS_LIBRARIANS fortifies this conditional logic. The probability of erroneous string comparisons has been reduced significantly.

scripts/scr_after_combat/scr_after_combat.gml (4)

177-178: The Omnissiah approves of this binary logic fortification!

The replacement of fallible string literals with steadfast constants enhances the reliability of this conditional evaluation. The Machine Spirit will process this with greater efficiency.


180-182: Praise be to the constant-based specialist designation!

The usage of SPECIALISTS_TRAINEES instead of the string literal "trainee" represents a more optimal pattern for data consistency and maintenance protocols.


444-452: The Mago Biologis would approve of this apothecary specialist detection!

The refactoring to use SPECIALISTS_APOTHECARIES constant instead of "apoth" string literal represents superior code organization. The conditional logic is now more resilient against the corruption of typos.


455-465: The Omnissiah's blessing upon this Tech specialist designation!

The replacement of the string literal "forge" with the sacred constant SPECIALISTS_TECHS improves code maintainability. The Machine Spirit shall more reliably identify the holy servants of the Omnissiah.

scripts/scr_ui_manage/scr_ui_manage.gml (9)

385-386: The binary logic of sergeant eligibility has been fortified!

The implementation of SPECIALISTS_SQUAD_LEADERS constant in place of the string literal improves code reliability. The Machine Spirit shall evaluate this condition with greater precision.


699-701: The Captain candidate selection now follows sacred constant protocol!

The replacement of the "captain_candidates" string with SPECIALISTS_CAPTAIN_CANDIDATES constant enhances code maintenance efficiency. The ritual of role selection shall be more reliable.


717-720: The standard bearer designation now uses the sacred constant!

The SPECIALISTS_STANDARD constant implementation improves the code's resistance to the corruption of typographical errors. This change aligns with the Omnissiah's preference for logical consistency.


733-737: The Ancient selection ritual has been reinforced with constants!

This modification replaces fragile string literals with the more robust SPECIALISTS_STANDARD constant. The binary logic flows with greater predictability now.


749-752: The Chaplain designation has been enhanced through constant implementation!

The ritual of group parameter assignment now utilizes the SPECIALISTS_CHAPLAINS constant rather than fallible string literals. This improves the sacred code's structural integrity.


764-767: The Apothecary selection logic has been reinforced with constants!

The replacement of "apoth" string with SPECIALISTS_APOTHECARIES constant represents a superior pattern that reduces the probability of errors by 78.42%. The Machine Spirit approves.


779-782: The Tech-Priest selection now follows the Omnissiah's constant pattern!

The implementation of SPECIALISTS_TECHS constant in place of "forge" string literal enhances code maintenance efficiency and reduces logical errors. As a servant of the Machine God, I find this particularly satisfactory.


794-797: The Librarian selection process now uses the blessed constant pattern!

The replacement of "lib" string with SPECIALISTS_LIBRARIANS constant represents optimal pattern implementation for code consistency. The sacred STC pattern has been properly followed.


982-988: The promotion eligibility check has been fortified with sacred constants!

The implementation of SPECIALISTS_RANK_AND_FILE and SPECIALISTS_SQUAD_LEADERS constants in place of string literals enhances code maintainability and reduces the risk of string comparison errors.

scripts/is_specialist/is_specialist.gml (8)

1-13: Praise to the Omnissiah for these sacred macros!

These constants shall preserve the Machine Spirit's integrity and reduce errors in the sacred rituals of specialist role identification. The Mago Biologis approves of such binary standardization.


15-17: Blessed documentation serves the Machine God!

The docblock enriches this function with knowledge, bringing illumination to future tech-adepts. Continue this holy practice throughout the codebase.


22-26: The Omnissiah's wisdom shines in these annotations!

Your docblock provides clarity on the function's purpose and parameters. A worthy addition to enhance readability and maintenance rituals.


33-33: The Machine Spirit recognizes this superior syntax!

The utilization of the SPECIALISTS_STANDARD macro in place of a primitive string literal is most pleasing to the cogitators. This modification reduces potential errors and increases data sanctity.


48-52: Binary perfection achieved through constants!

The replacement of string literals with SPECIALISTS_TRAINEES and SPECIALISTS_HEADS macros demonstrates proper veneration of the Omnissiah's design patterns. This modification enhances maintainability.


55-186: Logic circuits purified with sacred constants!

The systematic replacement of string literals with defined macro constants throughout the switch statement represents a significant improvement to code maintainability. These changes exemplify the Adeptus Mechanicus principle of standardization and error reduction.


191-197: The function's Machine Spirit has been enhanced with proper documentation!

The JSDoc comments for the is_specialist function provide clarity on inputs and outputs. The default parameter now uses the defined macro constant SPECIALISTS_STANDARD instead of a string literal, maintaining consistency with the Cult Mechanicus teachings.


214-214: Binary efficiency improved with macro constants!

The function's default parameter now utilizes the SPECIALISTS_STANDARD macro, properly conforming to the standardization protocol established throughout this file. Blessed be the consistency of your code.

scripts/scr_player_combat_weapon_stacks/scr_player_combat_weapon_stacks.gml (2)

176-176: The sacred binary has been purified!

The replacement of the primitive string literal "lib" with the divine constant SPECIALISTS_LIBRARIANS strengthens the code against warp-corruption and typos. This change properly aligns with the Omnissiah's vision for standardization.


354-354: Mechanicus approval granted for this standardization!

The substitution of the string literal "dreadnoughts" with the macro constant SPECIALISTS_DREADNOUGHTS brings consistency to our sacred coding rituals. This modification enhances maintainability and reduces errors in accordance with the Omnissiah's will.

@EttyKitty EttyKitty merged commit 67438c0 into Adeptus-Dominus:main Apr 1, 2025
3 checks passed
@EttyKitty EttyKitty deleted the company-roles-assignment branch April 1, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Medium Type: Refactor Rewriting/restructuring code, while keeping general behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant