Compare commits

...

5 Commits

Author SHA1 Message Date
Milan 8cc712fbe0 update colorstyles and some messages 2018-01-09 21:17:06 +01:00
Milan a0fa370427 Merge branch 'master' of https://git.tchncs.de/Illuna-Minetest/ctf_pvp_engine into HEAD 2018-01-01 23:17:28 +01:00
Milan 170496c679 colorize 2018-01-01 23:16:17 +01:00
rubenwardy 2601a44b0e Extend flag no build area to include floor 2017-11-12 01:41:18 +00:00
rubenwardy 9a10f60e97 Fix mistakes 2017-11-08 00:53:01 +00:00
11 changed files with 22 additions and 12 deletions

View File

@ -1,3 +1,4 @@
local regular = minetest.setting_get("color_regular")
-- Get or add a team
function ctf.team(name)
if name == nil then
@ -200,7 +201,7 @@ function ctf.join(name, team, force, by)
ctf.needs_save = true
minetest.log("action", name .. " joined team " .. team)
minetest.chat_send_all(name.." has joined team "..team)
minetest.chat_send_all(core.colorize(regular, name.." has joined team "..team))
for i = 1, #ctf.registered_on_join_team do
ctf.registered_on_join_team[i](name, team)

View File

@ -11,6 +11,9 @@ function minetest.is_player_name_valid(name)
return name:match("^[%a%d_-]+$")
end
local important = minetest.setting_get("color_regular")
local failure = minetest.setting_get("color_failure")
local function team_console_help(name)
minetest.chat_send_player(name, "Try:")
minetest.chat_send_player(name, "/team - show team panel")
@ -231,8 +234,8 @@ minetest.register_chatcommand("ctf_reset", {
description = "Delete all CTF saved states and start again.",
privs = {ctf_admin=true},
func = function(name, param)
minetest.chat_send_all("The CTF core was reset by the admin. All team memberships," ..
"flags, land ownerships etc have been deleted.")
minetest.chat_send_all(core.colorize(failure, "The CTF core was reset by the admin. All team memberships," ..
"flags, land ownerships etc have been deleted."))
ctf.reset()
return true, "Reset CTF core."
end,
@ -321,7 +324,7 @@ minetest.register_chatcommand("all", {
chatplus.log(tosend)
end
else
minetest.chat_send_all("<"..name.."> "..param)
minetest.chat_send_all(core.colorize(regular, "<"..name.."> "..param))
end
end
})

View File

@ -1,3 +1,6 @@
local regular = minetest.setting_get("color_regular")
local failure = minetest.setting_get("color_failure")
ctf_flag.registered_on_capture = {}
function ctf_flag.register_on_capture(func)
if ctf._mt_loaded then
@ -79,7 +82,7 @@ function ctf_flag.player_drop_flag(name)
ctf.hud.updateAll()
ctf.action("flag", name .. " dropped " .. flag_name)
minetest.chat_send_all(flag_name.." has returned.")
minetest.chat_send_all(core.colorize(regular, flag_name.." has returned."))
for i = 1, #ctf_flag.registered_on_drop do
ctf_flag.registered_on_drop[i](name, flag)
@ -167,7 +170,7 @@ function ctf_flag.get(pos)
team.flags[i].z == pos.z
) then
if result then
minetest.chat_send_all("[CTF ERROR] Multiple teams have same flag. Please report this to the server operator / admin")
minetest.chat_send_all(core.colorize(failure, "[CTF ERROR] Multiple teams have same flag. Please report this to the server operator / admin"))
print("CTF ERROR DATA")
print("Multiple teams have same flag.")
print("This is a sign of ctf.txt corruption.")

View File

@ -1,3 +1,6 @@
local important = minetest.setting_get("color_important")
local regular = minetest.setting_get("color_regular")
local function do_capture(attname, flag, returned)
local team = flag.team
local attacker = ctf.player(attname)
@ -16,8 +19,8 @@ local function do_capture(attname, flag, returned)
end
end
minetest.chat_send_all(flag_name.." has been picked up by "..
attname.." (team "..attacker.team..")")
minetest.chat_send_all(core.colorize(important, flag_name.." has been picked up by "..
attname.." (team "..attacker.team..")"))
ctf.action("flag", attname .. " picked up " .. flag_name)
@ -51,8 +54,8 @@ local function do_capture(attname, flag, returned)
end
end
minetest.chat_send_all(flag_name.." has been captured "..
" by "..attname.." (team "..attacker.team..")")
minetest.chat_send_all(core.colorize(important, flag_name.." has been captured "..
" by "..attname.." (team "..attacker.team..")"))
ctf.action("flag", attname .. " captured " .. flag_name)
@ -216,7 +219,7 @@ ctf_flag = {
if team.spawn and not ctf.setting("flag.allow_multiple") and
minetest.get_node(team.spawn).name == "ctf_flag:flag" then
-- send message
minetest.chat_send_all(tname .. "'s flag has been moved")
minetest.chat_send_all(core.colorize(regular, tname .. "'s flag has been moved"))
minetest.set_node(team.spawn, {name="air"})
minetest.set_node({
x = team.spawn.x,

View File

@ -86,7 +86,7 @@ function minetest.is_protected(pos, name)
end
local flag, distSQ = ctf_flag.get_nearest(pos)
if flag and pos.y >= flag.y and distSQ < rs then
if flag and pos.y >= flag.y - 1 and distSQ < rs then
minetest.chat_send_player(name,
"Too close to the flag to build! Leave at least " .. r .. " blocks around the flag.")
return true