Compare commits

..

No commits in common. "efbe6dc7b4d21c8ee185eabc561334d473bd66bc" and "5d956ffac311e6ce907340c11f59a562dbbe21fc" have entirely different histories.

2 changed files with 5 additions and 48 deletions

View file

@ -89,7 +89,7 @@ minetest.register_tool("ctf_classes:sword_bronze", {
if #enemies > 0 then if #enemies > 0 then
ctf_marker.remove_marker(pteam) ctf_marker.remove_marker(pteam)
ctf_marker.add_marker(pname, pteam, pos, (" found enemies: <%s>]"):format(table.concat(enemies, ", "))) ctf_marker.add_marker(pname, pteam, pos, ("[Enemies Found!: <%s>]"):format(table.concat(enemies, ", ")))
end end
return return
@ -105,7 +105,7 @@ minetest.register_tool("ctf_classes:sword_bronze", {
sword_special_timer[pname] = 20 sword_special_timer[pname] = 20
sword_special_timer_func(pname, 20) sword_special_timer_func(pname, 20)
minetest.registered_chatcommands["m"].func(pname, "placed with sword") minetest.registered_chatcommands["m"].func(pname, "Marked with "..pname.."'s sword")
end, end,
on_secondary_use = function(itemstack, user, pointed_thing) on_secondary_use = function(itemstack, user, pointed_thing)
if pointed_thing then if pointed_thing then

View file

@ -47,7 +47,7 @@ function ctf_marker.add_marker(name, tname, pos, str)
if tplayer then if tplayer then
teams[tname].players[pname] = tplayer:hud_add({ teams[tname].players[pname] = tplayer:hud_add({
hud_elem_type = "waypoint", hud_elem_type = "waypoint",
name = "[" .. name .. "'s marker" .. str, name = str,
number = tonumber(ctf.flag_colors[team.data.color]), number = tonumber(ctf.flag_colors[team.data.color]),
world_pos = pos world_pos = pos
}) })
@ -99,7 +99,7 @@ minetest.register_chatcommand("m", {
local tname = ctf.player(name).team local tname = ctf.player(name).team
-- Handle waypoint string -- Handle waypoint string
local str = (param and param:trim() ~= "") and ": " .. param or "" local str = (param and param:trim() ~= "") and param or name .. "'s marker"
if pointed.type == "object" then if pointed.type == "object" then
local concat local concat
local obj = pointed.ref local obj = pointed.ref
@ -126,7 +126,7 @@ minetest.register_chatcommand("m", {
end end
str = concat and str .. " <" .. concat .. ">" str = concat and str .. " <" .. concat .. ">"
end end
str = str .. "]" str = "[" .. str .. "]"
-- Remove existing marker if it exists -- Remove existing marker if it exists
ctf_marker.remove_marker(tname) ctf_marker.remove_marker(tname)
@ -134,46 +134,3 @@ minetest.register_chatcommand("m", {
ctf_marker.add_marker(name, tname, minetest.get_pointed_thing_position(pointed), str) ctf_marker.add_marker(name, tname, minetest.get_pointed_thing_position(pointed), str)
end end
}) })
local function mr_command(name)
local tname = ctf.player(name).team
local player = minetest.get_player_by_name(name)
local mmsg = ""
local args = ""
local function hud_check()
if teams[tname].players[name] then
mmsg = player:hud_get(teams[tname].players[name]).name
args = mmsg:split("'")
end
end
if pcall(hud_check) then
if args[1] == "[" .. name then
ctf_marker.remove_marker(tname)
local team = ctf.team(tname)
for pname, _ in pairs(team.players) do
minetest.chat_send_player(pname, msg("* " .. name .. " removed their marker!"))
end
elseif args[1] == "" or nil then
minetest.chat_send_player(name, msg("No marker to remove"))
else
minetest.chat_send_player(name, msg("Not your marker!"))
end
else
minetest.chat_send_player(name, msg("No marker to remove"))
end
end
minetest.register_chatcommand("m_remove", {
description = "Remove your own marker (/mr)",
privs = {interact = true},
func = mr_command
})
minetest.register_chatcommand("mr", {
description = "Remove your own marker",
privs = {interact = true},
func = mr_command
})