Legend_of_the_Invincibles icon indicating copy to clipboard operation
Legend_of_the_Invincibles copied to clipboard

Ways to play around with items in other add-ons

Open Discontinuum opened this issue 3 years ago • 4 comments

You mentioned one time that other add-ons may easily be allowed to introduce their own item types, modify the item list, etc. What means are there for it and what missing? I've seen one LotI-addon, a single player campaign, defining its own items by undefing {ITEM_LIST} macro and defining its own, but that's a tricky way and it doesn't allow to add instead of complete replacing.

And I'm a bit confused about the item list, at first I thought it's all setup by {GENERATE_ITEM_LIST} in the start event of global events but then it turned out there's a dataloader unit which is called from the lua code and which is hardcoded for current items, you said it's for saving replay space from item lists. So I'm a bit lost about exact machinery and possible ways of tweaking it for third-party addons

Discontinuum avatar Aug 18 '21 23:08 Discontinuum

You can override the loti.item.type global object with whatever you want to modify in the list of items.

Dugy avatar Aug 19 '21 00:08 Dugy

You can override the loti.item.type global object with whatever you want to modify in the list of items.

https://github.com/Dugy/Legend_of_the_Invincibles/blob/0313be43a834dc0b8157704e065e455ae368c415/lua/items.lua#L182 this part of the code won't bring LotI's standard ones back, will it?

Discontinuum avatar Aug 19 '21 22:08 Discontinuum

It won't if you assign some other function into loti.item.type._reload.

Dugy avatar Aug 19 '21 22:08 Dugy

Ah, I can override this object as a whole, and it's exposed and global. Then it's fine, yeah

Discontinuum avatar Aug 19 '21 22:08 Discontinuum