From 7733c2cb6786e8657bcc797712a9e132efdf6d73 Mon Sep 17 00:00:00 2001 From: Toby1710 <69259430+DiamondPlane@users.noreply.github.com> Date: Wed, 21 Apr 2021 18:46:56 +0300 Subject: [PATCH 1/6] Prevent empty messages in team chat (#830) * Update init.lua * Update init.lua * Update init.lua * Update mods/ctf/ctf_chat/init.lua Co-authored-by: David Leal * Update init.lua * Update mods/ctf/ctf_chat/init.lua Co-authored-by: David Leal * Update init.lua Co-authored-by: David Leal --- mods/ctf/ctf_chat/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ctf/ctf_chat/init.lua b/mods/ctf/ctf_chat/init.lua index df69b01..bc66d5e 100644 --- a/mods/ctf/ctf_chat/init.lua +++ b/mods/ctf/ctf_chat/init.lua @@ -248,6 +248,9 @@ minetest.register_chatcommand("t", { minetest.chat_send_player(name, "The team channel is disabled.") return end + if param == "" then + return false, "-!- Empty team message, see /help t" + end local tname = ctf.player(name).team local team = ctf.team(tname) From 2cfbd9b4c46eb0e1e4657da1aaf292eda0c4b582 Mon Sep 17 00:00:00 2001 From: _Lucy <80708819+Lucyucy@users.noreply.github.com> Date: Wed, 28 Apr 2021 16:20:21 +0200 Subject: [PATCH 2/6] Make cobble stairs craftable (#860) * Update init.lua * Update init.lua --- mods/ctf/ctf_crafting/init.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mods/ctf/ctf_crafting/init.lua b/mods/ctf/ctf_crafting/init.lua index a819871..e78c6b8 100644 --- a/mods/ctf/ctf_crafting/init.lua +++ b/mods/ctf/ctf_crafting/init.lua @@ -88,6 +88,24 @@ crafting.register_recipe({ level = 1, }) +-- Cobble Stairs +crafting.register_recipe({ + type = "inv", + output = "stairs:stair_cobble 8", + items = { "default:cobble 6"}, + always_known = true, + level = 1, +}) + +-- Desert Cobble Stairs +crafting.register_recipe({ + type = "inv", + output = "stairs:stair_desert_cobble 8", + items = { "default:desert_cobble 6"}, + always_known = true, + level = 1, +}) + -- Wood x4 crafting.register_recipe({ type = "inv", From 47cc8928f79ae7d720a0fb143eb7f120e6f51edd Mon Sep 17 00:00:00 2001 From: savilli <78875209+savilli@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:49:58 +0200 Subject: [PATCH 3/6] Increase the distance between the same map on maps shuffling (#869) --- mods/ctf/ctf_map/ctf_map_core/schem_map.lua | 46 ++++++++++++++------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/mods/ctf/ctf_map/ctf_map_core/schem_map.lua b/mods/ctf/ctf_map/ctf_map_core/schem_map.lua index 4c115d2..2286a0c 100644 --- a/mods/ctf/ctf_map/ctf_map_core/schem_map.lua +++ b/mods/ctf/ctf_map/ctf_map_core/schem_map.lua @@ -214,28 +214,44 @@ local shuffled_idx math.randomseed(os.time()) --- Fisher-Yates shuffling algorithm, used for shuffling map selection order +-- Fisher-Yates-Savilli shuffling algorithm, used for shuffling map selection order -- Adapted from snippet provided in https://stackoverflow.com/a/35574006 -local function shuffle_maps(idx_to_avoid) +-- Improved to ensure that the first maps from current shuffled order differ +-- from the last maps from previous shuffled order +-- You can set the minimum distance between the same map using map_recurrence_threshold param +local function shuffle_maps(previous_order, map_recurrence_threshold) + local maps_count = #ctf_map.available_maps + + map_recurrence_threshold = math.min(map_recurrence_threshold or 0, maps_count - 1) + + if previous_order == nil then + map_recurrence_threshold = 0 + previous_order = {} + for i = 1, maps_count do + previous_order[i] = i + end + end + -- Reset shuffled_idx shuffled_idx = 1 -- Create table of ordered indices shuffled_order = {} - for i = 1, #ctf_map.available_maps, 1 do - shuffled_order[i] = i + + -- At first select maps that don't intersect with the last maps from previous order + for i = 1, map_recurrence_threshold do + local j = math.random(1, maps_count - map_recurrence_threshold) + local k = maps_count - map_recurrence_threshold + i + shuffled_order[i] = previous_order[j] + previous_order[j] = previous_order[k] end - -- Shuffle table - for i = #ctf_map.available_maps, 1, -1 do - local j = math.random(i) - shuffled_order[i], shuffled_order[j] = shuffled_order[j], shuffled_order[i] - end - - -- Prevent the last map of the previous cycle from becoming the first in the next cycle - if shuffled_order[1] == idx_to_avoid then - local k = math.random(#ctf_map.available_maps - 1) - shuffled_order[1], shuffled_order[k + 1] = shuffled_order[k + 1], shuffled_order[1] + -- Select remaining maps + for i = map_recurrence_threshold + 1, maps_count do + local j = math.random(1, maps_count - i + 1) + local k = maps_count - i + 1 + shuffled_order[i] = previous_order[j] + previous_order[j] = previous_order[k] end end @@ -257,7 +273,7 @@ local function select_map() -- If shuffled_idx overflows, re-shuffle map selection order if shuffled_idx > #ctf_map.available_maps then - shuffle_maps(shuffled_order[#ctf_map.available_maps]) + shuffle_maps(shuffled_order, tonumber(minetest.settings:get("ctf_map.map_recurrence_threshold")) or 3) end else -- Choose next map index, but don't select the same one again From 4f49560569600188d942cf8e02000a113c370cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:54:29 +0200 Subject: [PATCH 4/6] Medkits: Don't give back if map is skipped (#870) --- mods/pvp/medkits/init.lua | 4 ++-- mods/pvp/medkits/mod.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/pvp/medkits/init.lua b/mods/pvp/medkits/init.lua index 710ccb9..5848a0b 100644 --- a/mods/pvp/medkits/init.lua +++ b/mods/pvp/medkits/init.lua @@ -83,10 +83,10 @@ local function stop_healing(player, interrupted) player:hud_remove(info.hud) end -ctf_flag.register_on_precapture(function() +ctf_match.register_on_new_match(function() -- Reset all player states at the end of the match for name, info in pairs(players) do - players[name]=nil + players[name] = nil local player = minetest.get_player_by_name(name) if player then player:hud_remove(info.hud) diff --git a/mods/pvp/medkits/mod.conf b/mods/pvp/medkits/mod.conf index 67007d1..57151da 100644 --- a/mods/pvp/medkits/mod.conf +++ b/mods/pvp/medkits/mod.conf @@ -1,2 +1,2 @@ name = medkits -depends = ctf_flag +depends = ctf_match From f824b861425b2f975420db9f668c50ac499e5df6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 12:25:55 -0700 Subject: [PATCH 5/6] Upgrade to GitHub-native Dependabot (#872) Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- .github/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2a7068d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: +- package-ecosystem: gitsubmodule + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + assignees: + - LoneWolfHT From 4ba30a98aa98812c698718f6f4867c0844c5af1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 19:27:22 +0000 Subject: [PATCH 6/6] Bump mods/ctf/ctf_map/ctf_map_core/maps from `5fe0d7b` to `fa7fa3e` (#873) --- mods/ctf/ctf_map/ctf_map_core/maps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ctf/ctf_map/ctf_map_core/maps b/mods/ctf/ctf_map/ctf_map_core/maps index 5fe0d7b..fa7fa3e 160000 --- a/mods/ctf/ctf_map/ctf_map_core/maps +++ b/mods/ctf/ctf_map/ctf_map_core/maps @@ -1 +1 @@ -Subproject commit 5fe0d7b1fd8aba95cfe0361a333abfa6b00f20a8 +Subproject commit fa7fa3e8f80dd82d6e98766581269817325e546b