Conflicts:
	mods/other/random_messages/init.lua
This commit is contained in:
philipmi 2021-06-23 16:06:50 +02:00
commit b05cad5633
5 changed files with 19 additions and 9 deletions

View file

@ -138,7 +138,7 @@ minetest.override_item("ctf_bandages:bandage", {
local diggers = {} local diggers = {}
local DIG_COOLDOWN = 30 local DIG_COOLDOWN = 30
local DIG_DIST_LIMIT = 50 local DIG_DIST_LIMIT = 10
local DIG_SPEED = 0.1 local DIG_SPEED = 0.1
local function isdiggable(name) local function isdiggable(name)
@ -171,7 +171,10 @@ local function remove_pillar(pos, pname)
minetest.dig_node(pos) minetest.dig_node(pos)
if player and diggers[pname] and type(diggers[pname]) ~= "table" then if player and diggers[pname] and type(diggers[pname]) ~= "table" then
if vector.distance(player:get_pos(), pos) <= DIG_DIST_LIMIT then local distance = vector.subtract(player:get_pos(), pos)
-- Ignore vertical distance
distance.y = 0
if vector.length(distance) <= DIG_DIST_LIMIT then
pos.y = pos.y + 1 pos.y = pos.y + 1
minetest.after(DIG_SPEED, remove_pillar, pos, pname) minetest.after(DIG_SPEED, remove_pillar, pos, pname)
else else

View file

@ -277,15 +277,14 @@ local function select_map()
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
if ctf_map.map then if ctf_map.map and #ctf_map.available_maps > 1 then
idx = math.random(#ctf_map.available_maps - 1) idx = math.random(1, #ctf_map.available_maps - 1)
if idx >= ctf_map.map.idx then if idx >= ctf_map.map.idx then
idx = idx + 1 idx = idx + 1
end end
else else
idx = math.random(#ctf_map.available_maps) idx = math.random(1, #ctf_map.available_maps)
end end
ctf_map.next_idx = (idx % #ctf_map.available_maps) + 1
end end
return idx return idx
end end

View file

@ -52,11 +52,11 @@ function random_messages.read_messages()
"Use medkits to gradually restore your health.", "Use medkits to gradually restore your health.",
"Moving or fighting while using medkits will interrupt the healing process.", "Moving or fighting while using medkits will interrupt the healing process.",
"Knights have a slight damage bonus (up to 1.5 hp) when attacking with swords.", "Knights have a slight damage bonus (up to 1.5 hp) when attacking with swords.",
"Gain more score by killing more than you die, by healing teammates as a medic, or by capturing the flag.", "Gain more score by killing enemies, healing teammates as a medic, or by capturing the flag.",
"You gain more score the better the opponent you defeat.", "You gain more score the better the opponent you defeat.",
"Find weapons in chests or mine and use furnaces to make stronger swords.", "Find weapons in chests or mine and use furnaces to make stronger swords.",
"Players are immune to attack for 5 seconds after they respawn.", "Players are immune to attack for 5 seconds after they respawn.",
"Access the pro section of the chest by achieving a 10k+ score and either killing 3 people for every 2 deaths and capture the flag 10 times or killing as many people as you die, capturing the flag on every 3rd attempt and at least 30 times.", "Access the pro section of the chest by achieving a 10k+ score and either killing 3 people for every 2 deaths and capturing the flag 10 times or killing as many people as you die, capturing the flag on every 3rd attempt and at least 30 times.",
"Use team doors (steel) to stop the enemy walking into your base.", "Use team doors (steel) to stop the enemy walking into your base.",
"Craft 6 cobbles and 1 steel ingot together to make reinforced cobble.", "Craft 6 cobbles and 1 steel ingot together to make reinforced cobble.",
"Sprint by pressing the fast key (E) when you have stamina.", "Sprint by pressing the fast key (E) when you have stamina.",
@ -80,6 +80,7 @@ function random_messages.read_messages()
"Hitting your enemy does more damage than not hitting them.", "Hitting your enemy does more damage than not hitting them.",
"Press right mouse button or double-tap the screen to activate scope while wielding a sniper rifle.", "Press right mouse button or double-tap the screen to activate scope while wielding a sniper rifle.",
"Medics can dig pillars by right clicking the base of one with their paxel.", "Medics can dig pillars by right clicking the base of one with their paxel.",
"Use `/help all` to see all available commands.",
} }
end end

View file

@ -36,6 +36,13 @@ local function setSprinting(player, info, sprinting)
end end
end end
ctf_match.register_on_new_match(function()
for pname in pairs(players) do
local player = minetest.get_player_by_name(pname)
players[player:get_player_name()].stamina = STAMINA_MAX
end
end)
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
for name, info in pairs(players) do for name, info in pairs(players) do
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)

View file

@ -1,3 +1,3 @@
name = sprint name = sprint
depends = medkits, physics depends = medkits, physics, ctf_match
optional_depends = hudbars optional_depends = hudbars