tnttag-cd2025/items.lua

33 lines
1.2 KiB
Lua
Raw Normal View History

local S = minetest.get_translator("tnttag")
minetest.register_node("tnttag:tnt", {
description = "TNTTagger - Tag other players",
tiles = {"tnt_top.png", "tnt_side.png", "tnt_side.png"},
2022-10-02 21:47:55 +02:00
on_use = function(itemstack, user, pointed_thing)
user_name = user:get_player_name()
if arena_lib.is_player_in_arena(user_name, "tnttag") then
2022-10-02 21:47:55 +02:00
if pointed_thing.type == "object" then
if not pointed_thing.ref:get_luaentity() then
local player = pointed_thing.ref
local p_name = player:get_player_name()
2022-10-04 16:37:26 +02:00
if arena_lib.is_player_in_arena(p_name, "tnttag") then
local arena = arena_lib.get_arena_by_player(user_name)
2022-10-04 16:37:26 +02:00
if not arena.players[p_name].tagged then
tnttag.tagplayer(p_name, arena)
tnttag.untagplayer(user_name, arena)
-- Messages
for pl_name, _ in pairs(arena.players) do
minetest.chat_send_player(pl_name, user_name.." tagged "..p_name)
end
arena_lib.HUD_send_msg("title", p_name, "You have been tagged by "..user_name.."!",1, nil--[[sound?]], 0xFF3300)
arena_lib.HUD_send_msg("title", user_name, "You tagged "..p_name.."!",1, nil--[[sound?]], 0xFF3300)
end
2022-10-02 21:47:55 +02:00
end
end
end
end
end,
2022-10-02 20:58:08 +02:00
})
tnttag.tagitem = "tnttag:tnt"