Skip to content

Commit

Permalink
playertag mod tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneWolfHT committed May 14, 2024
1 parent 2ad37e5 commit cf04e71
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions mods/other/playertag/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ local function add_entity_tag(player, old_observers)
color = {a = 0, r = 0, g = 0, b = 0}
})

local ent = minetest.add_entity(player:get_pos(), "playertag:tag")
local ppos = player:get_pos()

local ent = minetest.add_entity(ppos, "playertag:tag")
local ent2 = false
local ent3 = false

if ent.set_observers then
ent2 = minetest.add_entity(player:get_pos(), "playertag:tag")
ent2 = minetest.add_entity(ppos, "playertag:tag")
ent2:set_observers(old_observers.nametag_entity or {})
ent2:set_properties({
nametag = player:get_player_name(),
nametag_color = "#EEFFFFDD",
nametag_bgcolor = "#0000002D"
})

ent3 = minetest.add_entity(player:get_pos(), "playertag:tag")
ent3 = minetest.add_entity(ppos, "playertag:tag")
ent3:set_observers(old_observers.symbol_entity or {})
ent3:set_properties({
collisionbox = { 0, 0, 0, 0, 0, 0 },
Expand Down Expand Up @@ -152,9 +154,17 @@ minetest.register_entity("playertag:tag", {
physical = false,
makes_footstep_sound = false,
backface_culling = false,
static_save = false,
static_save = true,
pointable = false,
on_punch = function() return true end,
on_detach = function(self, parent)
self.object:remove()
end,
on_deactivate = function(self, removal)
if not removal then
self.object:remove()
end
end,
})

minetest.register_on_joinplayer(function(player)
Expand Down

0 comments on commit cf04e71

Please sign in to comment.