fix: Ruins reward compile error#973
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughBy the Omnissiah’s will: The script scr_ruins_reward.gml now calls scr_orbiting_player_fleet with star_system. Conditional syntax corrected. Loot comparisons converted to equality operators. Reflects an API change: scr_orbiting_player_fleet(star_system). Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (5)
scripts/scr_ruins_reward/scr_ruins_reward.gml (5)
25-30: Exorcise assignment-in-conditional heresy (== vs =); prevents bad logic and compile woesSeveral conditionals still use = instead of ==, causing state corruption and/or parser failure. Purge with the following:
- if ((loot=="wild_card")){ - if (ruins_type=1) then loot="gene_seed";// - if (ruins_type=2) then loot="req";// - if (ruins_type=6) then loot="gear";// + if ((loot=="wild_card")){ + if (ruins_type==1) then loot="gene_seed";// + if (ruins_type==2) then loot="req";// + if (ruins_type==6) then loot="gear";// if (ruins_type>=10) then loot="req";// } ... -else if (loot="stc"){ +else if (loot=="stc"){ ... -else if (loot="gear"){ +else if (loot=="gear"){ ... -else if (ruins_type=3){ +else if (ruins_type==3){ ... -else if (ruins_type=4){ +else if (ruins_type==4){ ... -else if (ruins_type=5){ +else if (ruins_type==5){ ... -else if (ruins_type=6){ +else if (ruins_type==6){ ... -else if (loot="gene_seed"){// Requisition +else if (loot=="gene_seed"){// Requisition ... -else if (loot="bunker"){// Bunker +else if (loot=="bunker"){// Bunker ... -else if (loot="fortress"){// Fortress +else if (loot=="fortress"){// Fortress ... -else if (loot="starship"){// Starship +else if (loot=="starship"){// StarshipAlso applies to: 73-81, 101-101, 120-120, 139-139, 159-159, 194-194, 205-205, 215-215, 227-227
90-95: Remove trailing commas and fix statement terminators; compiler appeasement requiredTrailing commas in choose() and an extra semicolon will halt compilation; a few lines also miss semicolons (consistency + style).
- wen2=choose(1,2,); + wen2=choose(1,2); ... - wep4=choose("Assault Cannon","Plasma Cannon",); + wep4=choose("Assault Cannon","Plasma Cannon"); ... - wep3=choose("Mars Plasma Cannon","Volkite Culverin",); + wep3=choose("Mars Plasma Cannon","Volkite Culverin");- wen5=choose(0,1) + wen5=choose(0,1);- wen5=choose(0,1) + wen5=choose(0,1);- wen5=choose(0,1) + wen5=choose(0,1);- var gene=floor(random_range(20,40))+1,pop=instance_create(0,0,obj_popup);; + var gene=floor(random_range(20,40))+1,pop=instance_create(0,0,obj_popup);Also applies to: 125-126, 111-111, 130-130, 149-149, 206-206
179-187: Guard against empty items; avoid adding null relicsFor cases where ruins_type falls outside handled ranges (e.g., 7–9), this avoids injecting empty items.
- scr_add_item(wep1,wen1); - scr_add_item(wep2,wen2); - scr_add_item(wep3,wen3); - scr_add_item(wep4,wen4); - scr_add_item(wep5,wen5); - scr_add_item(wep6,wen6); - scr_add_item(wep7,wen7); - scr_add_item(wep8,wen8); + var _weps = [wep1, wep2, wep3, wep4, wep5, wep6, wep7, wep8]; + var _wens = [wen1, wen2, wen3, wen4, wen5, wen6, wen7, wen8]; + for (var i = 0; i < array_length(_weps); i++) { + if ((_wens[i] > 0) && (_weps[i] != "")) { + scr_add_item(_weps[i], _wens[i]); + } + }
223-223: Polish user-facing catechism (grammar tidy)Minor text fixes for immersion and clarity.
- pop.text="Praise the Emperor! We have found a massive, ancient fortress in needs of repairs. The gun batteries are rusted, and the walls are covered in moss with huge hole in it. Such a pity that such a majestic building is now a pale shadow of its former glory. It is possible to repair the structure. What is thy will?"; + pop.text="Praise the Emperor! We have found a massive, ancient fortress in need of repairs. The gun batteries are rusted, and the walls are covered in moss with a huge hole in it. Such a pity that such a majestic building is now a pale shadow of its former glory. It is possible to repair the structure. What is thy will?";
34-40: Imperative: Align recursive API call by passing thesystemargument
The Machine-Spirit detects one remaining no-argument invocation ofscr_orbiting_player_fleetwithin its own definition. To honour the updated signature, this recursive call must explicitly forwardsystem.• Update in scripts/scr_fleet_functions/scr_fleet_functions.gml around line 473:
function scr_orbiting_player_fleet(system = "none"){ … } else{ try{ - with (system){ - return scr_orbiting_player_fleet(); - } + with (system){ + return scr_orbiting_player_fleet(system); + } } catch(_exception){ handle_exception(_exception); }• After this change, re-run the sweep to confirm zero no-argument calls to
scr_orbiting_player_fleet().
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
scripts/scr_ruins_reward/scr_ruins_reward.gml(3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.gml
⚙️ CodeRabbit Configuration File
**/*.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
# 80bf40will crash the game.- All code should comply with the main GML documentation: https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Reference/GML_Reference.htm
Files:
scripts/scr_ruins_reward/scr_ruins_reward.gml
**/*.*
⚙️ CodeRabbit Configuration File
**/*.*: - 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.
Files:
scripts/scr_ruins_reward/scr_ruins_reward.gml
🔇 Additional comments (1)
scripts/scr_ruins_reward/scr_ruins_reward.gml (1)
45-55: Proper equality rites applied to loot checksThe switch to loot == "req"/"artifact" is correct and prevents accidental assignment in conditionals.
Purpose and Description
Testing done
Related things and/or additional context