Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EID:setModIndicatorName for the very last mod loaded can be overrided #466

Open
kohashiwakaba opened this issue May 18, 2022 · 2 comments
Open

Comments

@kohashiwakaba
Copy link
Contributor

No description provided.

@kohashiwakaba kohashiwakaba changed the title EID:setModIndicatorName for the very last mod loaded can be overrived EID:setModIndicatorName for the very last mod loaded can be overrided May 18, 2022
@kohashiwakaba
Copy link
Contributor Author

Sorry for no explanations, EID mod indicator updates when 'RegisterMod' is called, so EID can track which item is connected from certain mod
But when the last 'RegisterMod' is called, EID does not cleanup 'current mod'(EID._currentMod). Normally, this wouldn't be the problem as most descriptions are registered on init.

The problem goes to after that. 'current mod' is still pointed at the last mod. If a certain mod updates the descriptions, or change mod indicator AFTER the init, EID changes those from the last mod, NOT original mod that called update function, which can result this:
20220519100352_1

to fix this temporarily:

For Player: Just activate this mod. No extra requirements needed.

For mod developer: Change EID._currentMod value to original mod's name before updating EID support. Not needed if the description does not change after the init

-- main.lua
wakaba = RegisterMod("Pudding and Wakaba", 1) -- Use this name for EID._currentMod

-- actual description update 
function wakaba:UpdateWakabaDescriptions()
	EID._currentMod = "Pudding and Wakaba" -- This is needed if the description updates 'AFTER' init. (like PostGameStarted)
	EID:addEntity(wakaba.INVDESC_TYPE_CURSE, -1, -1, "Curses")
	EID:setModIndicatorName("Pudding & Wakaba")
	EID:setModIndicatorIcon("Player"..wakaba.PLAYER_WAKABA.."", true)
	for cardid, carddata in pairs(wakaba.descriptions["en_us"].cards) do
		if carddata.mimiccharge then
			EID:addCardMetadata(cardid, carddata.mimiccharge, carddata.isrune)
		end
	end
end

@Buurazu
Copy link
Collaborator

Buurazu commented May 19, 2022

I ran into this problem with adding glitched item descriptions but just made glitched items never check for mod indicator stuff
I don't know the best time to wipe the current mod var

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants