forked from mtcontrib/factions
Version MFF.
This commit is contained in:
parent
220d0c4f26
commit
e5fdd2bdee
23
chatcommands.lua
Normal file → Executable file
23
chatcommands.lua
Normal file → Executable file
@ -43,7 +43,7 @@ function factions_chat.init()
|
|||||||
{
|
{
|
||||||
params = "<cmd> <parameter 1> .. <parameter n>",
|
params = "<cmd> <parameter 1> .. <parameter n>",
|
||||||
description = "faction administration functions",
|
description = "faction administration functions",
|
||||||
privs = { interact=true },
|
privs = { faction_user=true },
|
||||||
func = factions_chat.cmdhandler,
|
func = factions_chat.cmdhandler,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -79,7 +79,7 @@ end
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function factions_chat.cmdhandler(playername,parameter)
|
function factions_chat.cmdhandler(playername,parameter)
|
||||||
|
|
||||||
local player = minetest.env:get_player_by_name(playername)
|
local player = minetest.get_player_by_name(playername)
|
||||||
local params = parameter:split(" ")
|
local params = parameter:split(" ")
|
||||||
local cmd = params[1]
|
local cmd = params[1]
|
||||||
|
|
||||||
@ -101,13 +101,6 @@ function factions_chat.cmdhandler(playername,parameter)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if cmd == "claim" then
|
|
||||||
minetest.chat_send_player(playername,"Trust me, we're working on it",false)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if cmd == "unclaim" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--list all known factions
|
--list all known factions
|
||||||
if cmd == "list" then
|
if cmd == "list" then
|
||||||
local list = factions.get_faction_list()
|
local list = factions.get_faction_list()
|
||||||
@ -143,7 +136,7 @@ function factions_chat.cmdhandler(playername,parameter)
|
|||||||
if cmd == "leave" then
|
if cmd == "leave" then
|
||||||
if params[2] ~= nil then
|
if params[2] ~= nil then
|
||||||
if params[3] ~= nil then
|
if params[3] ~= nil then
|
||||||
local toremove = minetest.env:get_player_by_name(params[3])
|
local toremove = minetest.get_player_by_name(params[3])
|
||||||
--allowed if faction_admin, admin of faction or player itself
|
--allowed if faction_admin, admin of faction or player itself
|
||||||
if minetest.check_player_privs(playername,{ faction_admin=true }) or
|
if minetest.check_player_privs(playername,{ faction_admin=true }) or
|
||||||
factions.is_admin(params[2],playername) and
|
factions.is_admin(params[2],playername) and
|
||||||
@ -189,7 +182,7 @@ function factions_chat.cmdhandler(playername,parameter)
|
|||||||
if params[3] ~= nil and
|
if params[3] ~= nil and
|
||||||
minetest.check_player_privs(playername,{ faction_admin=true }) then
|
minetest.check_player_privs(playername,{ faction_admin=true }) then
|
||||||
|
|
||||||
local toadd = minetest.env:get_player_by_name(params[3])
|
local toadd = minetest.get_player_by_name(params[3])
|
||||||
|
|
||||||
if toadd ~= nil then
|
if toadd ~= nil then
|
||||||
if factions.member_add(params[2],toadd) then
|
if factions.member_add(params[2],toadd) then
|
||||||
@ -361,14 +354,14 @@ end
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function factions_chat.allfactions_chathandler(playername,parameter)
|
function factions_chat.allfactions_chathandler(playername,parameter)
|
||||||
|
|
||||||
local player = minetest.env:get_player_by_name(playername)
|
local player = minetest.get_player_by_name(playername)
|
||||||
|
|
||||||
if player ~= nil then
|
if player ~= nil then
|
||||||
local recipients = {}
|
local recipients = {}
|
||||||
|
|
||||||
for faction,value in pairs(factions.get_factions(player)) do
|
for faction,value in pairs(factions.get_factions(player)) do
|
||||||
for name,value in pairs(factions.dynamic_data.membertable[faction]) do
|
for name,value in pairs(factions.dynamic_data.membertable[faction]) do
|
||||||
local object_to_check = mientest.env:get_player_by_name(name)
|
local object_to_check = minetest.get_player_by_name(name)
|
||||||
|
|
||||||
if object_to_check ~= nil then
|
if object_to_check ~= nil then
|
||||||
recipients[name] = true
|
recipients[name] = true
|
||||||
@ -398,7 +391,7 @@ end
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function factions_chat.chathandler(playername,parameter)
|
function factions_chat.chathandler(playername,parameter)
|
||||||
|
|
||||||
local player = minetest.env:get_player_by_name(playername)
|
local player = minetest.get_player_by_name(playername)
|
||||||
|
|
||||||
if player ~= nil then
|
if player ~= nil then
|
||||||
local line = parameter:split(" ")
|
local line = parameter:split(" ")
|
||||||
@ -420,7 +413,7 @@ function factions_chat.chathandler(playername,parameter)
|
|||||||
if faction ~= nil and valid_faction and
|
if faction ~= nil and valid_faction and
|
||||||
factions.dynamic_data.membertable[faction] ~= nil then
|
factions.dynamic_data.membertable[faction] ~= nil then
|
||||||
for name,value in pairs(factions.dynamic_data.membertable[faction]) do
|
for name,value in pairs(factions.dynamic_data.membertable[faction]) do
|
||||||
local object_to_check = mientest.env:get_player_by_name(name)
|
local object_to_check = minetest.get_player_by_name(name)
|
||||||
factions_chat.show_help(playername)
|
factions_chat.show_help(playername)
|
||||||
if object_to_check ~= nil and
|
if object_to_check ~= nil and
|
||||||
name ~= playername then
|
name ~= playername then
|
||||||
|
0
description.txt
Normal file → Executable file
0
description.txt
Normal file → Executable file
0
doc/Doxyfile
Normal file → Executable file
0
doc/Doxyfile
Normal file → Executable file
8
factions.lua
Normal file → Executable file
8
factions.lua
Normal file → Executable file
@ -232,10 +232,6 @@ end
|
|||||||
--!
|
--!
|
||||||
--! @return true/false (succesfully added faction or not)
|
--! @return true/false (succesfully added faction or not)
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function factions.claim()
|
|
||||||
end
|
|
||||||
function factions.unclaim()
|
|
||||||
end
|
|
||||||
function factions.member_add(name, object)
|
function factions.member_add(name, object)
|
||||||
local new_entry = {}
|
local new_entry = {}
|
||||||
new_entry.factions = {}
|
new_entry.factions = {}
|
||||||
@ -347,7 +343,7 @@ end
|
|||||||
--! @return true/false (succesfully changed privileges)
|
--! @return true/false (succesfully changed privileges)
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function factions.set_admin(name,playername,value)
|
function factions.set_admin(name,playername,value)
|
||||||
mobf_assert_backtrace(type(playername) == "string")
|
--mobf_assert_backtrace(type(playername) == "string")
|
||||||
if factions.data.factions[name] ~= nil then
|
if factions.data.factions[name] ~= nil then
|
||||||
if value then
|
if value then
|
||||||
factions.data.factions[name].adminlist[playername] = true
|
factions.data.factions[name].adminlist[playername] = true
|
||||||
@ -750,11 +746,13 @@ function factions.load()
|
|||||||
for id,object in pairs(factions.data.objects) do
|
for id,object in pairs(factions.data.objects) do
|
||||||
for name,value in pairs(factions.data.objects[id].factions) do
|
for name,value in pairs(factions.data.objects[id].factions) do
|
||||||
if value then
|
if value then
|
||||||
|
if factions.dynamic_data.membertable[name] then -- One of the indexes above is nil. Which one? No idea. //MFF(Mg|07/29/15)
|
||||||
factions.dynamic_data.membertable[name][id] = true
|
factions.dynamic_data.membertable[name][id] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local file,error = io.open(factions_worldid .. "/" .. "factions.conf","w")
|
local file,error = io.open(factions_worldid .. "/" .. "factions.conf","w")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user