server icon indicating copy to clipboard operation
server copied to clipboard

🔨 item lua files are cached after modules

Open MowFord opened this issue 1 year ago • 0 comments

I affirm:

  • [x] I understand that if I do not agree to the following points by completing the checkboxes my issue will be ignored.
  • [x] I have read and understood the Contributing Guide and the Code of Conduct.
  • [x] I have searched existing issues to see if the issue has already been opened, and I have checked the commit log to see if the issue has been resolved since my server was last updated.

Describe the feature

I didn't see an existing issue on this.

Currently, files in scripts/items are cached after all modules are executed. Perhaps I'm missing some core setting that would change the order, but best I can tell, it's just the way that the stack is built.

To test/confirm this I spent an inordinate amount of time diagnosing why my module overriding onItemEquip() required xi.module.ensureTable even though the file existed. And furthermore ensuring a subtable of xi.items.<itemName>.dummyPath would still lose the onItemUnequip() function. I believe it's due to the fact that item lua files are cached after all modules are processed and loaded with the table[sol::update_if_empty][part] = file_result; syntax, meaning that if a module creates the base item's path, it does nothing?

I wish I could say more for certain and provide a possible solution, but this is definitely well past my knowledge at present.

MowFord avatar Jan 05 '24 19:01 MowFord