Skip to content

v1.4.1-alpha — reconciliation refactor + TLK strrefs 6-8

Choose a tag to compare

@Chrizhermann Chrizhermann released this 24 May 11:37
· 296 commits to main since this release
d847f00

This release closes two bugs and refactors the innate-grant subsystem in the process.

Fixed

  • Deleting a preset left an orphan F12 innate behind (#47, reported by MrFishHead on Discord). BfBot.Innate.Refresh's lightweight branch iterated only the config's preset list to add missing entries — it never iterated the sprite's known-innate list to remove BFBT entries whose preset had been deleted. After a DeletePreset, BFBT{slot}{deletedIdx} stayed in the F12 menu indefinitely. Rather than patch the gap with another condition, the whole innate-grant subsystem was refactored: three helpers (_HasInnate, _MaxAccumulation, _HasOrphans), the heavy/light bifurcation, and the dead Grant() function are replaced by one pure planner BfBot.Innate._PlanReconciliation(sprite, slot, config) plus a thin Refresh(slot) orchestrator. One iterator walk diffs actual-vs-desired and either revokes-all+regrants on any mismatch (duplicate or orphan) or grants-missing-only on clean state. Self-heals legacy saves with pre-existing orphans on first load after upgrade.
  • Presets 6, 7, and 8 showed "Invalid: " as their F12 innate name (#48). When MAX_PRESETS went from 5 to 8 in a51804e, the WeiDU installer was not updated — only strrefs 1-5 were registered, and the Lua side used _baseStrref + (preset - 1) arithmetic that assumed contiguity. setup-buffbot.tp2 now registers all 8 strrefs and writes each as its own line in bfbot_strrefs.txt; Lua reads them as an array indexed by preset. WeiDU does not guarantee contiguous strrefs across upgrades (existing strings keep their old strrefs while new ones get appended), so the array approach is more robust than the old arithmetic.

Internal

  • Pulled an inline AddSpecialAbility loop out of BfBotPer._CreateDefaultConfig (was leaking innate-grant mechanics into the persistence layer) and added a setOk guard against UDAux-write failure to prevent re-entry recursion.
  • New BfBot.Test.PlanReconciliation suite has nine cases covering nil/empty config, exact match, orphan detection, missing-desired, foreign-slot scoping, AddSpecialAbility dedup tripwire, and end-to-end opcode-172 removal via EEex_GameObject_ApplyEffect — synchronously verifies the cleanup mechanism removes orphans from the sprite's known-innate list (closes the gap that planner-only tests couldn't prove).
  • CLAUDE.md's "Innate re-grant pattern" invariant updated to describe the reconciliation shape and explicitly warn against reintroducing per-helper iterator walks.

Upgrade

Drop into your mod folder over a previous BuffBot install and run `setup-buffbot.exe` again. The first save load after upgrading will self-heal any pre-existing orphans via the new reconciliation branch.

Requires EEex v1.0.0 or later (unchanged from v1.4.0).