Skip to content

refactor: Move all equipment data to json#1108

Merged
EttyKitty merged 2 commits intoAdeptus-Dominus:mainfrom
EttyKitty:pr/equip-data
Feb 1, 2026
Merged

refactor: Move all equipment data to json#1108
EttyKitty merged 2 commits intoAdeptus-Dominus:mainfrom
EttyKitty:pr/equip-data

Conversation

@EttyKitty
Copy link
Collaborator

@EttyKitty EttyKitty commented Feb 1, 2026

Purpose and Description

  • Refactored equipment data from hardcoded script (scr_weapon) into four separate JSON files: armour.json, gear.json, mobility.json, and weapons.json
  • Removed the scr_weapon script file from the project
  • Added runtime initialization in __init_external.gml to load JSON data files into global variables: global.weapons and global.gear (containing nested armour, gear, and mobility objects)
  • Updated ChapterMaster.yyp project file to reference the new JSON data files instead of the removed script

Testing done

  • Launched a new game.

@github-actions github-actions bot added Area: JSON Changes to external JSON files or their under-the-hood functionality Size: Epic Type: Refactor Rewriting/restructuring code, while keeping general behavior labels Feb 1, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 1, 2026

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.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

Tech-Priest, this mandate restructures the war-engine's arsenal mechanisms. Four new JSON data codices (armour, gear, mobility, weapons) have been inscribed into the project manifest and integrated via runtime globals, whilst the obsolete scr_weapon manifest has been purged from the cogitator records.

Changes

Cohort / File(s) Summary
Project Manifest
ChapterMaster.yyp
Four new data file inclusions manifest (armour.json, gear.json, mobility.json, weapons.json); deprecated scr_weapon script reference expunged from IncludedFiles roster.
Data Codices
datafiles/data/armour.json, datafiles/data/gear.json, datafiles/data/mobility.json
Three new static JSON data repositories introduced, defining armour configurations, gear inventories, and mobility apparatuses respectively—each encoded with abbreviations, modifiers, tier variants (standard, master_crafted, artifact), descriptions, and categorical tags.
Runtime Initialisation
scripts/__init_external/__init_external.gml
Global data structures instantiated via json_to_gamemaker: global.weapons and nested global.gear object (containing armour, gear, mobility sub-structures), all consumed from the newly-inscribed JSON codices.
Legacy Script Severance
scripts/scr_weapon/scr_weapon.yy
Manifest metadata header completely excised; resource definition block removed.

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title correctly follows the conventional commits format with type and clear, concise summary well under 50 characters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description adequately follows the template with clear purpose, testing methodology, and contextual information aligned with the refactoring objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a790001 and 959edca.

📒 Files selected for processing (7)
  • ChapterMaster.yyp
  • datafiles/data/armour.json
  • datafiles/data/gear.json
  • datafiles/data/mobility.json
  • datafiles/data/weapons.json
  • scripts/__init_external/__init_external.gml
  • scripts/scr_weapon/scr_weapon.yy
💤 Files with no reviewable changes (1)
  • scripts/scr_weapon/scr_weapon.yy
🧰 Additional context used
📓 Path-based instructions (3)
**/*.gml

⚙️ CodeRabbit configuration file

  • All code should comply with the 2026 GML documentation.

Files:

  • scripts/__init_external/__init_external.gml
**/*.*

⚙️ CodeRabbit configuration file

**/*.*: - Code Philosophy: Prioritize explicit intent and maintainability over brevity. If a
solution is "clever" but mentally taxing, request a refactor to a clearer approach.

  • Variable Naming: Use clear, descriptive names; avoid over-abbreviation.

  • Abstraction: Apply the "Rule of Three"; suggest abstraction only when similar logic is
    repeated three or more times to avoid premature complexity.

  • Subjective Choices: For naming or architecture, ask guiding questions to prompt developer
    reflection and provide at least two alternative perspectives.

  • TODOs: If a TODO comment is added, ask the user if a GitHub issue should be created. If a
    TODO comment is deleted, remind the user to check the status of that specific issue.

Files:

  • scripts/__init_external/__init_external.gml
  • datafiles/data/mobility.json
  • ChapterMaster.yyp
  • datafiles/data/gear.json
  • datafiles/data/armour.json
**/*.json

⚙️ CodeRabbit configuration file

  • In this project, JSON files with comments are supported by the parser. It's allowed to use comments in JSON.

Files:

  • datafiles/data/mobility.json
  • datafiles/data/gear.json
  • datafiles/data/armour.json
🧠 Learnings (5)
📓 Common learnings
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 647
File: scripts/scr_en_weapon/scr_en_weapon.gml:24-928
Timestamp: 2025-03-29T10:30:25.598Z
Learning: A data-driven approach for weapon management in `scripts/scr_en_weapon/scr_en_weapon.gml` is planned for a future PR, not within the scope of PR `#647`.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: :0-0
Timestamp: 2025-04-05T20:58:21.881Z
Learning: In the ChapterMaster game, there's a need to refactor hardcoded item effects and move them to a "specials" property of items, following the pattern established with the `combi_tool` special. This improves code maintainability and makes effects more explicit in item definitions.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: :0-0
Timestamp: 2025-04-05T20:58:21.881Z
Learning: In the ChapterMaster game, there's a need to refactor hardcoded item effects and move them to a "specials" property of items, following the pattern established with the `combi_tool` special. This improves code maintainability and makes effects more explicit in item definitions.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 424
File: scripts/scr_flavor/scr_flavor.gml:34-36
Timestamp: 2025-03-09T02:33:43.867Z
Learning: EttyKitty prefers to keep PRs focused on their stated goals and scope, and may decline to implement otherwise valid suggestions if they're not directly related to the PR's primary objective.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 579
File: objects/obj_enunit/Alarm_0.gml:200-202
Timestamp: 2025-03-11T01:38:19.874Z
Learning: EttyKitty welcomes easy, committable suggestions that improve documentation of code chunks, variables with strange names, and functions. Their codebase is generally lacking documentation, but they prioritize human-readable code above documentation.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: sprites/spr_weapon_phobos_bolt_pistol/spr_weapon_phobos_bolt_pistol.yy:26-44
Timestamp: 2025-06-16T17:08:08.239Z
Learning: EttyKitty prefers automated solutions over manual cleanup for .yy file formatting and is open to automated tools for GameMaker Studio .yy file cleanup.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 938
File: scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml:478-478
Timestamp: 2025-07-21T17:03:28.251Z
Learning: EttyKitty acknowledges when PRs contain scope creep and agrees that changes should be focused on the stated PR objectives, reinforcing their preference for keeping PRs narrowly scoped to their primary purpose.
📚 Learning: 2025-03-29T10:30:25.598Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 647
File: scripts/scr_en_weapon/scr_en_weapon.gml:24-928
Timestamp: 2025-03-29T10:30:25.598Z
Learning: A data-driven approach for weapon management in `scripts/scr_en_weapon/scr_en_weapon.gml` is planned for a future PR, not within the scope of PR `#647`.

Applied to files:

  • scripts/__init_external/__init_external.gml
  • ChapterMaster.yyp
  • datafiles/data/gear.json
📚 Learning: 2025-06-16T17:12:13.045Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: scripts/scr_culture_visuals/scr_culture_visuals.gml:1256-1352
Timestamp: 2025-06-16T17:12:13.045Z
Learning: In scripts/scr_culture_visuals/scr_culture_visuals.gml, the weapon visual data declarations contain known DRY violations that are acknowledged by the development team but deferred to future refactoring efforts rather than addressed in individual feature PRs.

Applied to files:

  • scripts/__init_external/__init_external.gml
  • ChapterMaster.yyp
📚 Learning: 2025-03-20T22:22:57.319Z
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: :0-0
Timestamp: 2025-03-20T22:22:57.319Z
Learning: In the ChapterMaster game PR `#424`, the psychic power system was changed to be data-driven, with perils now able to occur on both successful and failed casts but with reduced frequency overall.

Applied to files:

  • ChapterMaster.yyp
📚 Learning: 2026-02-01T18:40:42.157Z
Learnt from: CR
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: docs/CODE_STYLE.md:0-0
Timestamp: 2026-02-01T18:40:42.157Z
Learning: Applies to docs/**/*.{gml,gml.json} : Follow the general GameMaker convention of using type prefixes in file names

Applied to files:

  • ChapterMaster.yyp
🪛 Biome (2.3.13)
datafiles/data/armour.json

[error] 26-26: Expected a property but instead found '// This is already a custom suit of armor shouldnt Master crafted be its base state?'.

Expected a property here.

(parse)


[error] 27-27: expected , but instead found "artifact"

Remove "artifact"

(parse)


[error] 530-531: Expected a property but instead found '// Hireling Armour'.

Expected a property here.

(parse)


[error] 532-532: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 532-532: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 536-537: Expected a property but instead found '// Might as well buff this'.

Expected a property here.

(parse)


[error] 537-537: expected , but instead found "master_crafted"

Remove "master_crafted"

(parse)


[error] 532-540: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 540-541: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 541-541: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 541-541: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 541-554: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 554-556: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 556-556: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 556-556: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 556-574: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 574-575: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 575-575: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 575-575: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 575-593: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 593-595: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 595-595: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 595-595: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 595-603: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 603-605: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 605-605: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 605-605: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 605-623: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 623-625: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 625-625: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 625-625: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 629-630: Expected a property but instead found '// TODO - needs rebalancing'.

Expected a property here.

(parse)


[error] 625-629: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 629-630: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 630-630: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 630-630: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 630-630: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 630-631: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 631-631: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 631-631: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 631-631: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 631-632: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 632-632: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 632-632: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 632-633: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 633-635: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

🔇 Additional comments (3)
ChapterMaster.yyp (1)

124-132: Tech-Priest: IncludedFiles update aligns with the new data codices.

The new JSON assets are correctly registered for packaging.

datafiles/data/gear.json (1)

108-109: Machine Spirit affirms: Key schema is canonically sound.

Inspection of the codebase reveals that spli and arp are the established, canonical property names—already integrated into EquipmentStruct (lines 44–45 of scr_equipment_struct.gml) and actively consumed by the combat resolver. Evidence of active use appears in scr_player_combat_weapon_stacks.gml (lines 31, 34) where these properties are extracted from weapon objects and applied to combat stacks. Further verification in scr_marine_struct.gml (lines 2381–2383) confirms these properties are read and propagated when constructing special weapon profiles.

The data in gear.json aligns with the established schema. No remediation required.

scripts/__init_external/__init_external.gml (1)

96-101: ⚠️ Potential issue | 🟠 Major

Tech-Priest: Fortify the sacred data-loading sequence against the corrupted archives.

The JSON files for weapons and gear-systems may lie absent or malformed within the data-vault. When json_to_gamemaker encounters such degradation, it yields undefined—a void-state from which the machine-spirit cannot recover. Downstream code performs direct struct-access upon these globals. Should they remain void, cascade-failure and system-corruption shall ensue.

The existing error-handling logs the malfunction through handle_exception, yet leaves no protective fallback. Defensive measures are warranted to prevent catastrophic runtime faults.

⚔️ Fortified initialisation sequence
-    global.weapons = json_to_gamemaker(working_directory + "\\data\\weapons.json", json_parse);
-    global.gear = {
-        "armour": json_to_gamemaker(working_directory + "\\data\\armour.json", json_parse),
-        "gear": json_to_gamemaker(working_directory + "\\data\\gear.json", json_parse),
-        "mobility": json_to_gamemaker(working_directory + "\\data\\mobility.json", json_parse),
-    };
+    global.weapons = json_to_gamemaker(working_directory + "\\data\\weapons.json", json_parse);
+    if (is_undefined(global.weapons)) {
+        global.weapons = {};
+        handle_exception({longMessage: "Weapons archive corrupted or void. Defaulting to empty dataset.", stacktrace: debug_get_stack_trace(dbg_all)});
+    }
+
+    var _armour_data = json_to_gamemaker(working_directory + "\\data\\armour.json", json_parse);
+    var _gear_data = json_to_gamemaker(working_directory + "\\data\\gear.json", json_parse);
+    var _mobility_data = json_to_gamemaker(working_directory + "\\data\\mobility.json", json_parse);
+
+    global.gear = {
+        "armour": is_undefined(_armour_data) ? {} : _armour_data,
+        "gear": is_undefined(_gear_data) ? {} : _gear_data,
+        "mobility": is_undefined(_mobility_data) ? {} : _mobility_data,
+    };
+    if (is_undefined(_armour_data) || is_undefined(_gear_data) || is_undefined(_mobility_data)) {
+        handle_exception({longMessage: "One or more gear-archives corrupted or void. Defaulted to empty structs.", stacktrace: debug_get_stack_trace(dbg_all)});
+    }
⛔ Skipped due to learnings
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 647
File: scripts/scr_en_weapon/scr_en_weapon.gml:24-928
Timestamp: 2025-03-29T10:30:25.598Z
Learning: A data-driven approach for weapon management in `scripts/scr_en_weapon/scr_en_weapon.gml` is planned for a future PR, not within the scope of PR `#647`.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: scripts/scr_culture_visuals/scr_culture_visuals.gml:1256-1352
Timestamp: 2025-06-16T17:12:13.045Z
Learning: In scripts/scr_culture_visuals/scr_culture_visuals.gml, the weapon visual data declarations contain known DRY violations that are acknowledged by the development team but deferred to future refactoring efforts rather than addressed in individual feature PRs.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 878
File: scripts/scr_culture_visuals/scr_culture_visuals.gml:1256-1352
Timestamp: 2025-06-16T17:12:13.045Z
Learning: In scripts/scr_culture_visuals/scr_culture_visuals.gml, the weapon visual data declarations contain known DRY violations that are acknowledged by the development team but deferred to future refactoring efforts rather than addressed in individual feature PRs.
Learnt from: EttyKitty
Repo: Adeptus-Dominus/ChapterMaster PR: 424
File: scripts/scr_powers/scr_powers.gml:13-14
Timestamp: 2025-03-13T06:18:06.719Z
Learning: The `json_to_gamemaker` function already contains built-in error handling with a try-catch block that properly handles file loading and parsing exceptions, making additional error handling unnecessary when using this function.
Learnt from: CR
Repo: Adeptus-Dominus/ChapterMaster PR: 0
File: docs/CODE_STYLE.md:0-0
Timestamp: 2026-02-01T18:40:42.157Z
Learning: Applies to docs/**/*.{gml,gml.json} : Local variables should have a `_` prefix (e.g., `var _player_health`), except for loop indices

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@EttyKitty EttyKitty merged commit 56272c6 into Adeptus-Dominus:main Feb 1, 2026
4 checks passed
@EttyKitty EttyKitty deleted the pr/equip-data branch February 1, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: JSON Changes to external JSON files or their under-the-hood functionality Size: Epic Type: Refactor Rewriting/restructuring code, while keeping general behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant