Fix armor page being the default in creative

This commit is contained in:
Wuzzy 2017-03-09 19:15:09 +01:00
parent 10db71320e
commit 716404cdbd
1 changed files with 8 additions and 3 deletions

View File

@ -148,7 +148,6 @@ end)
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
--init inventory --init inventory
set_inventory(player)
player:get_inventory():set_width("main", 9) player:get_inventory():set_width("main", 9)
player:get_inventory():set_size("main", 36) player:get_inventory():set_size("main", 36)
@ -159,14 +158,20 @@ minetest.register_on_joinplayer(function(player)
player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png") player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png")
if show_armor then if show_armor then
local armor_orginal = armor.set_player_armor local set_player_armor_original = armor.set_player_armor
local update_inventory_original = armor.update_inventory
armor.set_player_armor = function(self, player) armor.set_player_armor = function(self, player)
armor_orginal(self, player) set_player_armor_original(self, player)
update_armor(player) update_armor(player)
end
armor.update_inventory = function(self, player)
update_inventory_original(self, player)
set_inventory(player, true) set_inventory(player, true)
end end
end end
set_inventory(player)
--[[ Make sure the crafting grid is empty. Why? Because the player might have --[[ Make sure the crafting grid is empty. Why? Because the player might have
items remaining in the crafting grid from the previous join; this is likely items remaining in the crafting grid from the previous join; this is likely
when the server has been shutdown and the server didn't clean up the player when the server has been shutdown and the server didn't clean up the player