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

"Armor not initialized!" when 3d_armor is part of a game #114

Closed
dacmot opened this issue Oct 20, 2023 · 4 comments
Closed

"Armor not initialized!" when 3d_armor is part of a game #114

dacmot opened this issue Oct 20, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@dacmot
Copy link

dacmot commented Oct 20, 2023

Hi. I'm one of the WhyNot? game maintainers and we've noticed a problem with 3d_armor recently (minetest-whynot/whynot-game#169)

The first player to immediately join a new game (first time only, singleplayer or hosted), the armor tab in the inventory says "Armor not initialized!" Quitting and joining again fixes it, but it's still annoying.

This it not specific to WhyNot. I was able to reproduce it by copying 3d_armor into minetest_game/mods, as well as simply enabling 3d_armor on a new MTG world before joining.

I've tracked it down to the init_player_armor function at

	armor.def[name] = {
		init_time = minetest.get_gametime(),

Where minetest.get_gametime() is probably 0 when you first join a new world.

I found a quick workaround by using minetest.after(1 in init.lua:

minetest.register_on_joinplayer(function(player)
	default.player_set_model(player, "3d_armor_character.b3d")
	local player_name = player:get_player_name()

	minetest.after(0, function()
		-- TODO: Added in 7566ecc - What's the prupose?
		local pplayer = minetest.get_player_by_name(player_name)
		if pplayer and init_player_armor(pplayer) == false then
			pending_players[pplayer] = 0
		end
	end)
end)

but given the TODO comment, I thought maybe this needs some deeper investigation.

@BuckarooBanzay BuckarooBanzay added the bug Something isn't working label Oct 21, 2023
@BuckarooBanzay
Copy link
Member

thanks for reporting that 👍

i tried to clean up that mess a bit in #115 let me know if that works for you

@BuckarooBanzay BuckarooBanzay changed the title "Armor not uninitialized!" when 3d_armor is part of a game "Armor not initialized!" when 3d_armor is part of a game Oct 21, 2023
@dacmot
Copy link
Author

dacmot commented Oct 21, 2023

I'll take a look. Thanks!

@dacmot dacmot mentioned this issue Oct 23, 2023
@dacmot
Copy link
Author

dacmot commented Oct 23, 2023

As mentioned in the PR, it looks good!

@Niklp09
Copy link
Member

Niklp09 commented Oct 28, 2023

Should not happen anymore since the code was removed in 3660e50. As always, re-open if needed.

@Niklp09 Niklp09 closed this as completed Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants