Compare commits

..

11 commits

Author SHA1 Message Date
philipmi
4b9298c530 Reduce place limit to 4 NPS 2021-05-07 21:33:52 +02:00
philipmi
fd79c14b85 Merge branch 'master' of https://github.com/MT-CTF/capturetheflag 2021-05-07 21:20:30 +02:00
savilli
0f5f921c0d
Fix ctf_marker crash (#877) 2021-05-04 13:59:33 -07:00
LoneWolfHT
6d5f046d41
Fix texurepacks being able to hide grenade smoke (#876)
* Fix texurepacks being able to hide grenade smoke

* Update smoke texture
2021-05-04 10:05:14 -07:00
LoneWolfHT
6700266ff6
Add debug to help catch ctf_marker crash 2021-05-03 17:40:03 -07:00
LoneWolfHT
c2e7543ff3 Fix /me not showing to IRC properly 2021-05-02 22:24:29 -07:00
dependabot[bot]
4ba30a98aa
Bump mods/ctf/ctf_map/ctf_map_core/maps from 5fe0d7b to fa7fa3e (#873) 2021-04-29 19:27:22 +00:00
dependabot-preview[bot]
f824b86142
Upgrade to GitHub-native Dependabot (#872)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-04-29 12:25:55 -07:00
Lars Müller
4f49560569
Medkits: Don't give back if map is skipped (#870) 2021-04-29 06:54:29 -07:00
savilli
47cc8928f7
Increase the distance between the same map on maps shuffling (#869) 2021-04-29 06:49:58 -07:00
_Lucy
2cfbd9b4c4
Make cobble stairs craftable (#860)
* Update init.lua

* Update init.lua
2021-04-28 07:20:21 -07:00
12 changed files with 85 additions and 38 deletions

9
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: gitsubmodule
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
assignees:
- LoneWolfHT

View file

@ -294,8 +294,10 @@ if minetest.global_exists("irc") then
me_func = function(...) me_func = function(...)
local message = irc.playerMessage(...) local message = irc.playerMessage(...)
local start_escape = message:sub(1, message:find("<")-1)
message = "*" .. message:sub(message:find(" ")) -- format is: \startescape < \endescape playername \startescape > \endescape
message = message:gsub("\15(.-)"..start_escape, "* %1"):gsub("[<>]", "")
irc.say(message) irc.say(message)
end end

View file

@ -69,6 +69,10 @@ minetest.register_tool("ctf_classes:sword_bronze", {
local pteam = ctf.player(pname).team 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 pointed_thing.type == "object" and pointed_thing.ref:is_player() then
if ctf_match.is_in_build_time() then return end if ctf_match.is_in_build_time() then return end

View file

@ -97,6 +97,24 @@ crafting.register_recipe({
level = 1, 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 -- Wood x4
crafting.register_recipe({ crafting.register_recipe({
type = "inv", type = "inv",

@ -1 +1 @@
Subproject commit 5fe0d7b1fd8aba95cfe0361a333abfa6b00f20a8 Subproject commit fa7fa3e8f80dd82d6e98766581269817325e546b

View file

@ -214,28 +214,44 @@ local shuffled_idx
math.randomseed(os.time()) 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 -- 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 -- Reset shuffled_idx
shuffled_idx = 1 shuffled_idx = 1
-- Create table of ordered indices -- Create table of ordered indices
shuffled_order = {} 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 end
-- Shuffle table -- Select remaining maps
for i = #ctf_map.available_maps, 1, -1 do for i = map_recurrence_threshold + 1, maps_count do
local j = math.random(i) local j = math.random(1, maps_count - i + 1)
shuffled_order[i], shuffled_order[j] = shuffled_order[j], shuffled_order[i] local k = maps_count - i + 1
end shuffled_order[i] = previous_order[j]
previous_order[j] = previous_order[k]
-- 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
end end
@ -257,7 +273,7 @@ local function select_map()
-- If shuffled_idx overflows, re-shuffle map selection order -- If shuffled_idx overflows, re-shuffle map selection order
if shuffled_idx > #ctf_map.available_maps then 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 end
else else
-- Choose next map index, but don't select the same one again -- Choose next map index, but don't select the same one again

View file

@ -30,11 +30,6 @@ end
-- Add waypoint element to all players in the same team as name -- Add waypoint element to all players in the same team as name
function ctf_marker.add_marker(name, tname, pos, str) 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) local team = ctf.team(tname)
teams[tname] = { teams[tname] = {
@ -42,7 +37,7 @@ function ctf_marker.add_marker(name, tname, pos, str)
time = 0 time = 0
} }
for pname, _ in pairs(team.players) do for pname in pairs(team.players) do
local tplayer = minetest.get_player_by_name(pname) local tplayer = minetest.get_player_by_name(pname)
if tplayer then if tplayer then
teams[tname].players[pname] = tplayer:hud_add({ teams[tname].players[pname] = tplayer:hud_add({
@ -97,6 +92,9 @@ minetest.register_chatcommand("m", {
end end
local tname = ctf.player(name).team local tname = ctf.player(name).team
if not tname then -- can be nil during map change
return
end
-- Handle waypoint string -- Handle waypoint string
local str = (param and param:trim() ~= "") and ": " .. param or "" local str = (param and param:trim() ~= "") and ": " .. param or ""

View file

@ -120,24 +120,24 @@ grenades.register_grenade("grenades:smoke", {
minetest.after(SMOKE_GRENADE_TIME, minetest.sound_stop, hiss) minetest.after(SMOKE_GRENADE_TIME, minetest.sound_stop, hiss)
for i = 0, 5, 1 do for i = 0, 4, 1 do
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 40, amount = 40,
time = SMOKE_GRENADE_TIME + 3, time = SMOKE_GRENADE_TIME + 3,
minpos = vector.subtract(pos, 2), minpos = vector.new(pos.x-4, pos.y+1, pos.z-4),
maxpos = vector.add(pos, 2), maxpos = vector.new(pos.x+4, pos.y+2, pos.z+4),
minvel = {x = 0, y = 2, z = 0}, minvel = vector.new(-1, 0, -1),
maxvel = {x = 0, y = 3, z = 0}, maxvel = vector.new(1, 0.3, 1),
minacc = {x = 1, y = 0.2, z = 1}, minacc = vector.new(-1, 0, -1),
maxacc = {x = 1, y = 0.2, z = 1}, maxacc = vector.new(1, 1, 1),
minexptime = 1, minexptime = 1,
maxexptime = 1, maxexptime = 2,
minsize = 125, minsize = 50,
maxsize = 140, maxsize = 40,
collisiondetection = false, collisiondetection = false,
collision_removal = false, collision_removal = false,
vertical = false, vertical = false,
texture = "grenades_smoke.png", texture = "grenades_smoke.png^[noalpha^[colorize:#" .. math.random(7, 9)*111 ..":255^grenades_smoke.png",
}) })
end end
end, end,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 175 B

View file

@ -83,7 +83,7 @@ local function stop_healing(player, interrupted)
player:hud_remove(info.hud) player:hud_remove(info.hud)
end end
ctf_flag.register_on_precapture(function() ctf_match.register_on_new_match(function()
-- Reset all player states at the end of the match -- Reset all player states at the end of the match
for name, info in pairs(players) do for name, info in pairs(players) do
players[name] = nil players[name] = nil

View file

@ -1,2 +1,2 @@
name = medkits name = medkits
depends = ctf_flag depends = ctf_match

View file

@ -1,6 +1,6 @@
-- Licensed under the MIT license, written by appgurueu. -- Licensed under the MIT license, written by appgurueu.
local players = {} local players = {}
local blocks_per_second = 5 local blocks_per_second = 4
local resend_notification_seconds = 10 local resend_notification_seconds = 10
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)