Compare commits

1 Commits

Author SHA1 Message Date
d82991d812 Version MFF. 2018-09-07 22:50:08 +02:00
10 changed files with 455 additions and 235 deletions

0
Readme.md Normal file → Executable file
View File

158
config.lua Normal file → Executable file
View File

@ -1,91 +1,161 @@
interact = {}
interact.configured = false --Change this to true when you've configured the mod!
--Which screens to show.
interact.screen1 = true --The welcome a first question screen.
interact.screen2 = true --The visit or interact screen.
interact.screen4 = true --The quiz screen.
-- Which screens to show and in which order.
interact.form_order = {
"languageselect",
"welcome",
"visit",
"rules",
"quiz"
}
--The first screen--
--The text at the top.
interact.s1_header = "Hello, welcome to this server!"
interact.s1_header = {
en = "Hello, welcome to this server!",
fr = "Bonjour et bienvenue sur ce serveur!"
}
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
interact.s1_l2 = "Could you please tell me if you like to grief or not?"
interact.s1_l3 = ""
interact.s1_l2 = {
en = "Could you please tell me if you like to grief or not?",
fr = "Aimez-vous détruire les choses des autres?"
}
interact.s1_l3 = {en="",fr=""}
--The buttons. Each can have 15 characters, max.
interact.s1_b1 = "No, I don't."
interact.s1_b2 = "Yes, I do!"
interact.s1_b1 = {
en = "No, I don't.",
fr = "Non."
}
interact.s1_b2 = {
en = "Yes, I do!",
fr = "Oui!"
}
--The message to send kicked griefers.
interact.msg_grief = "Try out singleplayer if you like griefing, because then you'll only destroy your own stuff!"
interact.msg_grief = {
en = "Try out singleplayer if you like griefing, because then you'll only destroy your own stuff!",
fr = "Essayez le mode solo si vous aimez détruire des choses, car vous ne détruirez que les votres!"
}
--Ban or kick griefers? Default is kick, set to true for ban.
interact.grief_ban = false
--The second screen--
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
interact.s2_l1 = "So, do you want interact, or do you just want to look around"
interact.s2_l2 = "the server?"
interact.s2_l1 = {
en = "So, do you want interact, or do you just want to look around",
fr = "Donc, voulez-vous interagir ou juste regarder"
}
interact.s2_l2 = {
en = "the server?",
fr = "le serveur?"
}
--The buttons. These ones can have a maximum of 26 characters.
interact.s2_b1 = "Yes, I want interact!"
interact.s2_b2 = "I just want to look round."
interact.s2_b1 = {
en = "Yes, I want interact!",
fr = "Oui, je veux interagir!"
}
interact.s2_b2 = {
en = "I just want to look round.",
fr = "Je veux juste regarder."
}
--The message the player is sent if s/he is just visiting.
interact.visit_msg = "Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!"
interact.visit_msg = {
en = "Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!",
fr = "Bonne contemplation! Si vous voulez interagir, tapez la commande /rules, et vous pourrez recommencer le processus!"
}
--The third screen--
--The header for the rules box, this can have 60 characters, max.
interact.s3_header = "Here are the rules:"
interact.s3_header = {
en = "Here are the rules:",
fr = "Voici les règles:"
}
--The buttons. Each can have 15 characters, max.
interact.s3_b1 = "I agree"
interact.s3_b2 = "I disagree"
interact.s3_b1 = {
en = "I agree",
fr = "Accepter"
}
interact.s3_b2 = {
en = "I disagree",
fr = "Refuser"
}
--The message to send players who disagree when they are kicked for disagring with the rules.
interact.disagree_msg = "Bye then! You have to agree to the rules to play on the server."
interact.disagree_msg = {
en = "Bye then! You have to agree to the rules to play on the server.",
fr = "Au revoir! Vous devez accepter les règles pour jouer sur le serveur."
}
--Kick, ban or ignore players who disagree with the rules.
--Options are "kick" "ban" "nothing"
interact.disagree_action = "kick"
--Kick or ban players who disagree with the rules. False will just kick.
interact.disagree_ban = false
--The fouth screen--
--Should there be a back to rules button?
interact.s4_to_rules_button = true
--The back to rules button. 13 characters, max.
interact.s4_to_rules = "Back to rules"
interact.s4_to_rules = {
en = "Back to rules",
fr = "<-- Règles"
}
--The header for screen 4. 60 characters max, although this is a bit of a squash. I recomend 55 as a max.
interact.s4_header = "Time for a quiz on the rules!"
interact.s4_header = {
en = "Time for a quiz on the rules!",
fr = "Quizz sur les règles!"
}
--Since the questions are intrinsically connected with the rules, they are to be found in rules.lua
--The trues are limited to 24 characters. The falses can have 36 characters.
interact.s4_question1_true = "Yes."
interact.s4_question1_false = "No."
interact.s4_question2_true = "Yes."
interact.s4_question2_false = "No."
interact.s4_question3_true = "Yes."
interact.s4_question3_false = "No."
interact.s4_question4_true = "Yes."
interact.s4_question4_false = "No."
interact.s4_question1_true = {en="Yes.",fr="Oui."}
interact.s4_question1_false = {en="No.",fr="Non."}
interact.s4_question2_true = {en="Yes.",fr="Oui."}
interact.s4_question2_false = {en="No.",fr="Non."}
interact.s4_question3_true = {en="Yes.",fr="Oui."}
interact.s4_question3_false = {en="No.",fr="Non."}
interact.s4_question4_true = {en="Yes.",fr="Oui."}
interact.s4_question4_false = {en="No.",fr="Non."}
interact.s4_submit = "Submit!"
interact.s4_submit = {
en = "Submit!",
fr = "Envoyer!"
}
--What to do on a wrong quiz.
--Options are "kick" "ban" "reshow" "rules" and "nothing"
interact.on_wrong_quiz = "nothing"
--Options are "kick" "ban", "" (nothing) or another form name (e.g. "rules", or "quiz" to re-show)
interact.on_wrong_quiz = ""
--The message to send the player if reshow is the on_wrong_quiz option.
interact.quiz_try_again_msg = "Have another go."
interact.quiz_try_again_msg = {
en = "Have another go.",
fr = "Réessayez."
}
--The message sent to the player if rules is the on_wrong_quiz option.
interact.quiz_rules_msg = "Have another look at the rules:"
interact.quiz_rules_msg = {
en = "Have another look at the rules:",
fr = "Re-regardez les règles:"
}
--The kick reason if kick is the on_wrong_quiz option.
interact.wrong_quiz_kick_msg = "Pay more attention next time!"
interact.wrong_quiz_kick_msg = {
en = "Pay more attention next time!",
fr = "Lisez mieux la prochaine fois!"
}
--The message sent to the player if nothing is the on_wrong_quiz option.
interact.quiz_fail_msg = "You got that wrong."
interact.quiz_fail_msg = {
en = "You got that wrong.",
fr = "Vous avez raté le quiz."
}
--The messages send to the player after interact is granted.
interact.interact_msg1 = "Thanks for accepting the rules, you now are able to interact with things."
interact.interact_msg2 = "Happy building!"
interact.interact_msg1 = {
en = "Thanks for accepting the rules, you now are able to interact with things.",
fr = "Merci d'avoir accepté les règles, vous pouvez désormais interagir avec les choses."
}
interact.interact_msg2 = {
en = "Happy building!",
fr = "Amusez-vous bien!"
}
--The priv required to use the /rules command. If fast is a default priv, I recomend replacing shout with that.
interact.priv = {shout = true}
interact.priv = {}

0
depends.txt Normal file → Executable file
View File

View File

@ -1,3 +0,0 @@
A mod that gives the interact priv to players who want it.
It displays the rules, and then provides a simple quiz on them.
If the player completes the quiz sucsesfully, then s/he is given interact.

401
init.lua Normal file → Executable file
View File

@ -7,89 +7,154 @@ local rule3 = 0
local rule4 = 0
local multi = 0
local function make_formspec(player)
local name = player:get_player_name()
local size = { "size[10,4]" }
table.insert(size, "label[0.5,0.5;" ..interact.s1_header.. "]")
table.insert(size, "label[0.5,1.5;" ..interact.s1_l2.. "]")
table.insert(size, "label[0.5,2;" ..interact.s1_l3.. "]")
table.insert(size, "button_exit[5.5,3.4;2,0.5;no;" ..interact.s1_b1.. "]")
table.insert(size, "button[7.5,3.4;2,0.5;yes;" ..interact.s1_b2.. "]")
return table.concat(size)
function table.length(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
local function make_formspec2(player)
local name = player:get_player_name()
local size = { "size[10,4]" }
table.insert(size, "label[0.5,0.5;" ..interact.s2_l1.. "]")
table.insert(size, "label[0.5,1;" ..interact.s2_l2.. "]")
table.insert(size, "button_exit[2.5,3.4;3.5,0.5;interact;" ..interact.s2_b1.. "]")
table.insert(size, "button_exit[6.4,3.4;3.6,0.5;visit;" ..interact.s2_b2.. "]")
return table.concat(size)
interact.player_languages = {}
function interact.get_player_language(plr)
if type(plr) == "string" then
return interact.player_languages[plr]
end
return interact.player_languages[plr:get_player_name()]
end
local function make_formspec3(player)
interact.forms = {
languageselect = function(player)
local fs_width = 10
local fs_button_margin = 1
local fs = { "size["..tostring(fs_width)..",4]" }
table.insert(fs, "background[0,0;10,4;background.jpg]")
local i = 0
local fs_button_width = (fs_width-fs_button_margin*2)/table.length(interact.languages)
for lang, lname in pairs(interact.languages) do
table.insert(fs, "button["..tostring(fs_button_margin+i*fs_button_width)..",2;"..tostring(fs_button_width)..",0.5;"..lang..";"..lname.."]")
i = i+1
end
return table.concat(fs)
end,
welcome = function(player)
local lang = interact.get_player_language(player)
local size = { "size[10,4]" }
table.insert(size, "background[0,0;10,4;background.jpg]")
table.insert(size, "label[0.5,0.5;" ..interact.s1_header[lang].. "]")
table.insert(size, "label[0.5,1.5;" ..interact.s1_l2[lang].. "]")
table.insert(size, "label[0.5,2;" ..interact.s1_l3[lang].. "]")
table.insert(size, "button_exit[5.5,3.4;2,0.5;no;" ..interact.s1_b1[lang].. "]")
table.insert(size, "button[7.5,3.4;2,0.5;yes;" ..interact.s1_b2[lang].. "]")
return table.concat(size)
end,
visit = function(player)
local lang = interact.get_player_language(player)
local size = { "size[10,4]" }
table.insert(size, "background[0,0;10,4;background.jpg]")
table.insert(size, "label[0.5,0.5;" ..interact.s2_l1[lang].. "]")
table.insert(size, "label[0.5,1;" ..interact.s2_l2[lang].. "]")
table.insert(size, "button_exit[2.5,3.4;3.5,0.5;interact;" ..interact.s2_b1[lang].. "]")
table.insert(size, "button_exit[6.4,3.4;3.6,0.5;visit;" ..interact.s2_b2[lang].. "]")
return table.concat(size)
end,
rules = function(player)
local lang = interact.get_player_language(player)
local size = { "size[10,8]" }
table.insert(size, "textarea[0.5,0.5;9.5,7.5;TOS;" ..interact.s3_header.. ";" ..interact.rules.. "]")
table.insert(size, "button[5.5,7.4;2,0.5;decline;" ..interact.s3_b2.. "]")
table.insert(size, "button_exit[7.5,7.4;2,0.5;accept;" ..interact.s3_b1.. "]")
table.insert(size, "background[0,0;10,8;background.jpg]")
table.insert(size, "textarea[0.5,0.5;9.5,7.5;TOS;" ..interact.s3_header[lang].. ";" ..interact.rules[lang].. "]")
table.insert(size, "button[5.5,7.4;2,0.5;decline;" ..interact.s3_b2[lang].. "]")
table.insert(size, "button_exit[7.5,7.4;2,0.5;accept;" ..interact.s3_b1[lang].. "]")
return table.concat(size)
end
end,
local function make_formspec4(player)
local name = player:get_player_name()
quiz = function(player)
local lang = interact.get_player_language(player)
local size = { "size[10,9]" }
if interact.s4_to_rules_button == true then
table.insert(size, "button_exit[7.75,0.25;2.1,0.1;rules;" ..interact.s4_to_rules.. "]")
table.insert(size, "button_exit[7.75,0.25;2.1,0.1;rules;" ..interact.s4_to_rules[lang].. "]")
end
table.insert(size, "label[0.25,0;" ..interact.s4_header.."]")
table.insert(size, "label[0.5,0.5;" ..interact.s4_question1.."]")
table.insert(size, "checkbox[0.25,1;rule1_true;" ..interact.s4_question1_true.."]")
table.insert(size, "checkbox[4,1;rule1_false;" ..interact.s4_question1_false.. "]")
table.insert(size, "label[0.5,2;" ..interact.s4_question2.. "]")
table.insert(size, "checkbox[0.25,2.5;rule2_true;" ..interact.s4_question2_true.. "]")
table.insert(size, "checkbox[4,2.5;rule2_false;" ..interact.s4_question2_false.. "]")
table.insert(size, "label[0.5,3.5;" ..interact.s4_question3.. "]")
table.insert(size, "checkbox[0.25,4;rule3_true;" ..interact.s4_question3_true.. "]")
table.insert(size, "checkbox[4,4;rule3_false;" ..interact.s4_question3_false.. "]")
table.insert(size, "label[0.5,5;" ..interact.s4_question4.. "]")
table.insert(size, "checkbox[0.25,5.5;rule4_true;" ..interact.s4_question4_true.. "]")
table.insert(size, "checkbox[4,5.5;rule4_false;" ..interact.s4_question4_false.."]")
table.insert(size, "label[0.5,6.5;" ..interact.s4_multi_question.. "]")
table.insert(size, "checkbox[4.75,6.25;multi_choice1;" ..interact.s4_multi1.. "]")
table.insert(size, "checkbox[0.25,7;multi_choice2;" ..interact.s4_multi2.. "]")
table.insert(size, "checkbox[4.75,7;multi_choice3;" ..interact.s4_multi3.."]")
table.insert(size, "button_exit[3,8.4;3.5,0.5;submit;" ..interact.s4_submit.."]")
table.insert(size, "label[0.25,0;" ..interact.s4_header[lang].."]")
table.insert(size, "label[0.5,0.5;" ..interact.s4_question1[lang].."]")
table.insert(size, "checkbox[0.25,1;rule1_true;" ..interact.s4_question1_true[lang].."]")
table.insert(size, "checkbox[4,1;rule1_false;" ..interact.s4_question1_false[lang].. "]")
table.insert(size, "label[0.5,2;" ..interact.s4_question2[lang].. "]")
table.insert(size, "checkbox[0.25,2.5;rule2_true;" ..interact.s4_question2_true[lang].. "]")
table.insert(size, "checkbox[4,2.5;rule2_false;" ..interact.s4_question2_false[lang].. "]")
table.insert(size, "label[0.5,3.5;" ..interact.s4_question3[lang].. "]")
table.insert(size, "checkbox[0.25,4;rule3_true;" ..interact.s4_question3_true[lang].. "]")
table.insert(size, "checkbox[4,4;rule3_false;" ..interact.s4_question3_false[lang].. "]")
table.insert(size, "label[0.5,5;" ..interact.s4_question4[lang].. "]")
table.insert(size, "checkbox[0.25,5.5;rule4_true;" ..interact.s4_question4_true[lang].. "]")
table.insert(size, "checkbox[4,5.5;rule4_false;" ..interact.s4_question4_false[lang].."]")
table.insert(size, "label[0.5,6.5;" ..interact.s4_multi_question[lang].. "]")
table.insert(size, "checkbox[4.75,6.25;multi_choice1;" ..interact.s4_multi1[lang].. "]")
table.insert(size, "checkbox[0.25,7;multi_choice2;" ..interact.s4_multi2[lang].. "]")
table.insert(size, "checkbox[4.75,7;multi_choice3;" ..interact.s4_multi3[lang].."]")
table.insert(size, "background[0,0;10,9;background.jpg]")
table.insert(size, "button_exit[3,8.4;3.5,0.5;submit;" ..interact.s4_submit[lang].."]")
return table.concat(size)
end
}
function interact.show_form(player, form, delay)
if delay == nil then delay = 1 end
minetest.after(delay, function()
minetest.show_formspec(player:get_player_name(), form, interact.forms[form](player))
end)
end
local server_formspec = "size[10,4]" ..
"label[0.5,0.5;Hey, you! Yes, you, the admin! What do you think you're doing]" ..
"label[0.5,0.9;ignoring warnings in the terminal? You should watch it carefully!]" ..
"label[0.5,1.5;Before you do anything else, open rules.lua in the interact mod]" ..
"label[0.5,1.9;and put your rules there. Then, open config.lua, and look at the]" ..
"label[0.5,2.3;settings. Configure them so that they match up with your rules.]" ..
"label[0.5,2.7;Then, set interact.configured to true, and this message will go away]" ..
"label[0.5,3.1;once you've restarted the server.]" ..
"label[0.5,3.6;Thank you!]"
function interact.show_next_form(player, current)
local is_next = false
for i, formspec in ipairs(interact.form_order) do
if is_next then
return interact.show_form(player, formspec, 0)
end
if formspec == current then
is_next = true
end
end
-- At the end? Everyting passed correctly, give permissions
interact.grant_interact(player)
end
function interact.grant_interact(player)
local lang = interact.get_player_language(player)
local name = player:get_player_name()
if minetest.check_player_privs(name, interact.priv) then
minetest.chat_send_player(name, interact.interact_msg1[lang])
minetest.chat_send_player(name, interact.interact_msg2[lang])
local privs = minetest.get_player_privs(name)
privs.interact = true
minetest.set_player_privs(name, privs)
minetest.log("action", "Granted " ..name.. " interact.")
end
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "interact_welcome" then return end
if formname ~= "languageselect" then return end
local plrlang = "en"
for lang, _ in pairs(interact.languages) do
if fields[lang] then
plrlang = lang
end
end
interact.player_languages[player:get_player_name()] = plrlang
interact.show_next_form(player, formname)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "welcome" then return end
local name = player:get_player_name()
if fields.no then
if interact.screen2 == false then
minetest.after(1, function()
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
end)
else
minetest.after(1, function()
minetest.show_formspec(name, "interact_visit", make_formspec2(player))
end)
end
interact.show_next_form(player, formname)
return
elseif fields.yes then
if interact.grief_ban ~= true then
minetest.kick_player(name, interact.msg_grief)
local lang = interact.get_player_language(player)
minetest.kick_player(name, interact.msg_grief[lang])
else
minetest.ban_player(name)
end
@ -98,15 +163,14 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "interact_visit" then return end
if formname ~= "visit" then return end
local name = player:get_player_name()
if fields.interact then
minetest.after(1, function()
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
end)
interact.show_next_form(player, formname)
return
elseif fields.visit then
minetest.chat_send_player(name, interact.visit_msg)
local lang = interact.get_player_language(player)
minetest.chat_send_player(name, interact.visit_msg[lang])
minetest.log("action", name.. " is just visiting.")
return
end
@ -114,43 +178,27 @@ end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "interact_rules" then return end
if formname ~= "rules" then return end
local name = player:get_player_name()
if fields.accept then
if interact.screen4 == false then
if minetest.check_player_privs(name, interact.priv) then
minetest.chat_send_player(name, interact.interact_msg1)
minetest.chat_send_player(name, interact.interact_msg2)
local privs = minetest.get_player_privs(name)
privs.interact = true
minetest.set_player_privs(name, privs)
minetest.log("action", "Granted " ..name.. " interact.")
end
else
minetest.after(1, function()
minetest.show_formspec(name, "interact_quiz", make_formspec4(player))
end)
end
interact.show_next_form(player, formname)
return
elseif fields.decline then
if interact.disagree_action == "kick" then
minetest.kick_player(name, interact.disagree_msg)
elseif interact.disagree_action == "ban" then
minetest.ban_player(name)
if interact.disagree_ban ~= true then
local lang = interact.get_player_language(player)
minetest.kick_player(name, interact.disagree_msg[lang])
else
minetest.chat_send_player(name, interact.disagree_msg)
minetest.ban_player(name)
end
return
end
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "interact_quiz" then return end
if formname ~= "quiz" then return end
local name = player:get_player_name()
if fields.rules then
minetest.after(1, function()
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
end)
interact.show_form(player, "rules", 0)
return
end
if fields.rule1_true then rule1 = true
@ -171,36 +219,28 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
rule3 = 0
rule4 = 0
multi = 0
if minetest.check_player_privs(name, interact.priv) then
minetest.chat_send_player(name, interact.interact_msg1)
minetest.chat_send_player(name, interact.interact_msg2)
local privs = minetest.get_player_privs(name)
privs.interact = true
minetest.set_player_privs(name, privs)
minetest.log("action", "Granted " ..name.. " interact.")
end
interact.show_next_form(player, formname)
elseif fields.submit then
rule1 = 0
rule2 = 0
rule3 = 0
rule4 = 0
multi = 0
local lang = interact.get_player_language(player)
if interact.on_wrong_quiz == "kick" then
minetest.kick_player(name, interact.wrong_quiz_kick_msg)
minetest.kick_player(name, interact.wrong_quiz_kick_msg[lang])
elseif interact.on_wrong_quiz == "ban" then
minetest.ban_player(name)
elseif interact.on_wrong_quiz == "reshow" then
minetest.chat_send_player(name, interact.quiz_try_again_msg)
minetest.after(1, function()
minetest.show_formspec(name, "interact_quiz", make_formspec4(player))
end)
elseif interact.on_wrong_quiz == "rules" then
minetest.chat_send_player(name, interact.quiz_rules_msg)
minetest.after(1, function()
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
end)
elseif interact.on_wrong_quiz == "" then
minetest.chat_send_player(name, interact.quiz_fail_msg[lang])
else
minetest.chat_send_player(name, interact.quiz_fail_msg)
if interact.on_wrong_quiz == formname then
minetest.chat_send_player(name, interact.quiz_try_again_msg[lang])
end
if interact.on_wrong_quiz == "rules" then
minetest.chat_send_player(name, interact.quiz_rules_msg[lang])
end
interact.show_form(interact.on_wrong_quiz)
end
end
end)
@ -211,37 +251,126 @@ minetest.register_chatcommand("rules",{
privs = interact.priv,
func = function (name,params)
local player = minetest.get_player_by_name(name)
if interact.screen1 ~= false then
minetest.after(1, function()
minetest.show_formspec(name, "interact_welcome", make_formspec(player))
end)
elseif interact.screen2 ~= false then
minetest.after(1, function()
minetest.show_formspec(name, "interact_visit", make_formspec2(player))
end)
if not interact.blacklist[name] then
interact.show_form(player, interact.form_order[1])
else
minetest.after(1, function()
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
end)
minetest.log("action", "[interact] Blacklisted player " .. name .. " tried to get back " ..
"his revoked privilege")
return false, "Sorry, you've been blacklisted by " ..
(interact.blacklist[name].emitter or "<unknown>") .. " on " ..
(interact.blacklist[name].date or "<unknown>") .. " . Thus, you can't use " ..
" this command to get interact back. Sorry."
end
end
})
minetest.register_on_joinplayer(function(player)
function start_formspecs(player)
local name = player:get_player_name()
if not minetest.get_player_privs(name).interact then
if interact.screen1 ~= false then
minetest.show_formspec(name, "interact_welcome", make_formspec(player))
elseif interact.screen2 ~= false then
minetest.show_formspec(name, "interact_visit", make_formspec2(player))
else
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
if not interact.blacklist[name] then
interact.show_form(player, interact.form_order[1])
end
elseif minetest.get_player_privs(name).server and interact.configured == false then
minetest.show_formspec(name, "interact_no_changes_made", server_formspec)
end
end)
if not interact.configured then
minetest.log("warning", "Mod \"Interact\" has not been configured! Please open config.lua in its folder and configure it. See the readme of the mod for more details.")
end
minetest.register_on_joinplayer(start_formspecs)
-- Blacklist
interact.blacklist = {}
minetest.register_chatcommand("unblacklist", {
params = "<playername>",
description = "Remove a player from the interact blacklist",
privs = {basic_privs = true, interact = true},
func = function(name, param)
if param == "" then
return false, "Give a player's name to remove from the blacklist."
end
if not interact.blacklist[param] then
return true, "Player " .. param " is not actually blacklisted."
end
if name == param then
return true, "Ahahaha. Well tried looser."
end
minetest.log("action", "[interact] " .. name .. " removed " .. param .. " from " ..
"blacklist (added on " .. (interact.blacklist[param].date or "<unknown>") ..
" by " .. (interact.blacklist[param].emitter or "<unknown>") .. ")")
interact.blacklist[param] = nil
return true, "Done."
end
})
minetest.register_chatcommand("blacklist", {
params = "<playername>",
description = "Blacklist a player. [S]He won't be able to use /rules.",
privs = {basic_privs = true, interact = true},
func = function(name, param)
if param == "" then
return false, "Give a player's name to blacklist."
end
local blackfile = io.open(minetest.get_worldpath() .. "/players/" .. param, "r")
if not blackfile then
return false, "Player doesn't exist."
end
io.close(blackfile)
if name == param then
return true, "You know this wouldn't work, right?"
end
if interact.blacklist[param] then
return true, "Player already blacklisted."
end
if minetest.get_player_privs(param).interact == true then
return true, "Warning: This player has interact! Use revoke before blacklisting."
end
interact.blacklist[param] = {
emitter = name,
date = os.date("%m/%d/%Y")
}
minetest.log("action", "[interact] " .. name .. " added " .. param .. " on /rules blacklist.")
return true, "Player " .. param .. " blacklisted."
end
})
function load_blacklist()
local file = io.open(minetest.get_worldpath().."/interact_blacklist.txt", "r")
if not file then
file = io.open(minetest.get_worldpath().."/interact_blacklist.txt", "w")
if not file then
minetest.log("error", "[interact] Error opening blacklist file")
return
end
minetest.log("action", "[interact] Blacklist created")
end
local line = file:read()
if not line then
interact.blacklist = {}
else
interact.blacklist = minetest.deserialize(line)
end
minetest.log("action", "[interact] Blacklist loaded")
file:close()
end
function save_blacklist()
local file = io.open(minetest.get_worldpath().."/interact_blacklist.txt", "w")
if not file then
minetest.log("error", "[interact] Error opening blacklist file")
return
end
file:write(minetest.serialize(interact.blacklist))
minetest.log("action", "[interact] Blacklist saved")
file:close()
end
minetest.register_on_shutdown(save_blacklist)
load_blacklist()

26
license.txt Normal file → Executable file
View File

@ -1,21 +1,13 @@
The MIT License (MIT)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (c) 2015 Amaz
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -1,7 +0,0 @@
name = interact
title = Interact
author = Amaz
description = A mod that gives the interact priv to players who want it and who have agreed to the rules.
license = MIT
forum = https://forum.minetest.net/viewtopic.php?f=11&t=11200
version = 1.0

79
rules.lua Normal file → Executable file
View File

@ -1,28 +1,67 @@
interact.languages = {
en = "English",
fr = "Français"
}
--The actual rules.
interact.rules = [[
Rules:
interact.rules = {
en = [[1) No intentional try to disturb the server's stability will be tolerated. (lag, crash, bug exploit, ...)
2) Cheating (hack, modified client, ...) is forbidden on this server. Be fair-play and learn to play according to the rules.
3) On the server, PVP is authorized and theft/grief as well, to the exception of public buildings. (remember to use the areas mod to protect your buildings)
4) Please do not spam or flood.
5) Each player is responsible of his/her own account, we can't be held liable for any illegitimate use of it.
6) Try to avoid 1x1 towers and overall destroying the environment, anywhere that is. This way the server will stay as beautiful, wild and natural as possible.
7) Do not ask to be a member of the server staff.
8) Swearing, racism, hate speech and the like is strictly prohibited.
1. No griefing.
2. No hacked clients.
3. No swearing or insults towards other players.
4. No family roleplay.
5. No dating.
6. Do not ask for more privs, or to be an admin. Also do not ask for items.
7. PVP is not allowed.
]]
Click on the "I accept" button to get the permission to build and interact with the server.]],
fr = [[1) Aucune atteinte intentionnelle au bon fonctionnement du serveur ne sera admise. (lag, crash, exploit de bug, etc...)
2) La triche (hack, client modifie, etc...) n'est pas toleree sur le serveur. Soyez fair-play et apprenez a jouer selon les regles.
3) Sur le serveur, le PVP est autorise, le vole/grief est aussi autorise, le grief n'est pas autorise sur les constructions publics. (pensez au mod areas pour proteger vos biens)
4) Merci de ne pas spammer ou flooder.
5) Chaque joueur a l'entiere responsabilite de son compte, nous ne sommes en aucun cas responsable d'une utilisation frauduleuse de votre compte dans le jeu.
6) Si possible, evitez les constructions de tours en 1x1 mais aussi, de poser des blocs gachant le decor, n'importe ou. Ceci pour que le serveur reste le plus beau, sauvage et naturel possible.
7) Ne demandez pas a etre membre de l'equipe du serveur.
8) Aucune forme d'insulte ou de racisme n'est admise.
Cliquez sur le bouton "Accepter" pour pouvoir construire et interagir sur le serveur.]]
}
--The questions on the rules, if the quiz is used.
--The checkboxes for the first 4 questions are in config.lua
interact.s4_question1 = "Is PVP is allowed?"
interact.s4_question2 = "Is family roleplay allowed?"
interact.s4_question3 = "Should you be nice to all players?"
interact.s4_question4 = "Should you ask for all the privs you can?"
interact.s4_multi_question = "Which of these is a rule?"
interact.s4_question1 = {
en = "Can I use a bug to crash the server so it restarts?",
fr = "Puis-je utiliser un bug pour faire crasher le serveur afin qu'il redémarre ?"
}
interact.s4_question2 = {
en = "Can I ask to be a member of the staff ?",
fr = "Puis-je demander à faire partie de l'équipe d'administration ?"
}
interact.s4_question3 = {
en = "Are the spam and flood forbidden?",
fr = "Le spam et flood sont ils interdit ?"
}
interact.s4_question4 = {
en = "Can I freely join the IRC channel?",
fr = "Puis-je joindre librement l'IRC ?"
}
interact.s4_multi_question = {
en = "Which of these is a rule?",
fr = "Laquelle des affirmations est une règle ?"
}
--The answers to the multiple choice questions. Only one of these should be true.
interact.s4_multi1 = "No griefing!"
interact.s4_multi2 = "PVP is allowed."
interact.s4_multi3 = "Be rude to other players."
interact.s4_multi1 = {
en = "Cheating allowed",
fr = "Triche autorisé"
}
interact.s4_multi2 = {
en = "PvP forbidden",
fr = "PvP interdit"
}
interact.s4_multi3 = {
en = "Swearing/racism forbidden",
fr = "Insulte/racisme interdit"
}
--Which answer is needed for the quiz questions. interact.quiz1-4 takes true or false.
--True is left, false is right.
@ -33,5 +72,5 @@ interact.s4_multi3 = "Be rude to other players."
interact.quiz1 = false
interact.quiz2 = false
interact.quiz3 = true
interact.quiz4 = false
interact.quiz_multi = 1
interact.quiz4 = true
interact.quiz_multi = 3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 KiB

BIN
textures/background.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB