Skip to content

RICS + Combat Extended Ammo Categories Analysis #42

Description

@ekudram

RICS + Combat Extended Ammo Categories Analysis

Purpose

This document analyzes the challenges of consolidating all Combat Extended (CE) ammo categories into one spot within RICS Store Items. It is based on examination of:

Author Note: Aligns closely with your assessment — changing defs risks breakage, and sorting hundreds of categories is difficult due to lack of clean identifiers.

RICS Store Items Overview

RICS dynamically detects items from active mods using ThingDefs, thingCategories, and other XML data. This populates:

  • In-game Store Editor
  • Exported StoreItems.json (used by your GitHub pricelist site: RICS-Pricelist)
  • Viewer purchase system (gear, ammo, etc. for pawns)

Ammo from CE is auto-included as individual items or via categories, but CE's structure makes broad consolidation non-trivial.

Combat Extended Ammo Structure

CE defines ammo in files like:

  • Defs/ThingDefs_Items/Items_Resource_Ammo.xml
  • Other Defs folders for weapons, projectiles, recipes, etc.

Key Characteristics

  • Hundreds of ThingDefs: Across calibers (rifle, pistol, shotgun, grenade, rocket, charge, etc.), tech levels (Neolithic, Industrial, Spacer), and variants (FMJ, AP, HP, Incendiary, HE, EMP, etc.).
  • thingCategories: Heavily used for compatibility (e.g., AmmoRifle, AmmoPistol, generic ammo sets). Weapons reference these for loading/crafting.
  • Examples from CE Defs:
    • Resources like Prometheum, FSX (explosives).
    • Specific ammo with unique defName, label, statBases, comps (e.g., explosive properties).
  • Dependencies: Ammo categories drive:
    • Weapon ammo switching
    • Crafting at loading benches
    • Pawn loadouts, trader stock, spawning
    • Mod compatibility (HAR, Vanilla Expanded, etc.)

Why Consolidation is Difficult

1. Risk of Breaking CE (and Dependent Mods)

  • Core Dependency: CE weapons and systems rely on specific categories to identify compatible ammo. Overriding or merging categories in RICS (or a patch) could:
    • Break ammo loading for weapons.
    • Disrupt recipes, spawning, and balance.
    • Cause null references or crashes in heavy modlists (~300 mods).
  • RICS auto-detection respects vanilla/CE defs. Direct changes to CE defs (even via patch) risk incompatibility, especially since CE is actively maintained.
  • Your pricelist/StoreItems flow would propagate errors to viewers.

2. Fragmentation and Lack of Identifiers

  • No Easy Grouping Markers:
    • DefNames/Labels vary widely (no universal prefix like "CE_Ammo_" for all relevant items).
    • No consistent "component factor" or shared tags.
    • Categories spread across multiple XML files, not one neat bundle.
  • Scale: Dozens-to-hundreds of entries. Manual sorting or regex filtering in RICS C# code (or JSON post-processing) would be error-prone and require ongoing maintenance with CE updates.
  • RICS's strength is broad auto-detection — forcing everything into "one spot" fights against CE's granular design.

3. Technical Implications for RICS

  • Store system pulls from ThingDefs dynamically. Custom Harmony patches or extended category filters could help, but add complexity (null checks, compatibility testing).
  • GitHub pricelist (StoreItems.json) would need custom JS filtering or manual curation.
  • Viewer commands (!buy ammo, etc.) could become confusing if categories are merged poorly.

Recommendations

  1. Avoid Direct Def Changes: Use RICS settings or a dedicated compatibility patch that adds a new "virtual" category for store purposes only (without altering CE behavior).
  2. Filtering Approach:
    • In RICS C#: Detect CE by package ID, then filter ThingDefs containing "Ammo" in defName/label or specific known categories.
    • Group into broader store buckets (e.g., "CE Ammo - Rifles", "CE Explosives").
  3. Generic Ammo Helpers: Leverage CE's built-in generic ammo options or community patches for simplification.
  4. Testing: Prototype in a minimal load order. Use your local AI chatbot integration for game state testing.
  5. Future-Proofing: Document in RICS wiki; consider configurable "ammo grouping rules" in settings.

Conclusion

Consolidation is feasible with careful coding but not simple due to breakage risk and identification challenges. Prioritize compatibility over perfect unification.

Sources: Direct repo inspection + RICS release notes on StoreItems.

Last Updated: 2026-07-05

Metadata

Metadata

Assignees

Labels

CompatibilityCompatibility issueswontfixThis will not be worked on

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions