Update fork with my local version

copy/pasted my version to this fork.
master
Elkien3 2017-06-14 14:33:21 -05:00
parent d68620234d
commit 6e6631e1fb
7 changed files with 94 additions and 8 deletions

View File

@ -310,6 +310,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
ctf.diplo.set(tname, tname2, "peace")
ctf.post(tname, {
msg = "You have cancelled the alliance treaty with " .. tname2 })
irc:say(tname .. " has cancelled the alliance treaty with " .. tname2 .. "!")
minetest.chat_send_all(tname .. " has cancelled the alliance treaty with " .. tname2 .. "!")
ctf.post(tname2, {
msg = tname .. " has cancelled the alliance treaty" })
end
@ -323,9 +325,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
ctf.diplo.set(tname, tname2, "war")
ctf.post(tname, {
msg = "You have declared war on " .. tname2 })
irc:say(tname .. "has declared war on " .. tname2 .. "!")
minetest.chat_send_all(tname .. "has declared war on " .. tname2 .. "!")
ctf.post(tname2, {
msg = tname .. " has declared war on you" })
ctf.gui.show(name, "diplo")
return true
end

View File

@ -196,6 +196,7 @@ function ctf.join(name, team, force, by)
minetest.log("action", name .. " joined team " .. team)
minetest.chat_send_all(name.." has joined team "..team)
minetest.get_player_privs(name).initial_team_join = false
for i = 1, #ctf.registered_on_join_team do
ctf.registered_on_join_team[i](name, team)
@ -363,14 +364,14 @@ function ctf.move_to_spawn(name)
end
return false
end
--[[
minetest.register_on_respawnplayer(function(player)
if not player then
return false
end
return ctf.move_to_spawn(player:get_player_name())
end)
end)--]]
function ctf.get_territory_owner(pos)
local largest = nil

View File

@ -139,7 +139,66 @@ minetest.register_chatcommand("team", {
})
minetest.register_chatcommand("join", {
params = "team name",
params = "player name",
description = "Add to team",
func = function(name, param)
local team = ctf.player(name).team
if minetest.get_auth_handler().get_auth(param) == nil then
return false, "Player '" .. param .. "' dosn't exist!"
elseif ctf.player(param).team then
return false, param .. " is already in a team!"
else
if ctf.player(name).auth then
if ctf.join(param, team, false, name) then
return true, "Joined " .. param .. " to " .. team .. "!"
else
return false, "Failed to join team!"
end
else
return false, "You are not the team owner!"
end
end
end
})
minetest.register_chatcommand("teamkick", {
params = "player name",
description = "Kick player from your team",
func = function(name, param)
local team = ctf.player(name).team
if ctf.player(param).team ~= team then
return false, param .. " is not in your team!"
else
if ctf.player(name).auth then
if ctf.remove_player(param) then
return true, "Kicked " .. param .. " from " .. team .. "!"
else
return false, "Failed to kick " .. param.. "!"
end
else
return false, "You are not the team owner!"
end
end
end
})
minetest.register_chatcommand("teamleave", {
params = "none",
description = "Leave your team",
func = function(name, param)
local team = ctf.player(name).team
if ctf.player(param).team ~= nil then
if ctf.remove_player(param) then
return true, "You have left " .. team .. "!"
else
return false, "Failed to leave " .. team.. "!"
end
else
return false, "You are not in a team!"
end
end
})
--[[
minetest.register_chatcommand("join", {
params = "player name",
description = "Add to team",
func = function(name, param)
if ctf.join(name, param, false, name) then
@ -148,7 +207,7 @@ minetest.register_chatcommand("join", {
return false, "Failed to join team!"
end
end
})
})--]]
minetest.register_chatcommand("ctf_clean", {
description = "Do admin cleaning stuff",
@ -261,7 +320,7 @@ minetest.register_chatcommand("all", {
end
end
})
--[[
minetest.register_chatcommand("t", {
params = "msg",
description = "Send a message on the team channel",
@ -290,7 +349,7 @@ minetest.register_chatcommand("t", {
"You're not in a team, so you have no team to talk to.")
end
end
})
})--]]
-- Chat plus stuff
if minetest.global_exists("chatplus") then

View File

@ -35,8 +35,20 @@ function ctf_colors.update(player, name, tplayer)
if ctf.setting("colors.skins") and tcolor_text and tcolor_hex then
if minetest.global_exists("armor") then
-- TODO: how should support for skin mods be done?
if minetest.get_modpath("player_textures") then
local filename = minetest.get_modpath("player_textures").."/textures/player_"..name
local f = io.open(filename..".png")
if f then
f:close()
armor.textures[name].skin ="player_"..name..".png"
armor:update_player_visuals(player)
else
armor.textures[name].skin = "ctf_colors_skin_" .. tcolor_text .. ".png"
armor:update_player_visuals(player)
end
end
else
player:set_properties({
textures = {"ctf_colors_skin_" .. tcolor_text .. ".png"}

View File

@ -53,6 +53,7 @@ local function do_capture(attname, flag, returned)
minetest.chat_send_all(flag_name.." has been captured "..
" by "..attname.." (team "..attacker.team..")")
irc:say(flag_name.." has been captured by "..attname.." (team "..attacker.team..")")
ctf.action("flag", attname .. " captured " .. flag_name)

View File

@ -24,7 +24,16 @@ minetest.register_node("ctf_flag:flag", {
on_construct = ctf_flag.on_construct,
after_place_node = ctf_flag.after_place_node
})
--[[
minetest.register_craft({
output = "ctf_flag:flag",
recipe = {
{"default:stick", "group:wool"},
{"default:stick", "",},
{"default:stick", ""}
}
})
--]]
for color, _ in pairs(ctf.flag_colors) do
minetest.register_node("ctf_flag:flag_top_"..color,{
description = "You are not meant to have this! - flag top",

View File

@ -177,6 +177,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.set_node(pos,{name="air"})
pos.y=pos.y+1
minetest.set_node(pos,{name="air"})
player:get_inventory():add_item('main', 'ctf_flag:flag')
return true
end