Skip to content

Ring editor: Add "All Equipment" checkbox for NPC customization#788

Draft
Copilot wants to merge 12 commits intocore4from
copilot/add-checkbox-select-equipment
Draft

Ring editor: Add "All Equipment" checkbox for NPC customization#788
Copilot wants to merge 12 commits intocore4from
copilot/add-checkbox-select-equipment

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

NPCs in the Ring editor are restricted to narrow race/type-specific equipment subsets. This adds a toggle to unlock all outfits across races, expanded weapon selection within combat category, and all 8 color slots.

Equipment expansion

  • Merged outfit palette (r2_all_equipment) built at init from all equipment palettes, deduped by itemFile, with explicit "None" entry per slot
  • Per-combat-category weapon palettes (r2_all_weapons_melee, r2_all_weapons_magic, etc.) — weapons can't be fully merged since melee/range/magic drive SheetModel selection
  • getEffectiveEquipmentId(instance, slotName) routes lookups to the appropriate merged palette when toggle is active

Persistence & undo

  • UseAllEquipment property on NpcCustom class, persisted to object tree
  • Toggle groups all property changes (flag + any equipment reversions on toggle-off) into a single undo action via requestNewAction/requestEndAction with selectEquipmentSet flag, same pattern as randomEquipment():
r2.requestNewAction(...)
r2.selectEquipmentSet = true
r2:setNpcAttribute(id, "UseAllEquipment", val)
r2:updateEquipment(selection, false, true)  -- skipLinkColor
r2.selectEquipmentSet = false
r2.requestEndAction()
  • updateEquipment gains skipLinkColor param to prevent linkColor() from creating additional undo entries when called from the toggle path

Color range

  • getColorSliderMax() returns max index 7 (8 colors) when toggle is active or LevelDesignEnabled is set, consolidating three inline checks

Bug fixes

  • unpacktable.unpack in r2_ui_property_sheet.lua:1700 (Lua 5.2+)
  • Guard getSheetId("") in updatePieceEquipment — "None" entries have empty itemFile
  • Guard table.insert(eventArgs, nil) in property sheet setter
Original prompt

This section details on the original issue you should resolve

<issue_title>Add checkbox to enable selecting any equipment on NPC</issue_title>
<issue_description>In the Ryzom Ring editor, currently, different NPCs are limited to very narrow subsets of equipment. This is fine for common use, since it makes the NPCs recognizable to players. However, it leaves limited options for special NPCs.

Add a checkbox in the NPC editor to enable selecting any equipment on NPC.

Care to be taken - melee, range, and magic weapons still need to be kept separately, because they require different action profiles. So, we'd have the full set of outfits available, and the appropriate largest subset of weapons and such.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 17, 2026 12:55
…t across all races

- Add checkbox UI element in the equipment section of the NPC editor (r2ed.xml)
- Build a merged 'all equipment' palette combining outfit items from all race/type palettes
- When enabled, outfit combo boxes (helmet, chest, legs, boots, gloves, arms) show all items
- Weapons (hands) remain filtered by NPC type since melee/range/magic need different profiles
- Reset checkbox state when selecting a new NPC
- Add fallback lookups for item index-to-text mapping

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
… array iteration

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add checkbox to enable selecting any equipment on NPC Add checkbox to enable selecting any equipment on NPC in Ring editor Feb 17, 2026
Copilot AI requested a review from kaetemi February 17, 2026 12:59
Copilot AI and others added 2 commits February 17, 2026 13:29
…tion per combat category

1. Add UseAllEquipment property to NpcCustom class for persistence
2. Save/restore checkbox state via r2:setNpcAttribute (follows LinkColor pattern)
3. Handle UseAllEquipment in onAttrModified for undo/redo support
4. Build merged weapon palettes per combat category (melee/magic/healer/guard/civil)
5. When "all equipment" enabled, weapons combo shows all weapons for same combat type
6. Update weapon lookups (updateWeapons, updateAllPrivate, onAttrModified) to use effective equipment ID with fallback

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
…up pass

- Remove incorrect _equipment substring check that blocked all equipment IDs
- Extract weaponDedupKey helper function to avoid key construction duplication
- Remove redundant first-pass weapon category collection (was only storing booleans)
- Simplify to single-pass category discovery + single-pass weapon palette building

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title Add checkbox to enable selecting any equipment on NPC in Ring editor Add "All Equipment" checkbox to Ring editor NPC with persistence and expanded weapon selection Feb 17, 2026
Copilot AI and others added 3 commits February 18, 2026 14:15
In Lua 5.2+, 'unpack' was moved from global scope to 'table.unpack'.
This caused an 'attempt to call a nil value (global unpack)' error
when opening the customize look panel or selecting another NPC.

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
…all equipment enabled

1. Skip empty itemFile entries ("None") in buildAllEquipmentPalette to avoid
   getSheetId("") error (No matching overload found)
2. Protect updatePieceEquipment from calling getSheetId with empty string
3. Add getColorSliderMax() helper that returns 7 (8 choices) when either
   LevelDesignEnabled is set or all equipment mode is enabled
4. Update all color slider max consumers: initNpcEditor, toggleAllEquipment,
   updateAllPrivate, onAttrModified, randomColor, randomNPCEquipment

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title Add "All Equipment" checkbox to Ring editor NPC with persistence and expanded weapon selection Ring editor: Add "All Equipment" toggle for NPCs with expanded outfit/weapon/color selection Feb 18, 2026
…n all equipment mode

1. Guard against nil value in setter's table.insert to prevent
   "Inserting nil in table" warning when Properties panel is open
   and a different NPC is selected
2. Add "None" entry at the beginning of each merged outfit slot
   in buildAllEquipmentPalette so users can unequip items when
   "All Equipment" mode is enabled

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title Ring editor: Add "All Equipment" toggle for NPCs with expanded outfit/weapon/color selection Ring editor: Add "All Equipment" toggle for NPC customization Feb 18, 2026
Copilot stopped work on behalf of kaetemi due to an error February 18, 2026 14:57
The toggle was calling r2:setNpcAttribute which creates undo actions
via r2.requestSetNode. This trashed the undo stack every time the
checkbox was toggled.

Fix: Make the toggle purely UI-side state that only repopulates
the equipment combo boxes without modifying the NPC object tree.
- Remove UseAllEquipment property from NpcCustom class
- Remove r2:setNpcAttribute call from toggleAllEquipment
- Remove onAttrModified handler for UseAllEquipment
- Reset toggle to off when selecting a new NPC

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title Ring editor: Add "All Equipment" toggle for NPC customization Ring editor: Add "All Equipment" checkbox for NPC customization Feb 18, 2026
The toggle was previously either:
- Creating no undo entry (UI-only), or
- Creating multiple undo entries (one per equipment piece via linkColor reset)

Fix: toggleAllEquipment now calls requestNewAction once, then
setNpcAttribute for UseAllEquipment, then updateEquipment with
skipLinkColor=true to prevent linkColor() from creating additional
undo entries.

Also restores UseAllEquipment property on NpcCustom class and
onAttrModified handler for undo/redo support.

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title Ring editor: Add "All Equipment" checkbox for NPC customization Add "All Equipment" checkbox to Ring editor NPC customization Feb 18, 2026
When toggling off All Equipment, non-standard equipment is reverted
to allowed values. Previously this created separate undo entries for
each equipment piece change. Now all changes (UseAllEquipment toggle
+ equipment reversions) are grouped into a single undo action using
requestNewAction/requestEndAction with selectEquipmentSet flag,
following the same pattern as randomEquipment().

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title Add "All Equipment" checkbox to Ring editor NPC customization Ring editor: Add "All Equipment" checkbox for NPC customization Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add checkbox to enable selecting any equipment on NPC

2 participants