From 7fbe2f98ce7be63b90140f7eccf214cedd87e7fc Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 6 Jan 2017 01:25:49 +0100 Subject: [PATCH] Don't delay setting inventory stuff --- mods/craftingpack/crafting/creative.lua | 4 +--- mods/craftingpack/crafting/init.lua | 30 ++++++++++--------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/mods/craftingpack/crafting/creative.lua b/mods/craftingpack/crafting/creative.lua index 0cee379c9..b19f83f8e 100644 --- a/mods/craftingpack/crafting/creative.lua +++ b/mods/craftingpack/crafting/creative.lua @@ -221,9 +221,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end if fields.suche ~= nil and fields.suche ~= "" then set_inv(string.lower(fields.suche)) - minetest.after(0.5, function() - minetest.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec()) - end) + minetest.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec()) end if fields.build then diff --git a/mods/craftingpack/crafting/init.lua b/mods/craftingpack/crafting/init.lua index d3f3770e3..2c0518714 100644 --- a/mods/craftingpack/crafting/init.lua +++ b/mods/craftingpack/crafting/init.lua @@ -54,10 +54,8 @@ end local function set_inventory(player) if minetest.setting_getbool("creative_mode") then - minetest.after(0.5,function() - crafting.set_creative_formspec(player, 0, 1) - return - end) + crafting.set_creative_formspec(player, 0, 1) + return end player:get_inventory():set_width("craft", 2) player:get_inventory():set_size("craft", 4) @@ -148,23 +146,19 @@ minetest.register_on_joinplayer(function(player) player:get_inventory():set_size("main", 36) --set hotbar size - if player.hud_set_hotbar_itemcount then - minetest.after(0.5, player.hud_set_hotbar_itemcount, player, 9) - end + player:hud_set_hotbar_itemcount(9) --add hotbar images - minetest.after(0.5,function() - player:hud_set_hotbar_image("crafting_hotbar.png") - player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png") + player:hud_set_hotbar_image("crafting_hotbar.png") + player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png") - if show_armor then - local armor_orginal = armor.set_player_armor - armor.set_player_armor = function(self, player) - armor_orginal(self, player) - update_armor(player) - set_inventory(player) - end + if show_armor then + local armor_orginal = armor.set_player_armor + armor.set_player_armor = function(self, player) + armor_orginal(self, player) + update_armor(player) + set_inventory(player) end - end) + end end) minetest.register_node("crafting:workbench", {