diff --git a/mods/apis/ctf_gui/init.lua b/mods/apis/ctf_gui/init.lua index 9ca06e89d7..d2b88231e9 100644 --- a/mods/apis/ctf_gui/init.lua +++ b/mods/apis/ctf_gui/init.lua @@ -144,6 +144,7 @@ do end end + minetest.log("action", "[ctf_gui] unpacking: "..dump(l)) return format(base, unpck(l)) end diff --git a/mods/ctf/ctf_map/textures/default_chest_front_blue.png b/mods/ctf/ctf_map/textures/default_chest_front_blue.png deleted file mode 100644 index 3dabef4c1a..0000000000 Binary files a/mods/ctf/ctf_map/textures/default_chest_front_blue.png and /dev/null differ diff --git a/mods/ctf/ctf_map/textures/default_chest_front_red.png b/mods/ctf/ctf_map/textures/default_chest_front_red.png deleted file mode 100644 index 02305af6c7..0000000000 Binary files a/mods/ctf/ctf_map/textures/default_chest_front_red.png and /dev/null differ diff --git a/mods/ctf/ctf_map/textures/default_chest_side_blue.png b/mods/ctf/ctf_map/textures/default_chest_side_blue.png deleted file mode 100644 index 584b81b997..0000000000 Binary files a/mods/ctf/ctf_map/textures/default_chest_side_blue.png and /dev/null differ diff --git a/mods/ctf/ctf_map/textures/default_chest_side_red.png b/mods/ctf/ctf_map/textures/default_chest_side_red.png deleted file mode 100644 index 066aa80e3c..0000000000 Binary files a/mods/ctf/ctf_map/textures/default_chest_side_red.png and /dev/null differ diff --git a/mods/ctf/ctf_map/textures/default_chest_top_blue.png b/mods/ctf/ctf_map/textures/default_chest_top_blue.png deleted file mode 100644 index 75ce5eb0d8..0000000000 Binary files a/mods/ctf/ctf_map/textures/default_chest_top_blue.png and /dev/null differ diff --git a/mods/ctf/ctf_map/textures/default_chest_top_red.png b/mods/ctf/ctf_map/textures/default_chest_top_red.png deleted file mode 100644 index 5bc699b574..0000000000 Binary files a/mods/ctf/ctf_map/textures/default_chest_top_red.png and /dev/null differ diff --git a/mods/ctf/ctf_modebase/features.lua b/mods/ctf/ctf_modebase/features.lua index 07b7adeee2..591dfb37e7 100644 --- a/mods/ctf/ctf_modebase/features.lua +++ b/mods/ctf/ctf_modebase/features.lua @@ -151,13 +151,13 @@ local function drop_flag(teamname) if pteam == teamname then minetest.sound_play("ctf_modebase_drop_flag_negative", { to_player = pname, - gain = 0.4, + gain = 0.2, pitch = 1.0, }, true) else minetest.sound_play("ctf_modebase_drop_flag_positive", { to_player = pname, - gain = 0.4, + gain = 0.2, pitch = 1.0, }, true) end diff --git a/mods/ctf/ctf_modebase/player.lua b/mods/ctf/ctf_modebase/player.lua index 34439b21cc..687e986a5c 100644 --- a/mods/ctf/ctf_modebase/player.lua +++ b/mods/ctf/ctf_modebase/player.lua @@ -11,6 +11,12 @@ local simplify_for_saved_stuff = function(iname) return "shovel" elseif iname:match("ctf_mode_nade_fight:") then return "nade_fight_grenade" + elseif + iname == "ctf_mode_classes:knight_sword" or + iname == "ctf_mode_classes:support_bandage" or + iname == "ctf_mode_classes:ranged_rifle_loaded" + then + return "class_primary" end local mod, match = iname:match("(%a+):sword_(%a+)") @@ -22,12 +28,31 @@ local simplify_for_saved_stuff = function(iname) return iname end -function ctf_modebase.player.save_initial_stuff_order(player, soft) +local function is_initial_stuff(player, i) + local mode = ctf_modebase:get_current_mode() + if mode and mode.stuff_provider then + for _, item in ipairs(mode.stuff_provider(player)) do + if ItemStack(item):get_name() == i then + return true + end + end + end + + if ctf_map.current_map and ctf_map.current_map.initial_stuff then + for _, item in ipairs(ctf_map.current_map.initial_stuff) do + if ItemStack(item):get_name() == i then + return true + end + end + end +end + +function ctf_modebase.player.save_initial_stuff_positions(player, soft) if not ctf_modebase.current_mode then return end local inv = player:get_inventory() local meta = player:get_meta() - local ssp = meta:get_string("ctf_modebase:player:initial_stuff_order:"..ctf_modebase.current_mode) + local ssp = meta:get_string("ctf_modebase:player:initial_stuff_positions:"..ctf_modebase.current_mode) if ssp == "" then ssp = {} @@ -37,8 +62,10 @@ function ctf_modebase.player.save_initial_stuff_order(player, soft) local done = {} for i, s in pairs(inv:get_list("main")) do - if s:get_name() ~= "" then - local k = simplify_for_saved_stuff(s:get_name():match("[^%s]*")) + local n = s:get_name() + + if n ~= "" and is_initial_stuff(player, n) then + local k = simplify_for_saved_stuff(n:match("[^%s]*")) if not soft or not ssp[k] then if not done[k] or (i < ssp[k]) then @@ -49,9 +76,10 @@ function ctf_modebase.player.save_initial_stuff_order(player, soft) end end - meta:set_string("ctf_modebase:player:initial_stuff_order:"..ctf_modebase.current_mode, minetest.serialize(ssp)) + meta:set_string("ctf_modebase:player:initial_stuff_positions:"..ctf_modebase.current_mode, minetest.serialize(ssp)) end +-- Changes made to this function should also be made to is_initial_stuff() above local function get_initial_stuff(player, f) local mode = ctf_modebase:get_current_mode() if mode and mode.stuff_provider then @@ -113,9 +141,11 @@ function ctf_modebase.player.give_initial_stuff(player) end) -- Check for new items not yet in the order list - ctf_modebase.player.save_initial_stuff_order(player, true) + ctf_modebase.player.save_initial_stuff_positions(player, true) - local saved_stuff_positions = meta:get_string("ctf_modebase:player:initial_stuff_order:"..ctf_modebase.current_mode) + local saved_stuff_positions = meta:get_string( + "ctf_modebase:player:initial_stuff_positions:"..ctf_modebase.current_mode + ) if saved_stuff_positions == "" then saved_stuff_positions = {} @@ -140,16 +170,14 @@ function ctf_modebase.player.give_initial_stuff(player) end for stack, idx in pairs(tmp) do - for i = 1, #new+1 do - if new[i] then - if idx < tmp[new[i]] then - table.insert(new, i, stack) - break - end - else - new[i] = stack - break - end + if not new[idx] then + new[idx] = stack + end + end + + for stack, idx in pairs(tmp) do + if new[idx] ~= stack then + table.insert(new, stack) end end diff --git a/mods/other/crafting/gui.lua b/mods/other/crafting/gui.lua index 2e0bbd646d..26cca5033c 100644 --- a/mods/other/crafting/gui.lua +++ b/mods/other/crafting/gui.lua @@ -163,7 +163,6 @@ function crafting.result_select_on_receive_results(player, context, fields) if key:sub(1, 7) == "result_" then local num = string.match(key, "result_([0-9]+)") if num then - local inv = player:get_inventory() local recipe = crafting.get_recipe(tonumber(num)) local name = player:get_player_name() if not crafting.can_craft(name, recipe) then @@ -215,7 +214,7 @@ if minetest.global_exists("sfinv") then end if fields.save_inv_order then - ctf_modebase.player.save_initial_stuff_order(player) + ctf_modebase.player.save_initial_stuff_positions(player) minetest.sound_play("crafting_save_sound", { to_player = player:get_player_name(),