Initial commit
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
1
Readme.md
Normal file
@ -0,0 +1 @@
|
||||
This mod hides the existing tags, and adds entity based tags that are only as visible as the player.
|
111
init.lua
Normal file
@ -0,0 +1,111 @@
|
||||
local nametags = {}
|
||||
local checktimer = 0
|
||||
|
||||
function addtag(player)
|
||||
local pos = player:getpos()
|
||||
local ent = minetest.env:add_entity(pos, "playertag:tag")
|
||||
local color = "W"
|
||||
local texture = "npcf_tag_bg.png"
|
||||
local x = math.floor(134 - ((player:get_player_name():len() * 11) / 2))
|
||||
local i = 0
|
||||
player:get_player_name():gsub(".", function(char)
|
||||
if char:byte() > 64 and char:byte() < 91 then
|
||||
char = "U"..char
|
||||
end
|
||||
texture = texture.."^[combine:84x14:"..(x+i)..",0="..color.."_"..char..".png"
|
||||
i = i + 11
|
||||
end)
|
||||
ent:set_properties({textures={texture}})
|
||||
|
||||
if ent ~= nil then
|
||||
ent:set_attach(player, "", {x=0,y=9,z=0}, {x=0,y=0,z=0})
|
||||
nametags[player:get_player_name()] = ent
|
||||
ent = ent:get_luaentity()
|
||||
ent.wielder = player
|
||||
end
|
||||
--minetest.chat_send_all("tag made for "..player:get_player_name())
|
||||
end
|
||||
|
||||
function removetag(player)
|
||||
local tag = nametags[player:get_player_name()]
|
||||
if tag then
|
||||
tag:remove()
|
||||
tag = nil
|
||||
end
|
||||
end
|
||||
|
||||
local nametag = {
|
||||
npcf_id = "nametag",
|
||||
physical = false,
|
||||
collisionbox = {x=0, y=0, z=0},
|
||||
visual = "sprite",
|
||||
textures = {"default_dirt.png"},--{"npcf_tag_bg.png"},
|
||||
visual_size = {x=2.16, y=0.18, z=2.16},--{x=1.44, y=0.12, z=1.44},
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
if staticdata == "expired" then
|
||||
if self.wielder then
|
||||
removetag(wielder)
|
||||
else
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end,
|
||||
get_staticdata = function(self)
|
||||
return "expired"
|
||||
end,
|
||||
}
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if not player.tag then
|
||||
player:set_nametag_attributes({
|
||||
color = {a = 0, r = 0, g = 0, b = 0}
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
if not player.tag then
|
||||
player:set_nametag_attributes({
|
||||
color = {a = 0, r = 0, g = 0, b = 0}
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if checktimer > 10 then
|
||||
checktimer = 0
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if nametags[player:get_player_name()]:get_luaentity() == nil then
|
||||
addtag(player)
|
||||
--minetest.chat_send_all("tag made for "..player:get_player_name())
|
||||
else
|
||||
nametags[player:get_player_name()]:set_attach(player, "", {x=0,y=9,z=0}, {x=0,y=0,z=0})
|
||||
end
|
||||
end
|
||||
else
|
||||
checktimer = checktimer + dtime
|
||||
end
|
||||
end)
|
||||
--
|
||||
function nametag:on_step(dtime)
|
||||
local wielder = self.wielder
|
||||
if wielder == nil then
|
||||
self.object:remove()
|
||||
return
|
||||
elseif minetest.env:get_player_by_name(wielder:get_player_name()) == nil then
|
||||
self.object:remove()
|
||||
return
|
||||
else
|
||||
--self.object:set_attach(wielder, "", {x=0,y=9,z=0}, {x=0,y=0,z=0})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_entity("playertag:tag", nametag)
|
||||
|
||||
minetest.register_on_joinplayer(function (player)
|
||||
addtag(player)
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function (player)
|
||||
removetag(player)
|
||||
end)
|
BIN
textures/0.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
textures/1.png
Normal file
After Width: | Height: | Size: 111 B |
BIN
textures/10.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
textures/11.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/12.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/13.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/14.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/15.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/16.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/17.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/18.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/19.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/2.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
textures/20.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
textures/3.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/4.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/5.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
textures/6.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
textures/7.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
textures/8.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
textures/9.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
textures/B_-.png
Normal file
After Width: | Height: | Size: 85 B |
BIN
textures/B_0.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
textures/B_1.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
textures/B_2.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
textures/B_3.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
textures/B_4.png
Normal file
After Width: | Height: | Size: 128 B |
BIN
textures/B_5.png
Normal file
After Width: | Height: | Size: 136 B |
BIN
textures/B_6.png
Normal file
After Width: | Height: | Size: 142 B |
BIN
textures/B_7.png
Normal file
After Width: | Height: | Size: 107 B |
BIN
textures/B_8.png
Normal file
After Width: | Height: | Size: 128 B |
BIN
textures/B_9.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
textures/B_UA.png
Normal file
After Width: | Height: | Size: 130 B |
BIN
textures/B_UB.png
Normal file
After Width: | Height: | Size: 113 B |
BIN
textures/B_UC.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
textures/B_UD.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
textures/B_UE.png
Normal file
After Width: | Height: | Size: 100 B |
BIN
textures/B_UF.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
textures/B_UG.png
Normal file
After Width: | Height: | Size: 136 B |
BIN
textures/B_UH.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
textures/B_UI.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
textures/B_UJ.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
textures/B_UK.png
Normal file
After Width: | Height: | Size: 140 B |
BIN
textures/B_UL.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
textures/B_UM.png
Normal file
After Width: | Height: | Size: 124 B |
BIN
textures/B_UN.png
Normal file
After Width: | Height: | Size: 130 B |
BIN
textures/B_UO.png
Normal file
After Width: | Height: | Size: 120 B |
BIN
textures/B_UP.png
Normal file
After Width: | Height: | Size: 117 B |
BIN
textures/B_UQ.png
Normal file
After Width: | Height: | Size: 130 B |
BIN
textures/B_UR.png
Normal file
After Width: | Height: | Size: 130 B |
BIN
textures/B_US.png
Normal file
After Width: | Height: | Size: 147 B |
BIN
textures/B_UT.png
Normal file
After Width: | Height: | Size: 93 B |
BIN
textures/B_UU.png
Normal file
After Width: | Height: | Size: 101 B |
BIN
textures/B_UV.png
Normal file
After Width: | Height: | Size: 128 B |
BIN
textures/B_UW.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
textures/B_UX.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/B_UY.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
textures/B_UZ.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
textures/B__.png
Normal file
After Width: | Height: | Size: 83 B |
BIN
textures/B_a.png
Normal file
After Width: | Height: | Size: 132 B |
BIN
textures/B_b.png
Normal file
After Width: | Height: | Size: 128 B |
BIN
textures/B_c.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
textures/B_d.png
Normal file
After Width: | Height: | Size: 123 B |
BIN
textures/B_e.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
textures/B_f.png
Normal file
After Width: | Height: | Size: 102 B |
BIN
textures/B_g.png
Normal file
After Width: | Height: | Size: 140 B |
BIN
textures/B_h.png
Normal file
After Width: | Height: | Size: 113 B |
BIN
textures/B_i.png
Normal file
After Width: | Height: | Size: 107 B |
BIN
textures/B_j.png
Normal file
After Width: | Height: | Size: 112 B |
BIN
textures/B_k.png
Normal file
After Width: | Height: | Size: 141 B |
BIN
textures/B_l.png
Normal file
After Width: | Height: | Size: 107 B |
BIN
textures/B_m.png
Normal file
After Width: | Height: | Size: 102 B |
BIN
textures/B_n.png
Normal file
After Width: | Height: | Size: 112 B |
BIN
textures/B_o.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
textures/B_p.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
textures/B_q.png
Normal file
After Width: | Height: | Size: 130 B |
BIN
textures/B_r.png
Normal file
After Width: | Height: | Size: 103 B |
BIN
textures/B_s.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
textures/B_t.png
Normal file
After Width: | Height: | Size: 112 B |
BIN
textures/B_u.png
Normal file
After Width: | Height: | Size: 101 B |
BIN
textures/B_v.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
textures/B_w.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
textures/B_x.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
textures/B_y.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
textures/B_z.png
Normal file
After Width: | Height: | Size: 108 B |
BIN
textures/W_-.png
Normal file
After Width: | Height: | Size: 78 B |
BIN
textures/W_0.png
Normal file
After Width: | Height: | Size: 107 B |
BIN
textures/W_1.png
Normal file
After Width: | Height: | Size: 93 B |
BIN
textures/W_2.png
Normal file
After Width: | Height: | Size: 101 B |
BIN
textures/W_3.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
textures/W_4.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
textures/W_5.png
Normal file
After Width: | Height: | Size: 103 B |
BIN
textures/W_6.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/W_7.png
Normal file
After Width: | Height: | Size: 87 B |
BIN
textures/W_8.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
textures/W_9.png
Normal file
After Width: | Height: | Size: 111 B |
BIN
textures/W_UA.png
Normal file
After Width: | Height: | Size: 109 B |