Creative: Fix missing item bug caused by 'start_i' value
authortenplus1 <tenplus1@users.noreply.github.com>
Fri, 11 Nov 2016 12:09:11 +0000 (12:09 +0000)
committerparamat <mat.gregory@virginmedia.com>
Fri, 18 Nov 2016 05:38:25 +0000 (05:38 +0000)
This fixes the missing item issue in creative inventory caused by using
1 instead of 0 for 'start_i'.

mods/creative/init.lua

index d90426da0d60215e26de90e9fee04221ceb002b3..a6c74a29a60c10c649a377308014d4bf5e802b73 100644 (file)
@@ -10,7 +10,7 @@ creative.init_creative_inventory = function(owner)
        player_inventory[owner_name] = {
                size = 0,
                filter = "",
-               start_i = 1,
+               start_i = 0,
                tab_id = 2,
        }
 
@@ -187,7 +187,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
        elseif fields.creative_tabs then
                local tab = tonumber(fields.creative_tabs)
                inv.tab_id = tab
-               player_inventory[player_name].start_i = 1
+               player_inventory[player_name].start_i = 0
 
                if tab == 1 then
                        creative.set_crafting_formspec(player)
@@ -196,13 +196,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
                        creative.set_creative_formspec(player, 0)
                end
        elseif fields.creative_clear then
-               player_inventory[player_name].start_i = 1
+               player_inventory[player_name].start_i = 0
                inv.filter = ""
                creative.update_creative_inventory(player_name)
                creative.set_creative_formspec(player, 0)
        elseif fields.creative_search or
                        fields.key_enter_field == "creative_filter" then
-               player_inventory[player_name].start_i = 1
+               player_inventory[player_name].start_i = 0
                inv.filter = fields.creative_filter:lower()
                creative.update_creative_inventory(player_name)
                creative.set_creative_formspec(player, 0)