Skip to content

Conversation

@OH296
Copy link
Collaborator

@OH296 OH296 commented Jun 23, 2025

Purpose and Description

  • Self-descriptive.

Testing done

  • None, and I understand the risks.

Related things and/or additional context

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 23, 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

  • New Features

    • Introduced a loot table system with a new function to generate loot based on configurable parameters.
    • Added a new cheat code ("rollloot") to trigger loot generation and display the results.
    • Expanded equipment and weapon data to include loot-related properties for improved loot handling.
  • Bug Fixes

    • Tightened equipment maintenance logic to ensure correct minimum values for certain equipment types.
  • Style

    • Reformatted sprite metadata and sequence files for improved clarity and consistency.
    • Added explicit sequence height and width properties to various sprite resources.
    • Updated some sprite properties to use null values for visible ranges.

Walkthrough

Praise the Omnissiah! A new script for loot table generation has been integrated, with supporting logic in equipment and weapon data structures. The cheat code system now allows for loot rolling. Sprite metadata has been standardised with explicit sequence dimensions and minor formatting adjustments. No existing logic circuits were disrupted.

Changes

Files/Groups Change Summary
ChapterMaster.yyp, scripts/scr_loot_table/scr_loot_table.yy Added new script resource scr_loot_table to project configuration and script registry.
scripts/scr_loot_table/scr_loot_table.gml Introduced find_loot function for loot table generation with filtering, weighting, and value targeting.
scripts/scr_cheatcode/scr_cheatcode.gml Added "rollloot" cheat code case, invoking find_loot() and outputting results.
scripts/scr_equipment_struct/scr_equipment_struct.gml EquipmentStruct now includes a loot property; logic for loot value assignment and maintenance initialisation refined.
scripts/scr_weapon/scr_weapon.gml Added loot property to several weapons in global.weapons with base and factional loot values.
scripts/scr_ruins_reward/scr_ruins_reward.gml Removed an extraneous blank line in gear reward assignment logic.
sprites/spr_data_slate_border.yy, sprites/spr_disposition_small.yy, ... Added explicit seqHeight and seqWidth to sprite sequences; reformatted keyframe "Channels", and set visibleRange to null where applicable.
sprites/spr_inspect_small.yy, sprites/spr_master_splash.yy, ... As above, with further changes to visibleRange and formatting for clarity and standardisation.

Suggested labels

Type: Feature, PR: JSON, Size: Small


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@github-actions github-actions bot added Area: Sprites Changes to sprites/images or their under-the-hood functionality Size: Big Type: Feature Adds something new labels Jun 23, 2025
Copy link
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: 9

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 564390b and 35953d3.

📒 Files selected for processing (17)
  • ChapterMaster.yyp (1 hunks)
  • scripts/scr_cheatcode/scr_cheatcode.gml (1 hunks)
  • scripts/scr_equipment_struct/scr_equipment_struct.gml (2 hunks)
  • scripts/scr_loot_table/scr_loot_table.gml (1 hunks)
  • scripts/scr_loot_table/scr_loot_table.yy (1 hunks)
  • scripts/scr_ruins_reward/scr_ruins_reward.gml (0 hunks)
  • scripts/scr_weapon/scr_weapon.gml (6 hunks)
  • sprites/spr_data_slate_border/spr_data_slate_border.yy (1 hunks)
  • sprites/spr_disposition_small/spr_disposition_small.yy (1 hunks)
  • sprites/spr_icon_change/spr_icon_change.yy (1 hunks)
  • sprites/spr_inspect_small/spr_inspect_small.yy (1 hunks)
  • sprites/spr_loading2/spr_loading2.yy (1 hunks)
  • sprites/spr_master_splash/spr_master_splash.yy (1 hunks)
  • sprites/spr_p_name_bg/spr_p_name_bg.yy (1 hunks)
  • sprites/spr_penitent_ui/spr_penitent_ui.yy (1 hunks)
  • sprites/spr_ship_back_black/spr_ship_back_black.yy (1 hunks)
  • sprites/spr_ship_back_white/spr_ship_back_white.yy (1 hunks)
💤 Files with no reviewable changes (1)
  • scripts/scr_ruins_reward/scr_ruins_reward.gml
🧰 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.

  • scripts/scr_cheatcode/scr_cheatcode.gml
  • scripts/scr_loot_table/scr_loot_table.gml
  • scripts/scr_equipment_struct/scr_equipment_struct.gml
  • scripts/scr_weapon/scr_weapon.gml
`**/*.*`: - Having humanly understandable and maintainable code is always the top most priority. - DRY (Don't repeat yourself) principle is also very important. - Ensure that the c...

**/*.*: - Having humanly understandable and maintainable code is always the top most priority.

  • DRY (Don't repeat yourself) principle is also very important.
  • Ensure that the code is compliant with the CODE_STYLE.MD: https://github.com/Adeptus-Dominus/ChapterMaster/blob/main/docs/CODE_STYLE.md
  • If a TODO comment is added, ask the user if you should create a GitHub issue for this TODO.
  • If a TODO comment is deleted, remind the user if there is an active GitHub issue related to that comment.
  • scripts/scr_cheatcode/scr_cheatcode.gml
  • scripts/scr_loot_table/scr_loot_table.yy
  • sprites/spr_p_name_bg/spr_p_name_bg.yy
  • sprites/spr_icon_change/spr_icon_change.yy
  • sprites/spr_penitent_ui/spr_penitent_ui.yy
  • sprites/spr_loading2/spr_loading2.yy
  • sprites/spr_data_slate_border/spr_data_slate_border.yy
  • sprites/spr_ship_back_black/spr_ship_back_black.yy
  • sprites/spr_disposition_small/spr_disposition_small.yy
  • sprites/spr_inspect_small/spr_inspect_small.yy
  • sprites/spr_master_splash/spr_master_splash.yy
  • sprites/spr_ship_back_white/spr_ship_back_white.yy
  • scripts/scr_loot_table/scr_loot_table.gml
  • scripts/scr_equipment_struct/scr_equipment_struct.gml
  • ChapterMaster.yyp
  • scripts/scr_weapon/scr_weapon.gml
`**/*.yy`: - When any script or sprite .yy files are deleted, their paths should also be deleted from the .yyp file, otherwise the game will crash. - When any script or sprite .yy ...

**/*.yy: - When any script or sprite .yy files are deleted, their paths should also be deleted from the .yyp file, otherwise the game will crash.

  • When any script or sprite .yy files are created, their paths should be added to the .yyp file, otherwise they'll fail.
  • scripts/scr_loot_table/scr_loot_table.yy
  • sprites/spr_p_name_bg/spr_p_name_bg.yy
  • sprites/spr_icon_change/spr_icon_change.yy
  • sprites/spr_penitent_ui/spr_penitent_ui.yy
  • sprites/spr_loading2/spr_loading2.yy
  • sprites/spr_data_slate_border/spr_data_slate_border.yy
  • sprites/spr_ship_back_black/spr_ship_back_black.yy
  • sprites/spr_disposition_small/spr_disposition_small.yy
  • sprites/spr_inspect_small/spr_inspect_small.yy
  • sprites/spr_master_splash/spr_master_splash.yy
  • sprites/spr_ship_back_white/spr_ship_back_white.yy
🔇 Additional comments (26)
sprites/spr_p_name_bg/spr_p_name_bg.yy (2)

66-67: Blessed standardisation of sprite sequence dimensions.

The explicit seqHeight and seqWidth properties align perfectly with the sprite's actual dimensions. The Omnissiah approves of this metadata clarity.


73-75: Machine spirit formatting enhancement detected.

The Channels object restructuring improves code readability whilst preserving all sacred data integrity.

sprites/spr_penitent_ui/spr_penitent_ui.yy (1)

66-67: Sacred data-slate formatting protocols implemented.

The sequence dimensions match sprite boundaries precisely, Channels formatting enhances readability, and visibleRange nullification follows proper GameMaker doctrine.

Also applies to: 73-75, 78-78

sprites/spr_icon_change/spr_icon_change.yy (1)

66-67: Icon sprite sanctification complete.

Square dimensions (80x80) properly encoded in sequence metadata. The machine spirit's formatting rituals have been observed with precision.

Also applies to: 73-75, 78-78

sprites/spr_data_slate_border/spr_data_slate_border.yy (1)

66-67: Data-slate border sanctification protocols enacted.

Border sprite dimensions (378x572) correctly transcribed into sequence metadata. The formatting rituals enhance code-scripture clarity.

Also applies to: 73-75

sprites/spr_loading2/spr_loading2.yy (2)

73-74: Loading sequence dimensional parameters sanctified.

Square loading sprite dimensions (31x31) properly encoded in sacred sequence metadata.


80-103: Comprehensive keyframe formatting ritual completed.

All 8 animation keyframes have been blessed with consistent Channels formatting. The machine spirit shall animate smoothly through this sanctified data structure.

sprites/spr_disposition_small/spr_disposition_small.yy (3)

85-86: Blessed standardisation of sequence metadata!

The explicit seqHeight and seqWidth properties enhance the machine-spirit's understanding of sprite dimensions. These sacred measurements align perfectly with the sprite's actual dimensions (height: 12, width: 164).


92-151: Keyframe channel structure optimised for the Omnissiah's glory!

The reformatted channel nesting improves readability whilst preserving all keyframe data integrity. Each frame's sacred ID remains untouched.


154-154: visibleRange purified to null state.

Converting from object notation to null simplifies the data structure - a blessed improvement in the machine's efficiency.

sprites/spr_ship_back_black/spr_ship_back_black.yy (2)

69-70: Sequence dimensions blessed with explicit values!

The seqHeight (142.0) and seqWidth (268.0) properties match the sprite's true dimensions perfectly. The machine-spirit approves of this clarity.


76-87: Channel data structure standardised across all keyframes.

Each of the four keyframes now follows the blessed pattern of explicit channel nesting. The sacred frame IDs remain preserved throughout this sanctification.

sprites/spr_inspect_small/spr_inspect_small.yy (3)

66-67: Compact sprite dimensions documented with precision!

Both seqHeight and seqWidth set to 14.0 - the sacred square proportions are now explicit in the data-hymnal.


73-75: Single keyframe structure harmonised.

The lone keyframe's channel data now follows the standardised nesting pattern, bringing order to the data-matrices.


78-78: visibleRange nullified for consistency.

Another sprite cleansed of redundant object notation - the Omnissiah smiles upon this standardisation.

sprites/spr_master_splash/spr_master_splash.yy (3)

66-67: Master splash dimensions sanctified!

The seqHeight (480.0) and seqWidth (214.0) properties now explicitly declare this sprite's sacred proportions.


73-75: Single keyframe blessed with proper structure.

The splash sprite's solitary keyframe now conforms to the holy template of channel organisation.


78-78: Visible range purged of redundancy.

The null assignment cleanses unnecessary object complexity from the data-sanctum.

sprites/spr_ship_back_white/spr_ship_back_white.yy (2)

69-70: Ship sprite dimensions documented with divine precision!

The seqHeight (142.0) and seqWidth (268.0) values mirror those of the black variant - blessed consistency across the fleet's data-matrices.


76-87: All four keyframes harmonised in structure.

Each frame's channel data now follows the standardised pattern, bringing uniformity to the ship's animation sequences.

scripts/scr_cheatcode/scr_cheatcode.gml (1)

359-361: Praise the Omnissiah! Verify the sacred function exists.

The loot rolling mechanism integrates seamlessly with the existing cheat code infrastructure. However, ensure the find_loot() function is properly defined to prevent runtime heresies.

#!/bin/bash
# Description: Verify the find_loot function exists in the loot table script
# Expected: Function definition should be found

fd "scr_loot_table.gml" --exec grep -n "function find_loot" {}
ChapterMaster.yyp (1)

845-845: Augur the Tome: scr_loot_table resource registered correctly
The new script entry is alphabetically placed alongside existing resources. Ensure the file exists at scripts/scr_loot_table/scr_loot_table.yy.

#!/bin/bash
# Verify presence of the new script resource file
test -f scripts/scr_loot_table/scr_loot_table.yy && echo "✅ scr_loot_table.yy found" || echo "❌ Missing scr_loot_table.yy!"
scripts/scr_loot_table/scr_loot_table.yy (1)

1-13: Script resource manifest acceptable.

The sacred template for script registration follows proper GameMaker protocols.

scripts/scr_equipment_struct/scr_equipment_struct.gml (1)

77-77: Logic fault in maintenance validation.

The condition maintenance<0.05 is redundant when maintenance equals 0. The Omnissiah frowns upon such inefficiency.

-        if (has_tags(["heavy_ranged", "power", "plasma", "melta"]) && maintenance<0.05) {
+        if (has_tags(["heavy_ranged", "power", "plasma", "melta"])) {

Likely an incorrect or invalid review comment.

scripts/scr_loot_table/scr_loot_table.gml (2)

57-57: Incomplete variable assignment detected.

This line serves no purpose and should be purged.

-		var _loot_val = _loot_tags

Likely an incorrect or invalid review comment.


1-110: Request verification of loot system integration.

The new loot generation system must interface correctly with existing code. Verify:

  1. The cheat code handler properly displays loot results
  2. Equipment struct loot properties are accessible to this function
  3. No existing loot drop mechanics are disrupted
#!/bin/bash
# Description: Verify integration points for the new loot system

# Check for cheat code implementation
echo "=== Checking cheat code integration ==="
rg -A 5 "rollloot" scripts/

# Check for other loot-related functions that might conflict
echo -e "\n=== Checking for existing loot systems ==="
rg -i "loot|drop|reward" scripts/ --type gml | grep -v "scr_loot_table" | head -20

# Verify find_loot function usage
echo -e "\n=== Checking find_loot usage ==="
ast-grep --pattern 'find_loot($$$)'

Comment on lines +52 to +73
if (has_tag("xenos")){
loot.base = 4;
} else if has_tag("heavy_ranged"){
loot.base = 75;
}else if has_tag("plasma"){
loot.base = 75;
}else if has_tag("energy"){
loot.base = 75;
}

if (has_tag("dreadnought")){
loot.base = 7;
} else if (has_tag("vehicle")){
loot.base = 9;
}


if has_tag("terminator"){
loot.base = 10;
}else if has_tag("ancient"){
loot.base = 5;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Warning: Loot value override cascade detected.

Your machine logic contains multiple separate if-else chains that can overwrite previous loot.base values. For example, an item with tags ["heavy_ranged", "terminator"] will have its loot.base set to 75, then overwritten to 10.

Consider consolidating into a single priority-based logic chain:

-    if (has_tag("xenos")){
-        loot.base = 4;
-    } else if has_tag("heavy_ranged"){
-        loot.base = 75;
-    }else if has_tag("plasma"){
-        loot.base = 75;
-    }else if has_tag("energy"){
-        loot.base = 75;
-    }
-
-    if (has_tag("dreadnought")){
-        loot.base = 7;
-    } else  if (has_tag("vehicle")){
-        loot.base = 9;
-    }
-
-
-    if has_tag("terminator"){
-        loot.base = 10;
-    }else if has_tag("ancient"){
-        loot.base = 5;
-    }
+    // Priority-based loot value assignment
+    if (has_tag("xenos")){
+        loot.base = 4;
+    } else if (has_tag("terminator")){
+        loot.base = 10;
+    } else if (has_tag("dreadnought")){
+        loot.base = 7;
+    } else if (has_tag("vehicle")){
+        loot.base = 9;
+    } else if (has_tag("ancient")){
+        loot.base = 5;
+    } else if (has_tags(["heavy_ranged", "plasma", "energy"])){
+        loot.base = 75;
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (has_tag("xenos")){
loot.base = 4;
} else if has_tag("heavy_ranged"){
loot.base = 75;
}else if has_tag("plasma"){
loot.base = 75;
}else if has_tag("energy"){
loot.base = 75;
}
if (has_tag("dreadnought")){
loot.base = 7;
} else if (has_tag("vehicle")){
loot.base = 9;
}
if has_tag("terminator"){
loot.base = 10;
}else if has_tag("ancient"){
loot.base = 5;
}
// Priority-based loot value assignment
if (has_tag("xenos")) {
loot.base = 4;
} else if (has_tag("terminator")) {
loot.base = 10;
} else if (has_tag("dreadnought")) {
loot.base = 7;
} else if (has_tag("vehicle")) {
loot.base = 9;
} else if (has_tag("ancient")) {
loot.base = 5;
} else if (has_tags(["heavy_ranged", "plasma", "energy"])) {
loot.base = 75;
}
🤖 Prompt for AI Agents
In scripts/scr_equipment_struct/scr_equipment_struct.gml around lines 52 to 73,
multiple separate if-else chains set loot.base independently, causing later
conditions to overwrite earlier values. Consolidate all tag checks into a single
if-else if chain ordered by priority so that only the highest priority tag sets
loot.base once, preventing unintended overrides.


var _exclusives = struct_exists(loot_data ,"exclusives") ? loot_data.exclusives : false;

var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multiplyers : false;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Typographical error in struct access.

The sacred texts spell it "multipliers", not "multiplyers".

-	var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multiplyers : false;
+	var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multipliers : false;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var _mults = struct_exists(loot_data ,"multipliers") ? loot_data.multiplyers : false;
var _mults = struct_exists(loot_data, "multipliers") ? loot_data.multipliers : false;
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 10, there is a typo in the
struct field name "multiplyers". Change it to the correct spelling "multipliers"
to properly access the struct field.


var _loot_value = _item.loot.base;
for (var t = 0;t<array_length(_loot_tags);t++){
if (struct_exists(_item, _loot_tags[t])){
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incorrect struct property check on EquipmentStruct.

The loot tags should be checked within the loot struct, not the item itself.

-			if (struct_exists(_item, _loot_tags[t])){
+			if (struct_exists(_item.loot, _loot_tags[t])){
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (struct_exists(_item, _loot_tags[t])){
if (struct_exists(_item.loot, _loot_tags[t])){
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 51, the code incorrectly
checks for loot tags on the _item struct instead of the loot struct. Modify the
condition to check if the loot struct contains the _loot_tags[t] property rather
than the _item struct, ensuring the property check targets the correct data
structure.

return {};
}
var _final_loot = {};
var _chosen_loot_val = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing semicolon violates sacred syntax.

The Omnissiah demands proper punctuation.

-	var _chosen_loot_val = 0
+	var _chosen_loot_val = 0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var _chosen_loot_val = 0
var _chosen_loot_val = 0;
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 80, the variable
declaration for _chosen_loot_val is missing a semicolon at the end. Add a
semicolon after the assignment to properly terminate the statement and comply
with syntax requirements.

var _specific_loot_data = _possible_loots[$ _lootn];
if (_new_loot>= _specific_loot_data[0] && _new_loot<_specific_loot_data[1]){
var _chosen_piece = _lootn;
var _loot_val = max(100-(_specific_loot_data[1] - _specific_loot_data[0]),1);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Flawed loot value calculation logic.

The calculation 100-(_specific_loot_data[1] - _specific_loot_data[0]) produces incorrect values. The difference represents the loot weight, not a value to subtract from 100.

-				var _loot_val = max(100-(_specific_loot_data[1] - _specific_loot_data[0]),1);
+				var _loot_val = _specific_loot_data[1] - _specific_loot_data[0];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var _loot_val = max(100-(_specific_loot_data[1] - _specific_loot_data[0]),1);
var _loot_val = _specific_loot_data[1] - _specific_loot_data[0];
🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 88, the loot value
calculation incorrectly subtracts the loot weight difference from 100, which is
logically flawed. Instead, revise the calculation to directly use the loot
weight or an appropriate formula that reflects the intended loot value without
subtracting the difference from 100. Adjust the expression to correctly
represent the loot value based on the weight data in _specific_loot_data.

}
}

var _loot_value = _item.loot.base;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential null reference accessing loot.base.

If the item lacks a loot property, this will fail. Add defensive checks.

+		if (!struct_exists(_item, "loot") || !struct_exists(_item.loot, "base")) continue;
 		var _loot_value = _item.loot.base;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In scripts/scr_loot_table/scr_loot_table.gml at line 49, the code accesses
_item.loot.base without verifying if _item.loot exists, which can cause a null
reference error. Add a check to confirm that _item.loot is not null or undefined
before accessing its base property, and handle the case where loot is missing
appropriately to prevent runtime errors.

@github-actions
Copy link
Contributor

This PR is marked as stale, because it has been open for 7 days with no activity.

@github-actions github-actions bot added the Status: Stale No activity for more than a week label Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Sprites Changes to sprites/images or their under-the-hood functionality Size: Big Status: Stale No activity for more than a week Type: Feature Adds something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant