Minor code-style improvement and cleanup

This commit is contained in:
MoNTE48 2020-05-04 00:40:57 +02:00 committed by Maksim
parent eb96c89b5d
commit 52e146dee1
13 changed files with 164 additions and 168 deletions

View File

@ -11,8 +11,8 @@ minetest.after(0.01, function()
unified_inventory.items_list = {} unified_inventory.items_list = {}
for name, def in pairs(minetest.registered_items) do for name, def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or if (not def.groups.not_in_creative_inventory or
def.groups.not_in_creative_inventory == 0) and def.groups.not_in_creative_inventory == 0) and
def.description and def.description ~= "" then def.description and def.description ~= "" then
table.insert(unified_inventory.items_list, name) table.insert(unified_inventory.items_list, name)
local all_names = rev_aliases[name] or {} local all_names = rev_aliases[name] or {}
table.insert(all_names, name) table.insert(all_names, name)

View File

@ -1,8 +1,8 @@
--[[ --[[
Bags for Minetest Bags for Minetest
Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com> Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
License: GPLv3 License: GPLv3
--]] --]]
local S = minetest.get_translator("unified_inventory") local S = minetest.get_translator("unified_inventory")
@ -31,7 +31,7 @@ unified_inventory.register_button("bags", {
type = "image", type = "image",
image = "ui_bags_icon.png", image = "ui_bags_icon.png",
tooltip = S("Bags"), tooltip = S("Bags"),
hide_lite=true hide_lite = true
}) })
local function get_player_bag_stack(player, i) local function get_player_bag_stack(player, i)
@ -168,12 +168,12 @@ end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local bags_inv = minetest.create_detached_inventory(player_name .. "_bags",{ local bags_inv = minetest.create_detached_inventory(player_name .. "_bags",{
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, _, stack, player)
player:get_inventory():set_size(listname .. "contents", player:get_inventory():set_size(listname .. "contents",
stack:get_definition().groups.bagslots) stack:get_definition().groups.bagslots)
save_bags_metadata(player, inv) save_bags_metadata(player, inv)
end, end,
allow_put = function(inv, listname, index, stack, player) allow_put = function(_, listname, _, stack, player)
local new_slots = stack:get_definition().groups.bagslots local new_slots = stack:get_definition().groups.bagslots
if not new_slots then if not new_slots then
return 0 return 0
@ -207,13 +207,13 @@ minetest.register_on_joinplayer(function(player)
-- New bag is smaller: Disallow inserting -- New bag is smaller: Disallow inserting
return 0 return 0
end, end,
allow_take = function(inv, listname, index, stack, player) allow_take = function(_, listname, _, stack, player)
if player:get_inventory():is_empty(listname .. "contents") then if player:get_inventory():is_empty(listname .. "contents") then
return stack:get_count() return stack:get_count()
end end
return 0 return 0
end, end,
on_take = function(inv, listname, index, stack, player) on_take = function(inv, listname, _, _, player)
player:get_inventory():set_size(listname .. "contents", 0) player:get_inventory():set_size(listname .. "contents", 0)
save_bags_metadata(player, inv) save_bags_metadata(player, inv)
end, end,
@ -229,19 +229,19 @@ end)
minetest.register_tool("unified_inventory:bag_small", { minetest.register_tool("unified_inventory:bag_small", {
description = S("Small Bag"), description = S("Small Bag"),
inventory_image = "bags_small.png", inventory_image = "bags_small.png",
groups = {bagslots=8}, groups = {bagslots = 8},
}) })
minetest.register_tool("unified_inventory:bag_medium", { minetest.register_tool("unified_inventory:bag_medium", {
description = S("Medium Bag"), description = S("Medium Bag"),
inventory_image = "bags_medium.png", inventory_image = "bags_medium.png",
groups = {bagslots=16}, groups = {bagslots = 16},
}) })
minetest.register_tool("unified_inventory:bag_large", { minetest.register_tool("unified_inventory:bag_large", {
description = S("Large Bag"), description = S("Large Bag"),
inventory_image = "bags_large.png", inventory_image = "bags_large.png",
groups = {bagslots=24}, groups = {bagslots = 24},
}) })
-- register bag crafts -- register bag crafts
@ -270,6 +270,6 @@ if minetest.get_modpath("farming") ~= nil then
{"", "", ""}, {"", "", ""},
{"farming:string", "unified_inventory:bag_medium", "farming:string"}, {"farming:string", "unified_inventory:bag_medium", "farming:string"},
{"farming:string", "unified_inventory:bag_medium", "farming:string"}, {"farming:string", "unified_inventory:bag_medium", "farming:string"},
}, },
}) })
end end

View File

@ -27,14 +27,14 @@ minetest.register_on_joinplayer(function(player)
-- Refill slot -- Refill slot
local refill = minetest.create_detached_inventory(player_name.."refill", { local refill = minetest.create_detached_inventory(player_name.."refill", {
allow_put = function(inv, listname, index, stack, player) allow_put = function(_, _, _, stack)
if unified_inventory.is_creative(player_name) then if unified_inventory.is_creative(player_name) then
return stack:get_count() return stack:get_count()
else else
return 0 return 0
end end
end, end,
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, index, stack)
local handle_refill = (minetest.registered_items[stack:get_name()] or {}).on_refill or default_refill local handle_refill = (minetest.registered_items[stack:get_name()] or {}).on_refill or default_refill
stack = handle_refill(stack) stack = handle_refill(stack)
inv:set_stack(listname, index, stack) inv:set_stack(listname, index, stack)
@ -57,7 +57,7 @@ end
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local ui_peruser,draw_lite_mode = unified_inventory.get_per_player_formspec(player_name) local ui_peruser, _ = unified_inventory.get_per_player_formspec(player_name)
if formname ~= "" then if formname ~= "" then
return return
@ -69,7 +69,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
unified_inventory.current_searchbox[player_name] = fields.searchbox unified_inventory.current_searchbox[player_name] = fields.searchbox
end end
for i, def in pairs(unified_inventory.buttons) do for _, def in pairs(unified_inventory.buttons) do
if fields[def.name] then if fields[def.name] then
def.action(player) def.action(player)
minetest.sound_play("click", minetest.sound_play("click",
@ -120,7 +120,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- Check clicked item image button -- Check clicked item image button
local clicked_item local clicked_item
for name, value in pairs(fields) do for name, _ in pairs(fields) do
local new_dir, mangled_item = string.match(name, "^item_button_([a-z]+)_(.*)$") local new_dir, mangled_item = string.match(name, "^item_button_([a-z]+)_(.*)$")
if new_dir and mangled_item then if new_dir and mangled_item then
clicked_item = unified_inventory.demangle_for_formspec(mangled_item) clicked_item = unified_inventory.demangle_for_formspec(mangled_item)

View File

@ -92,4 +92,3 @@ Register a non-standard craft recipe:
width = 3, width = 3,
-- ^ Same as `minetest.register_recipe` -- ^ Same as `minetest.register_recipe`
}) })

View File

@ -115,7 +115,6 @@ local function compute_group_item(group_name_list)
return {item = bestitem, sole = false} return {item = bestitem, sole = false}
end end
local group_item_cache = {} local group_item_cache = {}
function unified_inventory.get_group_item(group_name) function unified_inventory.get_group_item(group_name)
@ -124,4 +123,3 @@ function unified_inventory.get_group_item(group_name)
end end
return group_item_cache[group_name] return group_item_cache[group_name]
end end

View File

@ -50,7 +50,7 @@ unified_inventory = {
-- Disable default creative inventory -- Disable default creative inventory
local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory") local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory")
if creative then if creative then
function creative.set_creative_formspec(player, start_i, pagenum) function creative.set_creative_formspec()
return return
end end
end end

View File

@ -1,14 +1,16 @@
local S = minetest.get_translator("unified_inventory") local S = minetest.get_translator("unified_inventory")
local F = minetest.formspec_escape local F = minetest.formspec_escape
-- This pair of encoding functions is used where variable text must go in --[[
-- button names, where the text might contain formspec metacharacters. This pair of encoding functions is used where variable text must go in
-- We can escape button names for the formspec, to avoid screwing up button names, where the text might contain formspec metacharacters.
-- form structure overall, but they then don't get de-escaped, and so We can escape button names for the formspec, to avoid screwing up
-- the input we get back from the button contains the formspec escaping. form structure overall, but they then don't get de-escaped, and so
-- This is a game engine bug, and in the anticipation that it might be the input we get back from the button contains the formspec escaping.
-- fixed some day we don't want to rely on it. So for safety we apply This is a game engine bug, and in the anticipation that it might be
-- an encoding that avoids all formspec metacharacters. fixed some day we don't want to rely on it. So for safety we apply
an encoding that avoids all formspec metacharacters.
]]
function unified_inventory.mangle_for_formspec(str) function unified_inventory.mangle_for_formspec(str)
return string.gsub(str, "([^A-Za-z0-9])", function (c) return string.format("_%d_", string.byte(c)) end) return string.gsub(str, "([^A-Za-z0-9])", function (c) return string.format("_%d_", string.byte(c)) end)
end end
@ -47,7 +49,6 @@ function unified_inventory.get_per_player_formspec(player_name)
end end
function unified_inventory.get_formspec(player, page) function unified_inventory.get_formspec(player, page)
if not player then if not player then
return "" return ""
end end
@ -93,7 +94,7 @@ function unified_inventory.get_formspec(player, page)
local filtered_inv_buttons = {} local filtered_inv_buttons = {}
for i, def in pairs(unified_inventory.buttons) do for _, def in pairs(unified_inventory.buttons) do
if not (draw_lite_mode and def.hide_lite) then if not (draw_lite_mode and def.hide_lite) then
table.insert(filtered_inv_buttons, def) table.insert(filtered_inv_buttons, def)
end end
@ -280,7 +281,7 @@ function unified_inventory.apply_filter(player, filter, search_dir)
local ffilter local ffilter
if lfilter:sub(1, 6) == "group:" then if lfilter:sub(1, 6) == "group:" then
local groups = lfilter:sub(7):split(",") local groups = lfilter:sub(7):split(",")
ffilter = function(name, def) ffilter = function(_, def)
for _, group in ipairs(groups) do for _, group in ipairs(groups) do
if not def.groups[group] if not def.groups[group]
or def.groups[group] <= 0 then or def.groups[group] <= 0 then

View File

@ -73,4 +73,3 @@ minetest.register_globalstep(function(dtime)
end end
end end
end) end)

View File

@ -3,26 +3,26 @@
-- according to the recipe. -- according to the recipe.
--[[ --[[
Retrieve items from inventory lists and calculate their total count. Retrieve items from inventory lists and calculate their total count.
Return a table of "item name" - "total count" pairs. Return a table of "item name" - "total count" pairs.
Arguments: Arguments:
inv: minetest inventory reference inv: minetest inventory reference
lists: names of inventory lists to use lists: names of inventory lists to use
Example usage: Example usage:
-- Count items in "main" and "craft" lists of player inventory -- Count items in "main" and "craft" lists of player inventory
unified_inventory.count_items(player_inv_ref, {"main", "craft"}) unified_inventory.count_items(player_inv_ref, {"main", "craft"})
Example output: Example output:
{ {
["default:pine_wood"] = 2, ["default:pine_wood"] = 2,
["default:acacia_wood"] = 4, ["default:acacia_wood"] = 4,
["default:chest"] = 3, ["default:chest"] = 3,
["default:axe_diamond"] = 2, -- unstackable item are counted too ["default:axe_diamond"] = 2, -- unstackable item are counted too
["wool:white"] = 6 ["wool:white"] = 6
} }
]]-- ]]
function unified_inventory.count_items(inv, lists) function unified_inventory.count_items(inv, lists)
local counts = {} local counts = {}
@ -47,23 +47,23 @@ function unified_inventory.count_items(inv, lists)
end end
--[[ --[[
Retrieve craft recipe items and their positions in the crafting grid. Retrieve craft recipe items and their positions in the crafting grid.
Return a table of "craft item name" - "set of positions" pairs. Return a table of "craft item name" - "set of positions" pairs.
Note that if craft width is not 3 then positions are recalculated as Note that if craft width is not 3 then positions are recalculated as
if items were placed on a 3x3 grid. Also note that craft can contain if items were placed on a 3x3 grid. Also note that craft can contain
groups of items with "group:" prefix. groups of items with "group:" prefix.
Arguments: Arguments:
craft: minetest craft recipe craft: minetest craft recipe
Example output: Example output:
-- Bed recipe -- Bed recipe
{ {
["wool:white"] = {[1] = true, [2] = true, [3] = true} ["wool:white"] = {[1] = true, [2] = true, [3] = true}
["group:wood"] = {[4] = true, [5] = true, [6] = true} ["group:wood"] = {[4] = true, [5] = true, [6] = true}
} }
--]] ]]
function unified_inventory.count_craft_positions(craft) function unified_inventory.count_craft_positions(craft)
local positions = {} local positions = {}
local craft_items = craft.items local craft_items = craft.items
@ -99,32 +99,32 @@ function unified_inventory.count_craft_positions(craft)
end end
--[[ --[[
For every craft item find all matching inventory items. For every craft item find all matching inventory items.
- If craft item is a group then find all inventory items that matches - If craft item is a group then find all inventory items that matches
this group. this group.
- If craft item is not a group (regular item) then find only this item. - If craft item is not a group (regular item) then find only this item.
If inventory doesn't contain needed item then found set is empty for If inventory doesn't contain needed item then found set is empty for
this item. this item.
Return a table of "craft item name" - "set of matching inventory items" Return a table of "craft item name" - "set of matching inventory items"
pairs. pairs.
Arguments: Arguments:
inv_items: table with items names as keys inv_items: table with items names as keys
craft_items: table with items names or groups as keys craft_items: table with items names or groups as keys
Example output: Example output:
{ {
["group:wood"] = { ["group:wood"] = {
["default:pine_wood"] = true, ["default:pine_wood"] = true,
["default:acacia_wood"] = true ["default:acacia_wood"] = true
}, },
["wool:white"] = { ["wool:white"] = {
["wool:white"] = true ["wool:white"] = true
}
} }
} ]]
--]]
function unified_inventory.find_usable_items(inv_items, craft_items) function unified_inventory.find_usable_items(inv_items, craft_items)
local get_group = minetest.get_item_group local get_group = minetest.get_item_group
local result = {} local result = {}
@ -152,28 +152,28 @@ function unified_inventory.find_usable_items(inv_items, craft_items)
end end
--[[ --[[
Match inventory items with craft grid positions. Match inventory items with craft grid positions.
For every position select the matching inventory item with maximum For every position select the matching inventory item with maximum
(total_count / (times_matched + 1)) value. (total_count / (times_matched + 1)) value.
If for some position matching item cannot be found or match count is 0 If for some position matching item cannot be found or match count is 0
then return nil. then return nil.
Return a table of "matched item name" - "set of craft positions" pairs Return a table of "matched item name" - "set of craft positions" pairs
and overall match count. and overall match count.
Arguments: Arguments:
inv_counts: table of inventory items counts from "count_items" inv_counts: table of inventory items counts from "count_items"
craft_positions: table of craft positions from "count_craft_positions" craft_positions: table of craft positions from "count_craft_positions"
Example output: Example output:
match_table = { match_table = {
["wool:white"] = {[1] = true, [2] = true, [3] = true} ["wool:white"] = {[1] = true, [2] = true, [3] = true}
["default:acacia_wood"] = {[4] = true, [6] = true} ["default:acacia_wood"] = {[4] = true, [6] = true}
["default:pine_wood"] = {[5] = true} ["default:pine_wood"] = {[5] = true}
} }
match_count = 2 match_count = 2
--]] ]]
function unified_inventory.match_items(inv_counts, craft_positions) function unified_inventory.match_items(inv_counts, craft_positions)
local usable = unified_inventory.find_usable_items(inv_counts, craft_positions) local usable = unified_inventory.find_usable_items(inv_counts, craft_positions)
local match_table = {} local match_table = {}
@ -227,17 +227,17 @@ function unified_inventory.match_items(inv_counts, craft_positions)
end end
--[[ --[[
Remove item from inventory lists. Remove item from inventory lists.
Return stack of actually removed items. Return stack of actually removed items.
This function replicates the inv:remove_item function but can accept This function replicates the inv:remove_item function but can accept
multiple lists. multiple lists.
Arguments: Arguments:
inv: minetest inventory reference inv: minetest inventory reference
lists: names of inventory lists lists: names of inventory lists
stack: minetest item stack stack: minetest item stack
--]] ]]
function unified_inventory.remove_item(inv, lists, stack) function unified_inventory.remove_item(inv, lists, stack)
local removed = ItemStack(nil) local removed = ItemStack(nil)
local leftover = ItemStack(stack) local leftover = ItemStack(stack)
@ -256,17 +256,17 @@ function unified_inventory.remove_item(inv, lists, stack)
end end
--[[ --[[
Add item to inventory lists. Add item to inventory lists.
Return leftover stack. Return leftover stack.
This function replicates the inv:add_item function but can accept This function replicates the inv:add_item function but can accept
multiple lists. multiple lists.
Arguments: Arguments:
inv: minetest inventory reference inv: minetest inventory reference
lists: names of inventory lists lists: names of inventory lists
stack: minetest item stack stack: minetest item stack
--]] ]]
function unified_inventory.add_item(inv, lists, stack) function unified_inventory.add_item(inv, lists, stack)
local leftover = ItemStack(stack) local leftover = ItemStack(stack)
@ -282,15 +282,15 @@ function unified_inventory.add_item(inv, lists, stack)
end end
--[[ --[[
Move items from source list to destination list if possible. Move items from source list to destination list if possible.
Skip positions specified in exclude set. Skip positions specified in exclude set.
Arguments: Arguments:
inv: minetest inventory reference inv: minetest inventory reference
src_list: name of source list src_list: name of source list
dst_list: name of destination list dst_list: name of destination list
exclude: set of positions to skip exclude: set of positions to skip
--]] ]]
function unified_inventory.swap_items(inv, src_list, dst_list, exclude) function unified_inventory.swap_items(inv, src_list, dst_list, exclude)
local size = inv:get_size(src_list) local size = inv:get_size(src_list)
local empty = ItemStack(nil) local empty = ItemStack(nil)
@ -312,21 +312,21 @@ function unified_inventory.swap_items(inv, src_list, dst_list, exclude)
end end
--[[ --[[
Move matched items to the destination list. Move matched items to the destination list.
If destination list position is already occupied with some other item If destination list position is already occupied with some other item
then function tries to (in that order): then function tries to (in that order):
1. Move it to the source list 1. Move it to the source list
2. Move it to some other unused position in destination list itself 2. Move it to some other unused position in destination list itself
3. Drop it to the ground if nothing else is possible. 3. Drop it to the ground if nothing else is possible.
Arguments: Arguments:
player: minetest player object player: minetest player object
src_list: name of source list src_list: name of source list
dst_list: name of destination list dst_list: name of destination list
match_table: table of matched items match_table: table of matched items
amount: amount of items per every position amount: amount of items per every position
--]] ]]
function unified_inventory.move_match(player, src_list, dst_list, match_table, amount) function unified_inventory.move_match(player, src_list, dst_list, match_table, amount)
local inv = player:get_inventory() local inv = player:get_inventory()
local item_drop = minetest.item_drop local item_drop = minetest.item_drop
@ -374,21 +374,21 @@ function unified_inventory.move_match(player, src_list, dst_list, match_table, a
end end
--[[ --[[
Find craft match and move matched items to the destination list. Find craft match and move matched items to the destination list.
If match cannot be found or match count is smaller than the desired If match cannot be found or match count is smaller than the desired
amount then do nothing. amount then do nothing.
If amount passed is -1 then amount is defined by match count itself. If amount passed is -1 then amount is defined by match count itself.
This is used to indicate "craft All" case. This is used to indicate "craft All" case.
Arguments: Arguments:
player: minetest player object player: minetest player object
src_list: name of source list src_list: name of source list
dst_list: name of destination list dst_list: name of destination list
craft: minetest craft recipe craft: minetest craft recipe
amount: desired amount of output items amount: desired amount of output items
--]] ]]
function unified_inventory.craftguide_match_craft(player, src_list, dst_list, craft, amount) function unified_inventory.craftguide_match_craft(player, src_list, dst_list, craft, amount)
local inv = player:get_inventory() local inv = player:get_inventory()
local src_dst_list = {src_list, dst_list} local src_dst_list = {src_list, dst_list}

View File

@ -21,7 +21,7 @@ local trash = minetest.create_detached_inventory("trash", {
-- return 0 -- return 0
-- end -- end
--end, --end,
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, index, _, player)
inv:set_stack(listname, index, nil) inv:set_stack(listname, index, nil)
local player_name = player:get_player_name() local player_name = player:get_player_name()
minetest.sound_play("trash", {to_player=player_name, gain = 1.0}) minetest.sound_play("trash", {to_player=player_name, gain = 1.0})
@ -193,9 +193,9 @@ unified_inventory.register_page("craft", {
-- stack_image_button(): generate a form button displaying a stack of items -- stack_image_button(): generate a form button displaying a stack of items
-- --
-- The specified item may be a group. In that case, the group will be -- The specified item may be a group. In that case, the group will be
-- represented by some item in the group, along with a flag indicating -- represented by some item in the group, along with a flag indicating
-- that it's a group. If the group contains only one item, it will be -- that it's a group. If the group contains only one item, it will be
-- treated as if that item had been specified directly. -- treated as if that item had been specified directly.
local function stack_image_button(x, y, w, h, buttonname_prefix, item) local function stack_image_button(x, y, w, h, buttonname_prefix, item)
@ -226,7 +226,7 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item)
end end
grouptip = F(grouptip) grouptip = F(grouptip)
if andcount >= 1 then if andcount >= 1 then
button = button .. string.format("tooltip[%s;%s]", buttonname, grouptip) button = button .. string.format("tooltip[%s;%s]", buttonname, grouptip)
end end
end end
return button return button
@ -260,8 +260,8 @@ local other_dir = {
unified_inventory.register_page("craftguide", { unified_inventory.register_page("craftguide", {
get_formspec = function(player, perplayer_formspec) get_formspec = function(player, perplayer_formspec)
local formspecy = perplayer_formspec.formspec_y local formspecy = perplayer_formspec.formspec_y
local formheadery = perplayer_formspec.form_header_y local formheadery = perplayer_formspec.form_header_y
local craftresultx = perplayer_formspec.craft_result_x local craftresultx = perplayer_formspec.craft_result_x
local craftresulty = perplayer_formspec.craft_result_y local craftresulty = perplayer_formspec.craft_result_y
@ -414,7 +414,7 @@ unified_inventory.register_page("craftguide", {
end, end,
}) })
local function craftguide_giveme(player, formname, fields) local function craftguide_giveme(player, _, fields)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local player_privs = minetest.get_player_privs(player_name) local player_privs = minetest.get_player_privs(player_name)
if not player_privs.give and if not player_privs.give and
@ -425,7 +425,7 @@ local function craftguide_giveme(player, formname, fields)
end end
local amount local amount
for k, v in pairs(fields) do for k, _ in pairs(fields) do
amount = k:match("craftguide_giveme_(.*)") amount = k:match("craftguide_giveme_(.*)")
if amount then break end if amount then break end
end end
@ -441,9 +441,9 @@ local function craftguide_giveme(player, formname, fields)
player_inv:add_item("main", {name = output, count = amount}) player_inv:add_item("main", {name = output, count = amount})
end end
local function craftguide_craft(player, formname, fields) local function craftguide_craft(player, _, fields)
local amount local amount
for k, v in pairs(fields) do for k, _ in pairs(fields) do
amount = k:match("craftguide_craft_(.*)") amount = k:match("craftguide_craft_(.*)")
if amount then break end if amount then break end
end end
@ -476,7 +476,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return return
end end
for k, v in pairs(fields) do for k, _ in pairs(fields) do
if k:match("craftguide_craft_") then if k:match("craftguide_craft_") then
craftguide_craft(player, formname, fields) craftguide_craft(player, formname, fields)
return return

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -244,4 +244,3 @@ end)
minetest.register_on_leaveplayer(function(player) minetest.register_on_leaveplayer(function(player)
waypoints_temp[player:get_player_name()] = nil waypoints_temp[player:get_player_name()] = nil
end) end)