Skip to content
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

refactor: trait usage standardisation #376

Merged

Conversation

VanWeapon
Copy link
Contributor

@VanWeapon VanWeapon commented Jan 4, 2025

Description of changes

  • remove old useage of trait checking still found in code

Reasons for changes

  • standardisation and legibility

Related links

  • found thanks to investigating trait effects and found a number of old usages which are probably broken in 0.10+ because of the new 8 trait limit

Summary by Sourcery

Standardize trait usage by replacing string comparisons with a dedicated function.

Enhancements:

  • Replace string-based trait checking with scr_has_adv and scr_has_disadv functions.

Tests:

  • Update tests to reflect the changes in trait checking.

Copy link
Contributor

sourcery-ai bot commented Jan 4, 2025

Reviewer's Guide by Sourcery

This pull request refactors trait usage by replacing string-based trait checking with the functions scr_has_adv and scr_has_disadv.

File-Level Changes

Change Details Files
Replaced string-based trait checking related to advantages with scr_has_adv.
  • Used the function scr_has_adv for the following traits: Ambushers, Bolter Drilling, Enemy: Eldar, Enemy: Fallen, Enemy: Orks, Enemy: Tau, Enemy: Tyranids, Siege Masters, Devastator Doctrine, Assault Doctrine, Kings of Space, Daemon Binders, Tech-Brothers, Never Forgive, Tech-Scavengers, Lightning Warriors, Boarders, Crafters, Psyker Abundance, Reverent Guardians, Siege Masters.
objects/obj_fleet/Create_0.gml
scripts/scr_powers/scr_powers.gml
scripts/scr_draw_unit_image/scr_draw_unit_image.gml
objects/obj_controller/Alarm_5.gml
objects/obj_popup/Draw_0.gml
objects/obj_star_select/Draw_64.gml
scripts/scr_squads/scr_squads.gml
scripts/scr_unit_traits/scr_unit_traits.gml
Replaced string-based trait checking related to disadvantages with scr_has_disadv.
  • Used the function scr_has_disadv for the following traits: Black Rage, Shitty Luck, Warp Touched, Doom, Psyker Intolerant, Tech-Heresy, Tolerant.
objects/obj_fleet/Create_0.gml
objects/obj_ncombat/Alarm_5.gml
scripts/scr_powers/scr_powers.gml
objects/obj_controller/Alarm_5.gml
scripts/scr_kill_unit/scr_kill_unit.gml
objects/obj_controller/Create_0.gml
objects/obj_popup/Step_0.gml
scripts/scr_marine_struct/scr_marine_struct.gml
scripts/scr_random_event/scr_random_event.gml
scripts/scr_enemy_ai_b/scr_enemy_ai_b.gml
scripts/scr_enemy_ai_d/scr_enemy_ai_d.gml
scripts/scr_garrison/scr_garrison.gml
scripts/scr_player_combat_weapon_stacks/scr_player_combat_weapon_stacks.gml
scripts/scr_specialist_point_handler/scr_specialist_point_handler.gml
scripts/scr_add_artifact/scr_add_artifact.gml
Removed string-based trait checking variables.
  • Removed the variables strin and strin2 which were previously used for string-based trait checking, as they are no longer needed after refactoring.
objects/obj_ini/Create_0.gml
scripts/scr_load/scr_load.gml
scripts/scr_save/scr_save.gml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the PR: Refactor Rewriting/restructuring code, while keeping general behaviour label Jan 4, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Jan 4, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @VanWeapon - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@VanWeapon VanWeapon requested a review from EttyKitty January 4, 2025 09:41
@EttyKitty EttyKitty added the PR: Fix This is a fix for a bug label Jan 4, 2025
Copy link
Contributor

@EttyKitty EttyKitty left a comment

Choose a reason for hiding this comment

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

@VanWeapon, I'm okay with merging this, as it's also a major fix.

scripts/scr_perils_table/scr_perils_table.gml Show resolved Hide resolved
also fix old usage of direct array checking and instead using the functions consistently
@EttyKitty
Copy link
Contributor

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @VanWeapon - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@EttyKitty EttyKitty merged commit c88dea8 into Adeptus-Dominus:release/0.10.0.0 Jan 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Fix This is a fix for a bug PR: Refactor Rewriting/restructuring code, while keeping general behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants