Fix a load of issues, add luacheck and travis
This commit is contained in:
parent
c21b192f82
commit
7bd82dca86
28 changed files with 144 additions and 107 deletions
35
.luacheckrc
Normal file
35
.luacheckrc
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
unused_args = false
|
||||||
|
allow_defined_top = true
|
||||||
|
|
||||||
|
exclude_files = {
|
||||||
|
"mods/default",
|
||||||
|
"mods/ctf_pvp_engine",
|
||||||
|
"mods/shooter",
|
||||||
|
"mods/wield3d",
|
||||||
|
"mods/treasurer",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"crafting", "vector", "table", "minetest",
|
||||||
|
"worldedit", "ctf", "ctf_flag", "ctf_colors",
|
||||||
|
"hudkit", "default", "treasurer", "ChatCmdBuilder",
|
||||||
|
}
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
string = {fields = {"split"}},
|
||||||
|
table = {fields = {"copy", "getn"}},
|
||||||
|
|
||||||
|
"dump", "DIR_DELIM",
|
||||||
|
"sfinv", "creative",
|
||||||
|
"irc",
|
||||||
|
"VoxelArea", "ItemStack",
|
||||||
|
"Settings",
|
||||||
|
"prometheus", "hb",
|
||||||
|
|
||||||
|
|
||||||
|
-- Testing
|
||||||
|
"describe",
|
||||||
|
"it",
|
||||||
|
"assert",
|
||||||
|
}
|
12
.travis.yml
Normal file
12
.travis.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
language: generic
|
||||||
|
sudo: false
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- luarocks
|
||||||
|
before_install:
|
||||||
|
- luarocks install --local luacheck
|
||||||
|
script:
|
||||||
|
- $HOME/.luarocks/bin/luacheck --no-color .
|
||||||
|
notifications:
|
||||||
|
email: false
|
|
@ -51,7 +51,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
--Warn player if he/she has less than WARN_TIME seconds to move or be kicked
|
--Warn player if he/she has less than WARN_TIME seconds to move or be kicked
|
||||||
if players[playerName]["lastAction"] + MAX_INACTIVE_TIME - WARN_TIME < currGameTime then
|
if players[playerName]["lastAction"] + MAX_INACTIVE_TIME - WARN_TIME < currGameTime then
|
||||||
minetest.chat_send_player(playerName, minetest.colorize(#FF8C00,"Warning, you have " .. tostring(players[playerName]["lastAction"] + MAX_INACTIVE_TIME - currGameTime) .. " seconds to move or be kicked"))
|
minetest.chat_send_player(playerName, minetest.colorize("#FF8C00", "Warning, you have " .. tostring(players[playerName]["lastAction"] + MAX_INACTIVE_TIME - currGameTime) .. " seconds to move or be kicked"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -138,9 +138,9 @@ end
|
||||||
minetest.after(30*60, cp_tick)
|
minetest.after(30*60, cp_tick)
|
||||||
|
|
||||||
function chatplus.poke(name,player)
|
function chatplus.poke(name,player)
|
||||||
local function check(name,value)
|
local function check(name2, value)
|
||||||
if not chatplus.players[name][value] then
|
if not chatplus.players[name2][value] then
|
||||||
chatplus.players[name][value] = {}
|
chatplus.players[name2][value] = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not chatplus.players[name] then
|
if not chatplus.players[name] then
|
||||||
|
|
|
@ -93,13 +93,13 @@ minetest.registered_chatcommands["msg"].func = function(name, param)
|
||||||
if not sendto then
|
if not sendto then
|
||||||
return false, "Invalid usage, see /help msg."
|
return false, "Invalid usage, see /help msg."
|
||||||
end
|
end
|
||||||
if not core.get_player_by_name(sendto) then
|
if not minetest.get_player_by_name(sendto) then
|
||||||
return false, "The player " .. sendto
|
return false, "The player " .. sendto
|
||||||
.. " is not online."
|
.. " is not online."
|
||||||
end
|
end
|
||||||
core.log("action", "PM from " .. name .. " to " .. sendto
|
minetest.log("action", "PM from " .. name .. " to " .. sendto
|
||||||
.. ": " .. message)
|
.. ": " .. message)
|
||||||
core.chat_send_player(sendto, minetest.colorize("#00FF55",
|
minetest.chat_send_player(sendto, minetest.colorize("#00FF55",
|
||||||
"PM from " .. name .. ": " .. message))
|
"PM from " .. name .. ": " .. message))
|
||||||
return true, "Message sent."
|
return true, "Message sent."
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,6 +24,16 @@ local function bounty_player(target)
|
||||||
|
|
||||||
bountied_player = target
|
bountied_player = target
|
||||||
|
|
||||||
|
-- Score * K/D
|
||||||
|
-- bounty_score = -----------, or 500 (whichever is lesser)
|
||||||
|
-- 10000
|
||||||
|
|
||||||
|
local pstat, _ = ctf_stats.player(target)
|
||||||
|
bounty_score = (pstat.score * (pstat.kills / pstat.deaths)) / 10000
|
||||||
|
if bounty_score > 500 then
|
||||||
|
bounty_score = 500
|
||||||
|
end
|
||||||
|
|
||||||
minetest.after(0.1, announce_all)
|
minetest.after(0.1, announce_all)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,7 +41,7 @@ local function bounty_find_new_target()
|
||||||
local players = {}
|
local players = {}
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local pstat, mstat = ctf_stats.player(name)
|
local pstat, _ = ctf_stats.player(name)
|
||||||
pstat.name = name
|
pstat.name = name
|
||||||
pstat.color = nil
|
pstat.color = nil
|
||||||
if pstat.score > 1000 and pstat.kills > pstat.deaths * 1.5 then
|
if pstat.score > 1000 and pstat.kills > pstat.deaths * 1.5 then
|
||||||
|
@ -41,14 +51,6 @@ local function bounty_find_new_target()
|
||||||
|
|
||||||
if #players > 0 then
|
if #players > 0 then
|
||||||
bounty_player(players[math.random(1, #players)].name)
|
bounty_player(players[math.random(1, #players)].name)
|
||||||
|
|
||||||
-- Score * K/D
|
|
||||||
-- bounty_score = -----------, or 500 (whichever is lesser)
|
|
||||||
-- 10000
|
|
||||||
bounty_score = (pstat.score * (pstat.kills / pstat.deaths)) / 10000
|
|
||||||
if bounty_score > 500 then
|
|
||||||
bounty_score = 500
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.after(math.random(500, 1000), bounty_find_new_target)
|
minetest.after(math.random(500, 1000), bounty_find_new_target)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
ctf.save = function()
|
ctf.save = function()
|
||||||
for i = 1, #ctf.registered_on_save do
|
for i = 1, #ctf.registered_on_save do
|
||||||
local res = ctf.registered_on_save[i]()
|
ctf.registered_on_save[i]()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ function ctf_events.update_row(i, player, name, tplayer, evt)
|
||||||
|
|
||||||
-- One
|
-- One
|
||||||
if evt.one then
|
if evt.one then
|
||||||
local tone_text, tone_hex = ctf_colors.get_color(evt.one, ctf.player(evt.one))
|
local _, tone_hex = ctf_colors.get_color(evt.one, ctf.player(evt.one))
|
||||||
if hud:exists(player, idx) then
|
if hud:exists(player, idx) then
|
||||||
hud:change(player, idx, "text", evt.one)
|
hud:change(player, idx, "text", evt.one)
|
||||||
hud:change(player, idx, "number", tone_hex)
|
hud:change(player, idx, "number", tone_hex)
|
||||||
|
@ -60,7 +60,7 @@ function ctf_events.update_row(i, player, name, tplayer, evt)
|
||||||
|
|
||||||
-- Two
|
-- Two
|
||||||
if evt.two then
|
if evt.two then
|
||||||
local ttwo_text, ttwo_hex = ctf_colors.get_color(evt.two, ctf.player(evt.two))
|
local _, ttwo_hex = ctf_colors.get_color(evt.two, ctf.player(evt.two))
|
||||||
if hud:exists(player, idx2) then
|
if hud:exists(player, idx2) then
|
||||||
hud:change(player, idx2, "text", evt.two)
|
hud:change(player, idx2, "text", evt.two)
|
||||||
hud:change(player, idx2, "number", ttwo_hex)
|
hud:change(player, idx2, "number", ttwo_hex)
|
||||||
|
|
|
@ -4,8 +4,8 @@ local c_glass = minetest.get_content_id("ctf_map:ind_glass")
|
||||||
local c_glass_red = minetest.get_content_id("ctf_map:ind_glass_red")
|
local c_glass_red = minetest.get_content_id("ctf_map:ind_glass_red")
|
||||||
local c_map_ignore = minetest.get_content_id("ctf_map:ignore")
|
local c_map_ignore = minetest.get_content_id("ctf_map:ignore")
|
||||||
local c_actual_st = minetest.get_content_id("default:stone")
|
local c_actual_st = minetest.get_content_id("default:stone")
|
||||||
local c_water = minetest.get_content_id("default:water_source")
|
-- local c_water = minetest.get_content_id("default:water_source")
|
||||||
local c_water_f = minetest.get_content_id("default:water_flowing")
|
-- local c_water_f = minetest.get_content_id("default:water_flowing")
|
||||||
local c_air = minetest.get_content_id("air")
|
local c_air = minetest.get_content_id("air")
|
||||||
|
|
||||||
function ctf_map.remove_middle_barrier()
|
function ctf_map.remove_middle_barrier()
|
||||||
|
@ -118,6 +118,7 @@ function ctf_map.place_outer_barrier(center, r, h)
|
||||||
print("Placing left wall")
|
print("Placing left wall")
|
||||||
|
|
||||||
-- Left
|
-- Left
|
||||||
|
do
|
||||||
local x = center.x - r
|
local x = center.x - r
|
||||||
for z = minp.z, maxp.z do
|
for z = minp.z, maxp.z do
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
|
@ -129,10 +130,12 @@ function ctf_map.place_outer_barrier(center, r, h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print("Placing right wall")
|
print("Placing right wall")
|
||||||
|
|
||||||
-- Right
|
-- Right
|
||||||
|
do
|
||||||
local x = center.x + r
|
local x = center.x + r
|
||||||
for z = minp.z, maxp.z do
|
for z = minp.z, maxp.z do
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
|
@ -144,10 +147,12 @@ function ctf_map.place_outer_barrier(center, r, h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print("Placing front wall")
|
print("Placing front wall")
|
||||||
|
|
||||||
-- Front
|
-- Front
|
||||||
|
do
|
||||||
local z = center.z - r
|
local z = center.z - r
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
|
@ -159,10 +164,12 @@ function ctf_map.place_outer_barrier(center, r, h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print("Placing back wall")
|
print("Placing back wall")
|
||||||
|
|
||||||
-- Back
|
-- Back
|
||||||
|
do
|
||||||
local z = center.z + r
|
local z = center.z + r
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
|
@ -174,6 +181,7 @@ function ctf_map.place_outer_barrier(center, r, h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
print("Writing to engine!")
|
print("Writing to engine!")
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,12 @@ minetest.register_node("ctf_map:flag", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local randint = math.random(100)
|
||||||
|
local barrier_r = 110
|
||||||
|
local mapname = "ctf_" .. randint
|
||||||
|
local maptitle = "Untitled Map " .. randint
|
||||||
|
local mapauthor = nil
|
||||||
|
local center_barrier_rot = 0
|
||||||
local center = { x = 0, y = 0, z = 0, r = 115, h = 140 }
|
local center = { x = 0, y = 0, z = 0, r = 115, h = 140 }
|
||||||
local function to_2pos()
|
local function to_2pos()
|
||||||
return {
|
return {
|
||||||
|
@ -130,13 +136,6 @@ local function get_flag_status()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local randint = math.random(100)
|
|
||||||
local barrier_r = 110
|
|
||||||
local mapname = "ctf_" .. randint
|
|
||||||
local maptitle = "Untitled Map " .. randint
|
|
||||||
local mapauthor = nil
|
|
||||||
local center_barrier_rot = 1
|
|
||||||
local function show_gui(name)
|
local function show_gui(name)
|
||||||
mapauthor = mapauthor or name
|
mapauthor = mapauthor or name
|
||||||
|
|
||||||
|
|
|
@ -120,11 +120,6 @@ function ctf_match.load_map_meta(idx, name)
|
||||||
map.teams[tname] = {
|
map.teams[tname] = {
|
||||||
color = tcolor,
|
color = tcolor,
|
||||||
pos = vector.add(offset, tpos),
|
pos = vector.add(offset, tpos),
|
||||||
chests = {
|
|
||||||
from = chests1,
|
|
||||||
to = chests2,
|
|
||||||
n = tonumber(meta:get("team." .. i .. ".num_chests") or "23"),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
@ -200,8 +195,6 @@ ctf_match.register_on_new_match(function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function ctf_match.create_teams()
|
function ctf_match.create_teams()
|
||||||
local number = ctf.setting("match.teams")
|
|
||||||
|
|
||||||
for key, value in pairs(ctf_map.map.teams) do
|
for key, value in pairs(ctf_map.map.teams) do
|
||||||
local name = key
|
local name = key
|
||||||
local color = value.color
|
local color = value.color
|
||||||
|
|
|
@ -33,8 +33,8 @@ function ctf_match.vote_next(name, params)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_vote = function(self, name, value)
|
on_vote = function(self, voter, value)
|
||||||
minetest.chat_send_all(name .. " voted " .. value .. " to '" ..
|
minetest.chat_send_all(voter .. " voted " .. value .. " to '" ..
|
||||||
self.description .. "'")
|
self.description .. "'")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -51,9 +51,9 @@ minetest.register_chatcommand("vote", {
|
||||||
minetest.register_on_chat_message(function(name, msg)
|
minetest.register_on_chat_message(function(name, msg)
|
||||||
if msg == "/vote_next" and minetest.check_player_privs(name,
|
if msg == "/vote_next" and minetest.check_player_privs(name,
|
||||||
{interact=true, vote_starter=true}) then
|
{interact=true, vote_starter=true}) then
|
||||||
local suc, msg = ctf_match.vote_next(name)
|
local _, vmsg = ctf_match.vote_next(name)
|
||||||
if msg then
|
if vmsg then
|
||||||
minetest.chat_send_player(name, msg)
|
minetest.chat_send_player(name, vmsg)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ local function step()
|
||||||
local avg = 0
|
local avg = 0
|
||||||
if #minetest.get_connected_players() > 0 then
|
if #minetest.get_connected_players() > 0 then
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local total, match = ctf_stats.player(player:get_player_name())
|
local total, _ = ctf_stats.player(player:get_player_name())
|
||||||
sum = sum + total.score
|
sum = sum + total.score
|
||||||
end
|
end
|
||||||
avg = sum / #minetest.get_connected_players()
|
avg = sum / #minetest.get_connected_players()
|
||||||
|
|
|
@ -72,7 +72,6 @@ function ctf_stats.get_html(title, players)
|
||||||
|
|
||||||
for i = 1, #players do
|
for i = 1, #players do
|
||||||
local pstat = players[i]
|
local pstat = players[i]
|
||||||
local color = pstat.color or "#ffffff"
|
|
||||||
local kd = pstat.kills
|
local kd = pstat.kills
|
||||||
if pstat.deaths > 0 then
|
if pstat.deaths > 0 then
|
||||||
kd = kd / pstat.deaths
|
kd = kd / pstat.deaths
|
||||||
|
|
|
@ -181,7 +181,7 @@ end)
|
||||||
|
|
||||||
ctf_flag.register_on_precapture(function(name, flag)
|
ctf_flag.register_on_precapture(function(name, flag)
|
||||||
local tplayer = ctf.player(name)
|
local tplayer = ctf.player(name)
|
||||||
local main, match = ctf_stats.player(name)
|
local main, _ = ctf_stats.player(name)
|
||||||
if main then
|
if main then
|
||||||
main.wins[tplayer.team] = main.wins[tplayer.team] + 1
|
main.wins[tplayer.team] = main.wins[tplayer.team] + 1
|
||||||
ctf.needs_save = true
|
ctf.needs_save = true
|
||||||
|
|
|
@ -13,9 +13,9 @@ function ctf_team_base.place(color, pos)
|
||||||
for y = pos.y, pos.y + 3 do
|
for y = pos.y, pos.y + 3 do
|
||||||
for x = pos.x - 3, pos.x + 3 do
|
for x = pos.x - 3, pos.x + 3 do
|
||||||
for z = pos.z - 3, pos.z + 3 do
|
for z = pos.z - 3, pos.z + 3 do
|
||||||
local pos = {x=x, y=y, z=z}
|
local pos2 = {x=x, y=y, z=z}
|
||||||
if minetest.get_node(pos).name == "default:tree" then
|
if minetest.get_node(pos2).name == "default:tree" then
|
||||||
minetest.set_node(pos, {name="air"})
|
minetest.set_node(pos2, {name="air"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -28,13 +28,13 @@ function ctf_team_base.place(color, pos)
|
||||||
dz = -2
|
dz = -2
|
||||||
chest.param2 = minetest.dir_to_facedir({x=0,y=0,z=-1})
|
chest.param2 = minetest.dir_to_facedir({x=0,y=0,z=-1})
|
||||||
end
|
end
|
||||||
local pos = {
|
local pos3 = {
|
||||||
x = pos.x,
|
x = pos.x,
|
||||||
y = pos.y,
|
y = pos.y,
|
||||||
z = pos.z + dz
|
z = pos.z + dz
|
||||||
}
|
}
|
||||||
minetest.set_node(pos, chest)
|
minetest.set_node(pos3, chest)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos3):get_inventory()
|
||||||
inv:add_item("main", ItemStack("default:cobble 99"))
|
inv:add_item("main", ItemStack("default:cobble 99"))
|
||||||
inv:add_item("main", ItemStack("default:cobble 99"))
|
inv:add_item("main", ItemStack("default:cobble 99"))
|
||||||
inv:add_item("main", ItemStack("default:cobble 99"))
|
inv:add_item("main", ItemStack("default:cobble 99"))
|
||||||
|
|
|
@ -90,7 +90,6 @@ for _, chest_color in pairs(colors) do
|
||||||
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index,
|
allow_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
to_list, to_index, count, player)
|
to_list, to_index, count, player)
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
if chest_color ~= ctf.player(player:get_player_name()).team then
|
if chest_color ~= ctf.player(player:get_player_name()).team then
|
||||||
minetest.chat_send_player(player:get_player_name(), "You're not on team " .. chest_color)
|
minetest.chat_send_player(player:get_player_name(), "You're not on team " .. chest_color)
|
||||||
return 0
|
return 0
|
||||||
|
@ -125,7 +124,6 @@ for _, chest_color in pairs(colors) do
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
if chest_color ~= ctf.player(player:get_player_name()).team then
|
if chest_color ~= ctf.player(player:get_player_name()).team then
|
||||||
minetest.chat_send_player(player:get_player_name(), "You're not on team " .. chest_color)
|
minetest.chat_send_player(player:get_player_name(), "You're not on team " .. chest_color)
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
if minetest.register_can_bypass_userlimit then
|
if minetest.register_can_bypass_userlimit then
|
||||||
minetest.register_can_bypass_userlimit(function(name, ip)
|
minetest.register_can_bypass_userlimit(function(name, ip)
|
||||||
local pstat, discard = ctf_stats.player_or_nil(name)
|
local pstat, _ = ctf_stats.player_or_nil(name)
|
||||||
local actual_max_users = tonumber(minetest.settings:get("max_users")) +
|
local actual_max_users = tonumber(minetest.settings:get("max_users")) +
|
||||||
tonumber(minetest.settings:get("max_extra_users") or "10")
|
tonumber(minetest.settings:get("max_extra_users") or "10")
|
||||||
local req_score = tonumber(minetest.settings:get("userlimit_bypass_required_score") or "10000")
|
local req_score = tonumber(minetest.settings:get("userlimit_bypass_required_score") or "10000")
|
||||||
|
|
|
@ -15,7 +15,7 @@ local function drop(pos, itemstack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local obj = core.add_item(pos, it)
|
local obj = minetest.add_item(pos, it)
|
||||||
|
|
||||||
if obj then
|
if obj then
|
||||||
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
|
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
|
||||||
|
|
|
@ -79,15 +79,14 @@ end)
|
||||||
function email.get_formspec(name)
|
function email.get_formspec(name)
|
||||||
local inbox = email.get_inbox(name)
|
local inbox = email.get_inbox(name)
|
||||||
|
|
||||||
local fs = "vertlabel[0,0;Your Inbox]"
|
local function row(fs, c1, date, from, msg)
|
||||||
|
|
||||||
function row(fs, c1, date, from, msg)
|
|
||||||
date = minetest.formspec_escape(date)
|
date = minetest.formspec_escape(date)
|
||||||
from = minetest.formspec_escape(from)
|
from = minetest.formspec_escape(from)
|
||||||
msg = minetest.formspec_escape(msg)
|
msg = minetest.formspec_escape(msg)
|
||||||
return fs .. ",#d0d0d0," .. table.concat({date, c1, from, msg}, ",")
|
return fs .. ",#d0d0d0," .. table.concat({date, c1, from, msg}, ",")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local fs = "vertlabel[0,0;Your Inbox]"
|
||||||
fs = fs .. "tablecolumns[color;text;color;text;text]"
|
fs = fs .. "tablecolumns[color;text;color;text;text]"
|
||||||
fs = fs .. "tableoptions[highlight=#ffffff33]"
|
fs = fs .. "tableoptions[highlight=#ffffff33]"
|
||||||
fs = fs .. "table[0.5,0;11.25,7;inbox;"
|
fs = fs .. "table[0.5,0;11.25,7;inbox;"
|
||||||
|
@ -138,8 +137,6 @@ function email.show_inbox(name, text_mode)
|
||||||
|
|
||||||
return true, "Opened inbox!"
|
return true, "Opened inbox!"
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.global_exists("sfinv") then
|
if minetest.global_exists("sfinv") then
|
||||||
|
|
|
@ -51,12 +51,6 @@ end
|
||||||
-- Node callback functions that are the same for active and inactive furnace
|
-- Node callback functions that are the same for active and inactive furnace
|
||||||
--
|
--
|
||||||
|
|
||||||
local function can_dig(pos, player)
|
|
||||||
local meta = minetest.get_meta(pos);
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -7,7 +7,7 @@ minetest.register_chatcommand("killme", {
|
||||||
player:set_hp(0)
|
player:set_hp(0)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
for _, callback in pairs(core.registered_on_respawnplayers) do
|
for _, callback in pairs(minetest.registered_on_respawnplayers) do
|
||||||
if callback(player) then
|
if callback(player) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,7 +44,7 @@ local function remove_entity_tag(player)
|
||||||
local tag = nametags[player:get_player_name()]
|
local tag = nametags[player:get_player_name()]
|
||||||
if tag then
|
if tag then
|
||||||
tag:remove()
|
tag:remove()
|
||||||
tag = nil
|
nametags[player:get_player_name()] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,8 @@ minetest.register_chatcommand("report", {
|
||||||
local toname = player:get_player_name()
|
local toname = player:get_player_name()
|
||||||
if minetest.check_player_privs(toname, {kick = true, ban = true}) then
|
if minetest.check_player_privs(toname, {kick = true, ban = true}) then
|
||||||
table.insert(mods, toname)
|
table.insert(mods, toname)
|
||||||
minetest.chat_send_player(toname, minetest.colorize(#FFFF00,"-!- " .. name .. " reported: " .. param))
|
minetest.chat_send_player(toname, minetest.colorize("#FFFF00",
|
||||||
|
"-!- " .. name .. " reported: " .. param))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,8 @@ minetest.register_on_punchplayer(function(player, hitter,
|
||||||
|
|
||||||
if hitter and respawn_immunity.is_immune(hitter) then
|
if hitter and respawn_immunity.is_immune(hitter) then
|
||||||
minetest.chat_send_player(hitter:get_player_name(),
|
minetest.chat_send_player(hitter:get_player_name(),
|
||||||
minetest.colorize(#FF8C00,"Your immunity has ended because you attacked a player"))
|
minetest.colorize("#FF8C00",
|
||||||
|
"Your immunity has ended because you attacked a player"))
|
||||||
immune_players[hitter:get_player_name()] = nil
|
immune_players[hitter:get_player_name()] = nil
|
||||||
respawn_immunity.update_effects(hitter)
|
respawn_immunity.update_effects(hitter)
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,6 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
local players = {}
|
local players = {}
|
||||||
local staminaHud = {}
|
|
||||||
|
|
||||||
local function setSprinting(player, info, sprinting)
|
local function setSprinting(player, info, sprinting)
|
||||||
if info.sprinting ~= sprinting then
|
if info.sprinting ~= sprinting then
|
||||||
|
|
|
@ -85,7 +85,6 @@ local t_max = 7 -- maximum amount of treasures found in a chest
|
||||||
|
|
||||||
local water_level = tonumber(minetest.setting_get("water_level"))
|
local water_level = tonumber(minetest.setting_get("water_level"))
|
||||||
local get_node = minetest.get_node
|
local get_node = minetest.get_node
|
||||||
local env = minetest.env
|
|
||||||
|
|
||||||
local function findGroundLevel(pos, y_min, y_max)
|
local function findGroundLevel(pos, y_min, y_max)
|
||||||
local ground = nil
|
local ground = nil
|
||||||
|
@ -153,9 +152,9 @@ local function placeChest(pos, chest_pos, ground, nn)
|
||||||
|
|
||||||
-- Get treasure
|
-- Get treasure
|
||||||
local treasure_amount = math.ceil(math.random(t_min, t_max))
|
local treasure_amount = math.ceil(math.random(t_min, t_max))
|
||||||
local height = math.abs(h_min) - math.abs(h_max)
|
-- local height = math.abs(h_min) - math.abs(h_max)
|
||||||
local y_norm = (ground+1) - h_min
|
-- local y_norm = (ground+1) - h_min
|
||||||
local scale = 1 - (y_norm/height)
|
-- local scale = 1 - (y_norm/height)
|
||||||
local minp = 0 --scale*4 -- minimal preciousness: 0..4
|
local minp = 0 --scale*4 -- minimal preciousness: 0..4
|
||||||
local maxp = 10 --scale*4+2.1 -- maximum preciousness: 2.1..6.1
|
local maxp = 10 --scale*4+2.1 -- maximum preciousness: 2.1..6.1
|
||||||
local treasures = treasurer.select_random_treasures(treasure_amount, minp, maxp)
|
local treasures = treasurer.select_random_treasures(treasure_amount, minp, maxp)
|
||||||
|
|
|
@ -341,8 +341,8 @@ if set == nil or minetest.is_yes(set) then
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_vote = function(self, name, value)
|
on_vote = function(self, voter, value)
|
||||||
minetest.chat_send_all(name .. " voted " .. value .. " to '" ..
|
minetest.chat_send_all(voter .. " voted " .. value .. " to '" ..
|
||||||
self.description .. "'")
|
self.description .. "'")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue