diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 2a7068d..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -updates: -- package-ecosystem: gitsubmodule - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 10 - assignees: - - LoneWolfHT diff --git a/mods/ctf/ctf_chat/init.lua b/mods/ctf/ctf_chat/init.lua index 1c1dfd5..bc66d5e 100644 --- a/mods/ctf/ctf_chat/init.lua +++ b/mods/ctf/ctf_chat/init.lua @@ -294,10 +294,8 @@ if minetest.global_exists("irc") then me_func = function(...) local message = irc.playerMessage(...) - local start_escape = message:sub(1, message:find("<")-1) - -- format is: \startescape < \endescape playername \startescape > \endescape - message = message:gsub("\15(.-)"..start_escape, "* %1"):gsub("[<>]", "") + message = "*" .. message:sub(message:find(" ")) irc.say(message) end diff --git a/mods/ctf/ctf_classes/melee.lua b/mods/ctf/ctf_classes/melee.lua index b1d176a..2b33700 100644 --- a/mods/ctf/ctf_classes/melee.lua +++ b/mods/ctf/ctf_classes/melee.lua @@ -69,10 +69,6 @@ minetest.register_tool("ctf_classes:sword_bronze", { local pteam = ctf.player(pname).team - if not pteam then -- can be nil during map change - return - end - if pointed_thing.type == "object" and pointed_thing.ref:is_player() then if ctf_match.is_in_build_time() then return end diff --git a/mods/ctf/ctf_crafting/init.lua b/mods/ctf/ctf_crafting/init.lua index 86d4273..5c30f51 100644 --- a/mods/ctf/ctf_crafting/init.lua +++ b/mods/ctf/ctf_crafting/init.lua @@ -97,24 +97,6 @@ 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", diff --git a/mods/ctf/ctf_map/ctf_map_core/maps b/mods/ctf/ctf_map/ctf_map_core/maps index fa7fa3e..5fe0d7b 160000 --- a/mods/ctf/ctf_map/ctf_map_core/maps +++ b/mods/ctf/ctf_map/ctf_map_core/maps @@ -1 +1 @@ -Subproject commit fa7fa3e8f80dd82d6e98766581269817325e546b +Subproject commit 5fe0d7b1fd8aba95cfe0361a333abfa6b00f20a8 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 2286a0c..4c115d2 100644 --- a/mods/ctf/ctf_map/ctf_map_core/schem_map.lua +++ b/mods/ctf/ctf_map/ctf_map_core/schem_map.lua @@ -214,44 +214,28 @@ local shuffled_idx math.randomseed(os.time()) --- Fisher-Yates-Savilli shuffling algorithm, used for shuffling map selection order +-- Fisher-Yates shuffling algorithm, used for shuffling map selection order -- Adapted from snippet provided in https://stackoverflow.com/a/35574006 --- 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 - +local function shuffle_maps(idx_to_avoid) -- Reset shuffled_idx shuffled_idx = 1 -- Create table of ordered indices shuffled_order = {} - - -- 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] + for i = 1, #ctf_map.available_maps, 1 do + shuffled_order[i] = i end - -- 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] + -- 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] end end @@ -273,7 +257,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, tonumber(minetest.settings:get("ctf_map.map_recurrence_threshold")) or 3) + shuffle_maps(shuffled_order[#ctf_map.available_maps]) end else -- Choose next map index, but don't select the same one again diff --git a/mods/ctf/ctf_marker/init.lua b/mods/ctf/ctf_marker/init.lua index 3a162cc..9c9d348 100644 --- a/mods/ctf/ctf_marker/init.lua +++ b/mods/ctf/ctf_marker/init.lua @@ -30,6 +30,11 @@ end -- Add waypoint element to all players in the same team as name function ctf_marker.add_marker(name, tname, pos, str) + local player = minetest.get_player_by_name(name) + if not player then + return + end + local team = ctf.team(tname) teams[tname] = { @@ -37,7 +42,7 @@ function ctf_marker.add_marker(name, tname, pos, str) time = 0 } - for pname in pairs(team.players) do + for pname, _ in pairs(team.players) do local tplayer = minetest.get_player_by_name(pname) if tplayer then teams[tname].players[pname] = tplayer:hud_add({ @@ -92,9 +97,6 @@ minetest.register_chatcommand("m", { end local tname = ctf.player(name).team - if not tname then -- can be nil during map change - return - end -- Handle waypoint string local str = (param and param:trim() ~= "") and ": " .. param or "" diff --git a/mods/pvp/grenades/grenades.lua b/mods/pvp/grenades/grenades.lua index 0895eef..1e8a811 100644 --- a/mods/pvp/grenades/grenades.lua +++ b/mods/pvp/grenades/grenades.lua @@ -120,24 +120,24 @@ grenades.register_grenade("grenades:smoke", { minetest.after(SMOKE_GRENADE_TIME, minetest.sound_stop, hiss) - for i = 0, 4, 1 do + for i = 0, 5, 1 do minetest.add_particlespawner({ amount = 40, time = SMOKE_GRENADE_TIME + 3, - minpos = vector.new(pos.x-4, pos.y+1, pos.z-4), - maxpos = vector.new(pos.x+4, pos.y+2, pos.z+4), - minvel = vector.new(-1, 0, -1), - maxvel = vector.new(1, 0.3, 1), - minacc = vector.new(-1, 0, -1), - maxacc = vector.new(1, 1, 1), + minpos = vector.subtract(pos, 2), + maxpos = vector.add(pos, 2), + minvel = {x = 0, y = 2, z = 0}, + maxvel = {x = 0, y = 3, z = 0}, + minacc = {x = 1, y = 0.2, z = 1}, + maxacc = {x = 1, y = 0.2, z = 1}, minexptime = 1, - maxexptime = 2, - minsize = 50, - maxsize = 40, + maxexptime = 1, + minsize = 125, + maxsize = 140, collisiondetection = false, collision_removal = false, vertical = false, - texture = "grenades_smoke.png^[noalpha^[colorize:#" .. math.random(7, 9)*111 ..":255^grenades_smoke.png", + texture = "grenades_smoke.png", }) end end, diff --git a/mods/pvp/grenades/textures/grenades_smoke.png b/mods/pvp/grenades/textures/grenades_smoke.png index 8a345ff..254be1d 100644 Binary files a/mods/pvp/grenades/textures/grenades_smoke.png and b/mods/pvp/grenades/textures/grenades_smoke.png differ diff --git a/mods/pvp/medkits/init.lua b/mods/pvp/medkits/init.lua index 5848a0b..710ccb9 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_match.register_on_new_match(function() +ctf_flag.register_on_precapture(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 57151da..67007d1 100644 --- a/mods/pvp/medkits/mod.conf +++ b/mods/pvp/medkits/mod.conf @@ -1,2 +1,2 @@ name = medkits -depends = ctf_match +depends = ctf_flag diff --git a/mods/pvp/place_limit/init.lua b/mods/pvp/place_limit/init.lua index 7949aaf..49c64e1 100644 --- a/mods/pvp/place_limit/init.lua +++ b/mods/pvp/place_limit/init.lua @@ -1,6 +1,6 @@ -- Licensed under the MIT license, written by appgurueu. local players = {} -local blocks_per_second = 4 +local blocks_per_second = 5 local resend_notification_seconds = 10 minetest.register_on_joinplayer(function(player)