Compare commits
5 Commits
c56d3c84c1
...
e2a59cef6e
Author | SHA1 | Date |
---|---|---|
rubenwardy | e2a59cef6e | |
rubenwardy | 87d0438db6 | |
rubenwardy | 8b12a8e4f1 | |
rubenwardy | 40c84728d4 | |
rubenwardy | 8ffdefa908 |
|
@ -358,6 +358,23 @@ minetest.register_chatcommand("t", {
|
|||
end
|
||||
})
|
||||
|
||||
if minetest.global_exists("irc") then
|
||||
function irc.playerMessage(name, message)
|
||||
local tname = ctf.player(name).team
|
||||
local color = ctf_colors.get_irc_color(name, ctf.player(name))
|
||||
local clear = "\x0F"
|
||||
if color then
|
||||
color = "\x03" .. color
|
||||
else
|
||||
color = ""
|
||||
clear = ""
|
||||
end
|
||||
local abrace = color .. "<" .. clear
|
||||
local bbrace = color .. ">" .. clear
|
||||
return ("%s%s%s %s"):format(abrace, name, bbrace, message)
|
||||
end
|
||||
end
|
||||
|
||||
-- Chat plus stuff
|
||||
if minetest.global_exists("chatplus") then
|
||||
function chatplus.log_message(from, msg)
|
||||
|
@ -370,22 +387,6 @@ if minetest.global_exists("chatplus") then
|
|||
minetest.chat_send_player(from, minetest.colorize("#" .. colorHex:sub(3, 8), "<" .. from .. "> ") .. msg)
|
||||
end
|
||||
|
||||
if minetest.global_exists("irc") then
|
||||
function irc.playerMessage(name, message)
|
||||
local color = ctf_colors.get_irc_color(name, ctf.player(name))
|
||||
local clear = "\x0F"
|
||||
print("color is " .. color)
|
||||
if color then
|
||||
color = "\x03" .. color
|
||||
else
|
||||
color = ""
|
||||
clear = ""
|
||||
end
|
||||
print("message: " .. ("%s<%s>%s %s"):format(color, name, clear, message))
|
||||
return ("%s<%s>%s %s"):format(color, name, clear, message)
|
||||
end
|
||||
end
|
||||
|
||||
chatplus.register_handler(function(from, to, msg)
|
||||
if not ctf.setting("chat.team_channel") then
|
||||
-- Send to global
|
||||
|
|
|
@ -36,11 +36,6 @@ function ctf_colors.update(player, name, tplayer)
|
|||
|
||||
local tcolor_text, tcolor_hex = ctf_colors.get_color(name, tplayer)
|
||||
|
||||
if ctf.setting("colors.nametag") then
|
||||
player:set_nametag_attributes({
|
||||
color = ctf_colors.get_nametag_color(name, tplayer, tcolor_text, tcolor_hex) })
|
||||
end
|
||||
|
||||
if ctf.setting("colors.hudtint") then
|
||||
if tcolor_text == "red" or tcolor_text == "blue" then
|
||||
print("tinting hud! " .. tcolor_hex)
|
||||
|
@ -82,21 +77,4 @@ function ctf_colors.update(player, name, tplayer)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
ctf.hud.register_part(ctf_colors.update)
|
||||
|
||||
--[[if minetest.global_exists("armor") and armor.get_player_skin then
|
||||
print("3d_armor detected!")
|
||||
local old = armor.get_player_skin
|
||||
function armor.get_player_skin(self, name)
|
||||
local player = ctf.player(name)
|
||||
local team = ctf.team(player.team)
|
||||
if team and team.data.color and ctf.flag_colors[team.data.color] then
|
||||
print("Return ctf_colors_skin_" .. team.data.color .. ".png")
|
||||
return "ctf_colors_skin_" .. team.data.color .. ".png"
|
||||
end
|
||||
print("ctf_colors -!- Reverting to default armor skin")
|
||||
|
||||
return old(self, name)
|
||||
end
|
||||
end]]
|
||||
|
|
|
@ -23,8 +23,6 @@ ctf.flag_colors = ctf_colors.colors
|
|||
ctf.register_on_init(function()
|
||||
ctf.log("colors", "Initialising...")
|
||||
ctf._set("colors.skins", false)
|
||||
ctf._set("colors.nametag", true)
|
||||
ctf._set("colors.nametag.tcolor", false)
|
||||
ctf._set("colors.hudtint", true)
|
||||
ctf._set("hud.teamname", false)
|
||||
end)
|
||||
|
|
|
@ -55,16 +55,16 @@ end)
|
|||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
-- Todo: fix security issue here
|
||||
local name = player:get_player_name()
|
||||
if formname == "ctf:flags" then
|
||||
for key, field in pairs(fields) do
|
||||
local x,y,z = string.match(key, "goto_([%d-]+)_([%d-]+)_([%d-]+)")
|
||||
if x and y and z then
|
||||
player:setpos({ x=tonumber(x), y=tonumber(y), z=tonumber(z) })
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
-- local name = player:get_player_name()
|
||||
-- if formname == "ctf:flags" then
|
||||
-- for key, field in pairs(fields) do
|
||||
-- local x,y,z = string.match(key, "goto_([%d-]+)_([%d-]+)_([%d-]+)")
|
||||
-- if x and y and z then
|
||||
-- player:setpos({ x=tonumber(x), y=tonumber(y), z=tonumber(z) })
|
||||
-- return true
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
end)
|
||||
|
||||
-- Flag interface
|
||||
|
|
|
@ -3,13 +3,20 @@ ctf.hud.register_part(function(player, name, tplayer)
|
|||
if ctf.setting("flag.waypoints") then
|
||||
for tname, team in pairs(ctf.teams) do
|
||||
for _, flag in pairs(team.flags) do
|
||||
local hud = "ctf:hud_" .. flag.x .. "_" .. flag.y .. "_" .. flag.z
|
||||
local hud = "ctf:hud_" .. tname
|
||||
local flag_name = flag.name or tname .. "'s base"
|
||||
local color = ctf.flag_colors[team.data.color]
|
||||
if not color then
|
||||
color = "0x000000"
|
||||
end
|
||||
if not ctf.hud:exists(player, hud) then
|
||||
|
||||
if ctf.hud:exists(player, hud) then
|
||||
ctf.hud:change(player, hud, "world_pos", {
|
||||
x = flag.x,
|
||||
y = flag.y,
|
||||
z = flag.z
|
||||
})
|
||||
else
|
||||
ctf.hud:add(player, hud, {
|
||||
hud_elem_type = "waypoint",
|
||||
name = flag_name,
|
||||
|
|
|
@ -114,24 +114,6 @@ ctf_flag.register_on_pick_up(function(attname, flag)
|
|||
end
|
||||
end)
|
||||
|
||||
-- Change nametag color
|
||||
local oldntc = ctf_colors.get_nametag_color
|
||||
function ctf_colors.get_nametag_color(name, tplayer, tcolor_text, tcolor_hex)
|
||||
if ctf_flag.get_claimed_by_player(name) then
|
||||
return "0xFFFF0000"
|
||||
else
|
||||
return oldntc(name, tplayer, tcolor_text, tcolor_hex)
|
||||
end
|
||||
end
|
||||
|
||||
ctf_flag.register_on_pick_up(function(attname, flag)
|
||||
ctf_colors.update(nil, attname, ctf.player(attname))
|
||||
end)
|
||||
|
||||
ctf_flag.register_on_drop(function(attname, flag)
|
||||
ctf_colors.update(nil, attname, ctf.player(attname))
|
||||
end)
|
||||
|
||||
-- Drop after time
|
||||
local pickup_times = {}
|
||||
ctf_flag.register_on_pick_up(function(attname, flag)
|
||||
|
|
Loading…
Reference in New Issue