[Tools] update legacy json#264
Conversation
Replace direct "gold"/"silver" component references with "gold_small"/"silver_small" in multiple recipe files (Crystallized_mutations and expansion_tefnut reloading). Add fix_recipe_gold_silver_components to tools/update_legacy_json.py to automate conversion for recipe objects (skips non-recipe objects and obsolete recipes, and only edits components blocks), and register it in the TRANSFORMS pipeline.
Add downstream category tags to upstream mutation entries and a transformer to automate it. Many mutation JSON files were updated to include additional "category" values across multiple mods (Nechronica_Redux, Slys_Mighty_Morphin_Mutations, Diluted_Mutagens, Even_More_Mutations, Crystallized_mutations, Mutation_Changes, PKs_Rebalancing, kitsune, etc.). Introduce fix_mutation_category_chain in tools/update_legacy_json.py and register it in TRANSFORMS. The new function walks mutation objects in a file, follows their "changes_to" chains, collects category values from later mutations, and merges unique downstream categories into earlier mutations without removing existing data. It avoids copying IDs or other fields and handles cycles/safety. This ensures category metadata is propagated for compatibility and transforms legacy files consistently.
Delete legacy "bleed_resist" from mutation data and add a robust transformer to strip it from legacy JSON. Updated data/Unleash_The_Mods/.../mutations.json to remove the field and added fix_bleed_resist in tools/update_legacy_json.py with several regex cases to safely remove the field (trailing comma, last property, compact one-line objects) without disturbing surrounding commas or unrelated fields. The new function is registered in the TRANFORMS pipeline.
…once' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Expand single-line "category" arrays into multi-line arrays for readability and consistency across mutation files. Modified files: - data/Unleash_The_Mods/Broken_mods/Diluted_Mutagens/new_mutations.json - data/Unleash_The_Mods/Broken_mods/Even_More_Mutations/EMM_mutations.json - data/Unleash_The_Mods/mods/Crystallized_mutations/mutations.json No functional changes were made; only JSON formatting was adjusted.
…ding-Team/Community-Mod-Compilation-redux into Tools-update-legacy-json
Add and standardize activity_level fields across many recipe and uncraft JSON files: replace deprecated "fake" with "LIGHT_EXERCISE" or "MODERATE_EXERCISE" and add missing activity_level entries for uncraft definitions. This fixes validation and ensures consistent activity intensity settings for multiple mods (e.g. Private_Defense, ETC_handguns_etc, simple_additions, Miso_Touyou_Touhou, Salvaged_Robots, Tanks, TropiCataclysm, innawood, SD_Winterclothes, Maddre_Mod, Material_Plants, Wild_Living, and others). Also update tools/update_legacy_json.py to support the legacy JSON adjustments.
Replace legacy "amount"/"minamount" item fields with a "count" array and add a transform to automate this.
- data/.../furniture.json: update barrel/drum item entries to use "count": [1, 1] instead of "amount" and "minamount".
- tools/update_legacy_json.py: add fix_bash_items_amount_minamount() to find "bash" blocks and convert item objects ("amount": X, "minamount": Y) into "count": [Y, X]; register the new transform in the TRANSFORMS pipeline.
This normalizes item quantity representation to the modern "count" format while leaving other bash fields untouched.
Remove four obsolete comment lines ("originally result = dice(8, 4) - 8;") from furniture.json entries for barrels/drums. This is a cleanup of leftover legacy comments and does not change runtime behavior.
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
💡 Codex ReviewCommunity-Mod-Compilation-redux/tools/update_legacy_json.py Lines 2371 to 2376 in 3c9e706 The new ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
CodeAnt AI finished reviewing your PR. |
Register the new fix_ter_furn_fail_message transform in the TRANSFORMS list so legacy JSON updates include the terminal/furniture failure message fix. Placed before fix_bleed_resist to ensure correct transform ordering.
Introduce fix_console_broken_palette to update legacy palette entries: for objects with "type": "palette" it replaces terrain symbols referencing "t_console_broken" with the most common "floor" terrain in the same terrain block, and ensures corresponding furniture entries map that symbol to "f_console_broken". Implements helper parsing (matching braces/strings) and uses Counter to pick the replacement; gracefully skips when sections are missing. The new transform is added to the TRANSFORMS pipeline.
Treat map palette codepoint '6' as floor terrain and add corresponding f_console_broken furniture entries across multiple palettes. Moved/changed terrain mappings from t_console_broken to various floor types (t_floor, t_thconc_floor, t_concrete_floor, t_metal_floor, t_strconc_floor) and added "6": "f_console_broken" in furniture sections to restore broken-console objects. Files updated: data/Legacy_mods/Broken_mods/More_Locations/tpalettes.json, data/Legacy_mods/mods/National_Guard_Camp/palettes/national_guard_camp.json, data/Legacy_mods/mods/National_Guard_Camp/palettes/national_guard_camp_b.json, data/Legacy_mods/mods/Salvaged_Robots/robot_additions/tpalettes.json, data/Legacy_mods/mods/Urban_Development/mapgen_palettes/acidia_commercial_destroyed_palette.json, data/Legacy_mods/mods/Urban_Development/mapgen_palettes/acidia_commercial_palette.json, data/Legacy_mods/mods/Urban_Development/mapgen_palettes/acidia_residential_commercial_palette.json, data/Unleash_The_Mods/Broken_mods/Mapspecials/megastore/palettes.json, data/Unleash_The_Mods/Broken_mods/Mapspecials/missile_silo/palettes.json, data/Unleash_The_Mods/mods/Randomized_Mall/Mapgen/mall_palettes.json, data/Unleash_The_Mods/mods/Standalone_Salvaged_Robots/robot_additions/tpalettes.json. This aligns console objects with furniture semantics and ensures palettes reference appropriate floor tiles for terrain.
Refine fix_console_broken_palette: update docstring for clarity; use "t_floor" as a fallback when no common floor is found; perform terrain replacement accordingly. Adjust furniture insertion so symbols are added correctly whether the furniture object is empty or not, and preserve existing furniture entries.
Replace t_console_broken terrain entries with appropriate floor tiles and add f_console_broken to furniture palettes and location overrides. Updates in tpalettes.json, map_palletes.json, bankrupt_pizzeria.json, and vbuilding.json ensure the broken console is represented as furniture (f_console_broken) rather than as traversable terrain, and adjust map tile characters to use floor/linoleum where needed.
Replace incorrect terrain entries of t_console_broken with appropriate floor/metal/concrete tiles and add corresponding f_console_broken furniture mappings across multiple mapgen JSONs. This corrects consoles being defined as terrain (causing mapping inconsistencies) by converting those keys to proper floor tiles and registering the console as furniture so it spawns correctly. Changes touch numerous mapgen files across Legacy_mods, Maintained_mods, Unleash_The_Mods, and broken_mods (shops, labs, ships, ninja locations, etc.).
Enhance fix_console_broken_palette to support multiple console terrain IDs and array-valued terrain entries. Introduces a console_pairs mapping (t_console_broken->f_console_broken, t_console->f_console), a parse_entries helper to detect string or array terrain values, and make_furniture_value to format furniture entries. Replaces the previous global regex substitution with per-entry edits that: replace console terrain IDs with the most common floor terrain (excluding console IDs), add corresponding furniture entries (creating the furniture object if missing), and correctly handle terrain values provided as strings or arrays. Overall this makes the palette/overmap_terrain/mapgen update more robust for varied input formats.
Remove t_console / t_console_broken terrain definitions and convert map references to use floor tiles instead, moving consoles from terrain into furniture (f_console / f_console_broken). Updated palettes and many mapgen files (mods, labs, ships, missile silo, doomlab, Secronom maps, etc.) to reference appropriate floor variants (t_floor, t_thconc_floor, t_metal_floor, t_strconc_floor, etc.) and to place console furniture where needed. This fixes inconsistent console terrain usage and ensures consoles are represented as furniture across the affected maps.
Introduce three transformation functions to migrate legacy vehicle part symbol fields: fix_variant_from_symbol_broken_symbol (creates a variants entry from symbol/broken_symbol pairs if needed), fix_broken_symbol (removes the legacy "broken_symbol" field from vehicle_part objects), and fix_symbol (removes the legacy "symbol" field from vehicle_part objects). These operate on top-level object chunks (using _split_top_level_objects), only touch objects with "type": "vehicle_part", and avoid altering existing symbols/variants entries. Also register the new transforms in the pipeline and adjust the TRANSFORMS order (removing fix_ter_furn_fail_message from this location). The changes aim to convert legacy fields into the newer "variants" structure while preserving existing variant entries.
Replace legacy "symbol"/"broken_symbol" fields with the new "variants" array (containing symbols and symbols_broken) across multiple vehicle part JSONs to match the updated schema. Removes a few now-redundant standalone symbol entries (e.g. makeshift battery) and drops an obsolete broken_symbol in a turret copy-from. Affects many mod files (HeavyMining, Tanks, BlazeIndustries, More_Survivor_Stuff, Car_color_variation, and others) to ensure consistent vehicle part symbol handling.
|
Skipping CodeAnt AI review — this PR changes more than 100 files, which usually means a migration, codemod, or vendored drop. Line-level review on diffs this large produces duplicate findings on the same rewrite pattern and drowns out anything that actually matters. If you still want a review, comment |
Refactor fix_variant_from_symbol_broken_symbol to keep vehicle_part variants valid by ensuring variants include symbols_broken. Add a fill_symbols_broken_in_variants helper that adds a missing "symbols_broken" (defaulting to "#" when no broken_symbol is present) to flat variant objects that have "symbols". Also handle cases where the "variants" array is missing by creating a variants entry from existing "symbol"/"broken_symbol" fields, update insertion logic, and clarify the function docstring.
Replace legacy "symbol"/"broken_symbol" fields with the new "variants" array (using "symbols" and "symbols_broken") across multiple vehicle part definitions and the makeshift battery. Files updated include maintained and Unleash_The_Mods vehicle part JSONs (simple_additions/battery.json, Car_color_variation/vehicleparts.json, miso_Touhou/items/vehicle_parts.json, madd_vehicle_parts_override.json, secro_vehicleparts.json, robot_additions/vehicle_parts.json, vehicleparts/tanks.json). This normalizes symbol handling and enables proper broken-state rendering and future symbol variants.
Delete the explicit "charges-min" and "charges-max" (both set to 100) from the pur_tablets entries in data/Unleash_The_Mods/mods/TCW_Box/json/item_group.json (two occurrences). This removes the fixed-charge override so the item will use its default charge handling.
CodeAnt-AI Description
Refresh legacy JSON data and clean up outdated fields
What Changed
Impact
✅ Clearer crafting effort labels✅ Correct gold and silver recipe ingredients✅ More accurate mutation tagging✅ Fewer outdated JSON warnings💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.