Rename global playertag
to ctf_playertag
This commit is contained in:
parent
dc850acd9d
commit
4cb8e731ca
2 changed files with 17 additions and 13 deletions
|
@ -4,7 +4,8 @@ local ATTACH_POSITION = minetest.rgba and {x=0,y=20,z=0} or {x=0,y=10,z=0}
|
||||||
|
|
||||||
local TYPE_BUILTIN = 0
|
local TYPE_BUILTIN = 0
|
||||||
local TYPE_ENTITY = 1
|
local TYPE_ENTITY = 1
|
||||||
playertag = {
|
|
||||||
|
ctf_playertag = {
|
||||||
TYPE_BUILTIN = TYPE_BUILTIN,
|
TYPE_BUILTIN = TYPE_BUILTIN,
|
||||||
TYPE_ENTITY = TYPE_ENTITY,
|
TYPE_ENTITY = TYPE_ENTITY,
|
||||||
}
|
}
|
||||||
|
@ -62,7 +63,7 @@ local function update(player, settings)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function playertag.set(player, type, color)
|
function ctf_playertag.set(player, type, color)
|
||||||
local oldset = tag_settings[player:get_player_name()]
|
local oldset = tag_settings[player:get_player_name()]
|
||||||
color = color or { a=255, r=255, g=255, b=255 }
|
color = color or { a=255, r=255, g=255, b=255 }
|
||||||
if not oldset or oldset.type ~= type or oldset.color ~= color then
|
if not oldset or oldset.type ~= type or oldset.color ~= color then
|
||||||
|
@ -70,11 +71,11 @@ function playertag.set(player, type, color)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function playertag.get(player)
|
function ctf_playertag.get(player)
|
||||||
return tag_settings[player:get_player_by_name()]
|
return tag_settings[player:get_player_by_name()]
|
||||||
end
|
end
|
||||||
|
|
||||||
function playertag.get_all()
|
function ctf_playertag.get_all()
|
||||||
return tag_settings
|
return tag_settings
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -136,11 +137,11 @@ end
|
||||||
minetest.after(10, step)
|
minetest.after(10, step)
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
playertag.set(player, TYPE_BUILTIN, {a = 0, r = 255, g = 255, b = 255})
|
ctf_playertag.set(player, TYPE_BUILTIN, {a = 0, r = 255, g = 255, b = 255})
|
||||||
minetest.after(2, function(name)
|
minetest.after(2, function(name)
|
||||||
player = minetest.get_player_by_name(name)
|
player = minetest.get_player_by_name(name)
|
||||||
if player then
|
if player then
|
||||||
playertag.set(player, TYPE_ENTITY)
|
ctf_playertag.set(player, TYPE_ENTITY)
|
||||||
end
|
end
|
||||||
end, player:get_player_name())
|
end, player:get_player_name())
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -2,22 +2,25 @@ dofile(minetest.get_modpath("ctf_playertag") .. "/api.lua")
|
||||||
|
|
||||||
ctf_flag.register_on_pick_up(function(attname, flag)
|
ctf_flag.register_on_pick_up(function(attname, flag)
|
||||||
local tcolor = ctf_colors.get_color(ctf.player(attname))
|
local tcolor = ctf_colors.get_color(ctf.player(attname))
|
||||||
playertag.set(minetest.get_player_by_name(attname), playertag.TYPE_BUILTIN,
|
ctf_playertag.set(minetest.get_player_by_name(attname),
|
||||||
tcolor.css)
|
ctf_playertag.TYPE_BUILTIN, tcolor.css)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
ctf_flag.register_on_drop(function(attname, flag)
|
ctf_flag.register_on_drop(function(attname, flag)
|
||||||
playertag.set(minetest.get_player_by_name(attname), playertag.TYPE_ENTITY)
|
ctf_playertag.set(minetest.get_player_by_name(attname),
|
||||||
|
ctf_playertag.TYPE_ENTITY)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
ctf_flag.register_on_capture(function(attname, flag)
|
ctf_flag.register_on_capture(function(attname, flag)
|
||||||
playertag.set(minetest.get_player_by_name(attname), playertag.TYPE_ENTITY)
|
ctf_playertag.set(minetest.get_player_by_name(attname),
|
||||||
|
ctf_playertag.TYPE_ENTITY)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
ctf_match.register_on_new_match(function()
|
ctf_match.register_on_new_match(function()
|
||||||
for name, settings in pairs(playertag.get_all()) do
|
for name, settings in pairs(ctf_playertag.get_all()) do
|
||||||
if settings.type == playertag.TYPE_BUILTIN then
|
if settings.type == ctf_playertag.TYPE_BUILTIN then
|
||||||
playertag.set(minetest.get_player_by_name(name), playertag.TYPE_ENTITY)
|
ctf_playertag.set(minetest.get_player_by_name(name),
|
||||||
|
ctf_playertag.TYPE_ENTITY)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue