Version MFF.

This commit is contained in:
sys4-fr 2018-09-07 20:55:56 +02:00
parent 220d0c4f26
commit e5fdd2bdee
5 changed files with 128 additions and 137 deletions

23
chatcommands.lua Normal file → Executable file
View File

@ -43,7 +43,7 @@ function factions_chat.init()
{
params = "<cmd> <parameter 1> .. <parameter n>",
description = "faction administration functions",
privs = { interact=true },
privs = { faction_user=true },
func = factions_chat.cmdhandler,
}
)
@ -79,7 +79,7 @@ end
-------------------------------------------------------------------------------
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 cmd = params[1]
@ -101,13 +101,6 @@ function factions_chat.cmdhandler(playername,parameter)
return
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
if cmd == "list" then
local list = factions.get_faction_list()
@ -143,7 +136,7 @@ function factions_chat.cmdhandler(playername,parameter)
if cmd == "leave" then
if params[2] ~= 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
if minetest.check_player_privs(playername,{ faction_admin=true }) or
factions.is_admin(params[2],playername) and
@ -189,7 +182,7 @@ function factions_chat.cmdhandler(playername,parameter)
if params[3] ~= nil and
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 factions.member_add(params[2],toadd) then
@ -361,14 +354,14 @@ end
-------------------------------------------------------------------------------
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
local recipients = {}
for faction,value in pairs(factions.get_factions(player)) 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
recipients[name] = true
@ -398,7 +391,7 @@ end
-------------------------------------------------------------------------------
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
local line = parameter:split(" ")
@ -420,7 +413,7 @@ function factions_chat.chathandler(playername,parameter)
if faction ~= nil and valid_faction and
factions.dynamic_data.membertable[faction] ~= nil then
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)
if object_to_check ~= nil and
name ~= playername then

0
description.txt Normal file → Executable file
View File

0
doc/Doxyfile Normal file → Executable file
View File

10
factions.lua Normal file → Executable file
View File

@ -232,10 +232,6 @@ end
--!
--! @return true/false (succesfully added faction or not)
-------------------------------------------------------------------------------
function factions.claim()
end
function factions.unclaim()
end
function factions.member_add(name, object)
local new_entry = {}
new_entry.factions = {}
@ -347,7 +343,7 @@ end
--! @return true/false (succesfully changed privileges)
-------------------------------------------------------------------------------
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 value then
factions.data.factions[name].adminlist[playername] = true
@ -750,7 +746,9 @@ function factions.load()
for id,object in pairs(factions.data.objects) do
for name,value in pairs(factions.data.objects[id].factions) do
if value then
factions.dynamic_data.membertable[name][id] = true
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
end
end
end
end

0
init.lua Normal file → Executable file
View File