modified interaction mod
This commit is contained in:
parent
204e041481
commit
c6bde2be2a
88
config.lua
88
config.lua
@ -1,42 +1,92 @@
|
|||||||
|
local S = minetest.get_translator("interact")
|
||||||
interact = {}
|
interact = {}
|
||||||
|
|
||||||
interact.configured = true --Change this to true when you've configured the mod!
|
interact.configured = true --Change this to true when you've configured the mod!
|
||||||
interact.default_language = "english"
|
|
||||||
|
|
||||||
--Which answer is needed for the quiz questions. interact.quiz1-4 takes true or false.
|
|
||||||
--True is left, false is right.
|
|
||||||
--Please, please spell true and false right!!! If you spell it wrong it won't work!
|
|
||||||
--interact.quiz can be 1, 2 or 3.
|
|
||||||
--1 is the top one by the question, 2 is the bottom left one, 3 is the bottom right one.
|
|
||||||
--Make sure these agree with your answers!
|
|
||||||
|
|
||||||
interact.quiz1 = false
|
|
||||||
interact.quiz2 = false
|
|
||||||
interact.quiz3 = false
|
|
||||||
interact.quiz4 = true
|
|
||||||
interact.quiz_multi = 3
|
|
||||||
|
|
||||||
--Which screens to show.
|
--Which screens to show.
|
||||||
interact.screen1 = true --The welcome a first question screen.
|
interact.screen1 = false --The welcome a first question screen.
|
||||||
interact.screen2 = true --The visit or interact screen.
|
interact.screen2 = true --The visit or interact screen.
|
||||||
interact.screen4 = true --The quiz screen.
|
interact.screen4 = false --The quiz screen.
|
||||||
|
|
||||||
|
--The first screen--
|
||||||
|
--The text at the top.
|
||||||
|
interact.s1_header = S("Hello, welcome to this server!")
|
||||||
|
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
|
||||||
|
interact.s1_l2 = S("Could you please tell me if you like to grief or not?")
|
||||||
|
interact.s1_l3 = ""
|
||||||
|
--The buttons. Each can have 15 characters, max.
|
||||||
|
interact.s1_b1 = S("No, I don't.")
|
||||||
|
interact.s1_b2 = S("Yes, I do!")
|
||||||
|
|
||||||
|
--The message to send kicked griefers.
|
||||||
|
interact.msg_grief = S("Try out singleplayer if you like griefing, because then you'll only destroy your own stuff!")
|
||||||
|
|
||||||
--Ban or kick griefers? Default is kick, set to true for ban.
|
--Ban or kick griefers? Default is kick, set to true for ban.
|
||||||
interact.grief_ban = false
|
interact.grief_ban = true
|
||||||
|
|
||||||
|
--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 = S("So, do you want interact, or do you just want to look around")
|
||||||
|
interact.s2_l2 = S("the server?")
|
||||||
|
--The buttons. These ones can have a maximum of 26 characters.
|
||||||
|
interact.s2_b1 = S("Yes, I want!")
|
||||||
|
interact.s2_b2 = S("I just want to look round.")
|
||||||
|
|
||||||
|
--The message the player is sent if s/he is just visiting.
|
||||||
|
interact.visit_msg = S("Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!")
|
||||||
|
|
||||||
|
--The third screen--
|
||||||
|
--The header for the rules box, this can have 60 characters, max.
|
||||||
|
interact.s3_header = S("Here are the rules:")
|
||||||
|
|
||||||
|
--The buttons. Each can have 15 characters, max.
|
||||||
|
interact.s3_b1 = S("I agree")
|
||||||
|
interact.s3_b2 = S("I disagree")
|
||||||
|
|
||||||
|
--The message to send players who disagree when they are kicked for disagring with the rules.
|
||||||
|
interact.disagree_msg = S("Bye then! You have to agree to the rules to play on the server.")
|
||||||
|
|
||||||
--Kick, ban or ignore players who disagree with the rules.
|
--Kick, ban or ignore players who disagree with the rules.
|
||||||
--Options are "kick" "ban" "nothing"
|
--Options are "kick" "ban" "nothing"
|
||||||
interact.disagree_action = "nothing"
|
interact.disagree_action = "kick"
|
||||||
|
|
||||||
--The fouth screen--
|
--The fouth screen--
|
||||||
--Should there be a back to rules button?
|
--Should there be a back to rules button?
|
||||||
interact.s4_to_rules_button = true
|
interact.s4_to_rules_button = true
|
||||||
|
--The back to rules button. 13 characters, max.
|
||||||
|
interact.s4_to_rules = S("Back to rules")
|
||||||
|
|
||||||
|
--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 = S("Time for a quiz on the rules!")
|
||||||
|
|
||||||
|
--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_submit = "Submit!"
|
||||||
|
|
||||||
--What to do on a wrong quiz.
|
--What to do on a wrong quiz.
|
||||||
--Options are "kick" "ban" "reshow" "rules" and "nothing"
|
--Options are "kick" "ban" "reshow" "rules" and "nothing"
|
||||||
interact.on_wrong_quiz = "reshow"
|
interact.on_wrong_quiz = "nothing"
|
||||||
|
--The message to send the player if reshow is the on_wrong_quiz option.
|
||||||
|
interact.quiz_try_again_msg = S("Have another go.")
|
||||||
|
--The message sent to the player if rules is the on_wrong_quiz option.
|
||||||
|
interact.quiz_rules_msg = S("Have another look at the rules:")
|
||||||
|
--The kick reason if kick is the on_wrong_quiz option.
|
||||||
|
interact.wrong_quiz_kick_msg = S("Pay more attention next time!")
|
||||||
|
--The message sent to the player if nothing is the on_wrong_quiz option.
|
||||||
|
interact.quiz_fail_msg = S("You got that wrong.")
|
||||||
|
|
||||||
|
--The messages send to the player after interact is granted.
|
||||||
|
interact.interact_msg1 = S("Thanks for accepting the rules, you now are able to interact with things.")
|
||||||
|
interact.interact_msg2 = S("Happy building!")
|
||||||
|
|
||||||
--The priv required to use the /rules command. If fast is a default priv, I recomend replacing shout with that.
|
--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 = {shout = true}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
interacthandler?
|
|
180
init.lua
180
init.lua
@ -1,8 +1,7 @@
|
|||||||
rule_table = {}
|
local S = minetest.get_translator("interact")
|
||||||
rule_language = {}
|
|
||||||
dofile(minetest.get_modpath("interact") .. "/rules-english.lua") --I put the rules in their own file so that they don't get lost/overlooked!
|
|
||||||
dofile(minetest.get_modpath("interact") .. "/rules-russian.lua")
|
|
||||||
dofile(minetest.get_modpath("interact") .. "/config.lua")
|
dofile(minetest.get_modpath("interact") .. "/config.lua")
|
||||||
|
dofile(minetest.get_modpath("interact") .. "/rules.lua") --I put the rules in their own file so that they don't get lost/overlooked!
|
||||||
|
|
||||||
local rule1 = 0
|
local rule1 = 0
|
||||||
local rule2 = 0
|
local rule2 = 0
|
||||||
@ -10,75 +9,61 @@ local rule3 = 0
|
|||||||
local rule4 = 0
|
local rule4 = 0
|
||||||
local multi = 0
|
local multi = 0
|
||||||
|
|
||||||
local all_languages = interact.default_language
|
local function make_formspec(player)
|
||||||
for k in pairs(rule_table) do
|
|
||||||
if k ~= interact.default_language then
|
|
||||||
all_languages = all_languages..", "..k
|
|
||||||
if rule_table[k].secondaryname then
|
|
||||||
all_languages = all_languages.." ("..rule_table[k].secondaryname..")"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function make_formspec(player, language)
|
|
||||||
if not language then language = interact.default_language end
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local size = { "size[10,4]" }
|
local size = { "size[10,4]" }
|
||||||
table.insert(size, "label[1,0.5;List of Languages (eg: /rules english)]")
|
table.insert(size, "label[0.5,0.5;" ..interact.s1_header.. "]")
|
||||||
table.insert(size, "label[1,1;"..all_languages.."]")
|
table.insert(size, "label[0.5,1.5;" ..interact.s1_l2.. "]")
|
||||||
table.insert(size, "label[0.5,0;" ..rule_table[language].s1_header.. "]")
|
table.insert(size, "label[0.5,2;" ..interact.s1_l3.. "]")
|
||||||
table.insert(size, "label[0.5,3.25;" ..rule_table[language].s1_l2.. "]")
|
table.insert(size, "button_exit[5.5,3.4;2,0.5;no;" ..interact.s1_b1.. "]")
|
||||||
table.insert(size, "label[0.5,3.75;" ..rule_table[language].s1_l3.. "]")
|
table.insert(size, "button[7.5,3.4;2,0.5;yes;" ..interact.s1_b2.. "]")
|
||||||
table.insert(size, "button_exit[5.5,3.4;2,0.5;no;" ..rule_table[language].s1_b1.. "]")
|
|
||||||
table.insert(size, "button[7.5,3.4;2,0.5;yes;" ..rule_table[language].s1_b2.. "]")
|
|
||||||
return table.concat(size)
|
return table.concat(size)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function make_formspec2(player, language)
|
local function make_formspec2(player)
|
||||||
if not language then language = interact.default_language end
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local size = { "size[10,4]" }
|
local size = { "size[10,4]" }
|
||||||
table.insert(size, "label[0.5,0.5;" ..rule_table[language].s2_l1.. "]")
|
table.insert(size, "label[0.5,0.5;" ..interact.s2_l1.. "]")
|
||||||
table.insert(size, "label[0.5,1;" ..rule_table[language].s2_l2.. "]")
|
table.insert(size, "label[0.5,1;" ..interact.s2_l2.. "]")
|
||||||
table.insert(size, "button_exit[2.5,3.4;3.5,0.5;interact;" ..rule_table[language].s2_b1.. "]")
|
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;" ..rule_table[language].s2_b2.. "]")
|
table.insert(size, "button_exit[6.4,3.4;3.6,0.5;visit;" ..interact.s2_b2.. "]")
|
||||||
return table.concat(size)
|
return table.concat(size)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function make_formspec3(player, language)
|
--Форма запроса на interact
|
||||||
if not language then language = interact.default_language end
|
local function make_formspec3(player)
|
||||||
local size = { "size[10,8]" }
|
local size = { "size[10,8]" }
|
||||||
table.insert(size, "textarea[0.5,0.5;9.5,7.5;TOS;" ..rule_table[language].s3_header.. ";" ..rule_table[language].rules.. "]")
|
table.insert(size, "textarea[0.5,0.5;9.5,5.5;TOS;" ..interact.s3_header.. ";" ..interact.rules.. "]")
|
||||||
table.insert(size, "button[5.5,7.4;2,0.5;decline;" ..rule_table[language].s3_b2.. "]")
|
table.insert(size, "field[0.5,6.4;2,0.5;answer;2+3="..S("answer")..";]")
|
||||||
table.insert(size, "button_exit[7.5,7.4;2,0.5;accept;" ..rule_table[language].s3_b1.. "]")
|
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.. "]")
|
||||||
return table.concat(size)
|
return table.concat(size)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function make_formspec4(player, language)
|
local function make_formspec4(player)
|
||||||
if not language then language = interact.default_language end
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local size = { "size[10,9]" }
|
local size = { "size[10,9]" }
|
||||||
if interact.s4_to_rules_button == true then
|
if interact.s4_to_rules_button == true then
|
||||||
table.insert(size, "button_exit[7.75,0.25;2.1,0.1;rules;" ..rule_table[language].s4_to_rules.. "]")
|
table.insert(size, "button_exit[7.75,0.25;2.1,0.1;rules;" ..interact.s4_to_rules.. "]")
|
||||||
end
|
end
|
||||||
table.insert(size, "label[0.25,0;" ..rule_table[language].s4_header.."]")
|
table.insert(size, "label[0.25,0;" ..interact.s4_header.."]")
|
||||||
table.insert(size, "label[0.5,0.5;" ..rule_table[language].question1.."]")
|
table.insert(size, "label[0.5,0.5;" ..interact.s4_question1.."]")
|
||||||
table.insert(size, "checkbox[0.25,1;rule1_true;" ..rule_table[language].s4_question1_true.."]")
|
table.insert(size, "checkbox[0.25,1;rule1_true;" ..interact.s4_question1_true.."]")
|
||||||
table.insert(size, "checkbox[4,1;rule1_false;" ..rule_table[language].s4_question1_false.. "]")
|
table.insert(size, "checkbox[4,1;rule1_false;" ..interact.s4_question1_false.. "]")
|
||||||
table.insert(size, "label[0.5,2;" ..rule_table[language].question2.. "]")
|
table.insert(size, "label[0.5,2;" ..interact.s4_question2.. "]")
|
||||||
table.insert(size, "checkbox[0.25,2.5;rule2_true;" ..rule_table[language].s4_question2_true.. "]")
|
table.insert(size, "checkbox[0.25,2.5;rule2_true;" ..interact.s4_question2_true.. "]")
|
||||||
table.insert(size, "checkbox[4,2.5;rule2_false;" ..rule_table[language].s4_question2_false.. "]")
|
table.insert(size, "checkbox[4,2.5;rule2_false;" ..interact.s4_question2_false.. "]")
|
||||||
table.insert(size, "label[0.5,3.5;" ..rule_table[language].question3.. "]")
|
table.insert(size, "label[0.5,3.5;" ..interact.s4_question3.. "]")
|
||||||
table.insert(size, "checkbox[0.25,4;rule3_true;" ..rule_table[language].s4_question3_true.. "]")
|
table.insert(size, "checkbox[0.25,4;rule3_true;" ..interact.s4_question3_true.. "]")
|
||||||
table.insert(size, "checkbox[4,4;rule3_false;" ..rule_table[language].s4_question3_false.. "]")
|
table.insert(size, "checkbox[4,4;rule3_false;" ..interact.s4_question3_false.. "]")
|
||||||
table.insert(size, "label[0.5,5;" ..rule_table[language].question4.. "]")
|
table.insert(size, "label[0.5,5;" ..interact.s4_question4.. "]")
|
||||||
table.insert(size, "checkbox[0.25,5.5;rule4_true;" ..rule_table[language].s4_question4_true.. "]")
|
table.insert(size, "checkbox[0.25,5.5;rule4_true;" ..interact.s4_question4_true.. "]")
|
||||||
table.insert(size, "checkbox[4,5.5;rule4_false;" ..rule_table[language].s4_question4_false.."]")
|
table.insert(size, "checkbox[4,5.5;rule4_false;" ..interact.s4_question4_false.."]")
|
||||||
table.insert(size, "label[0.5,6.5;" ..rule_table[language].multiquestion.. "]")
|
table.insert(size, "label[0.5,6.5;" ..interact.s4_multi_question.. "]")
|
||||||
table.insert(size, "checkbox[4.75,6.25;multi_choice1;" ..rule_table[language].mq_answer1.. "]")
|
table.insert(size, "checkbox[4.75,6.25;multi_choice1;" ..interact.s4_multi1.. "]")
|
||||||
table.insert(size, "checkbox[0.25,7;multi_choice2;" ..rule_table[language].mq_answer2.. "]")
|
table.insert(size, "checkbox[0.25,7;multi_choice2;" ..interact.s4_multi2.. "]")
|
||||||
table.insert(size, "checkbox[4.75,7;multi_choice3;" ..rule_table[language].mq_answer3.."]")
|
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;" ..rule_table[language].s4_submit.."]")
|
table.insert(size, "button_exit[3,8.4;3.5,0.5;submit;" ..interact.s4_submit.."]")
|
||||||
return table.concat(size)
|
return table.concat(size)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -95,22 +80,20 @@ local server_formspec = "size[10,4]" ..
|
|||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "interact_welcome" then return end
|
if formname ~= "interact_welcome" then return end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local language = rule_language[name] or interact.default_language
|
|
||||||
if fields.no then
|
if fields.no then
|
||||||
if interact.screen2 == false then
|
if interact.screen2 == false then
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_rules", make_formspec3(player, language))
|
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_visit", make_formspec2(player, language))
|
minetest.show_formspec(name, "interact_visit", make_formspec2(player))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
elseif fields.yes then
|
elseif fields.yes then
|
||||||
if interact.grief_ban ~= true then
|
if interact.grief_ban ~= true then
|
||||||
--minetest.kick_player(name, rule_table[language].msg_grief)
|
minetest.kick_player(name, interact.msg_grief)
|
||||||
minetest.chat_send_player(name, rule_table[language].msg_grief)
|
|
||||||
else
|
else
|
||||||
minetest.ban_player(name)
|
minetest.ban_player(name)
|
||||||
end
|
end
|
||||||
@ -121,14 +104,13 @@ end)
|
|||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "interact_visit" then return end
|
if formname ~= "interact_visit" then return end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local language = rule_language[name] or interact.default_language
|
|
||||||
if fields.interact then
|
if fields.interact then
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_rules", make_formspec3(player, language))
|
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
elseif fields.visit then
|
elseif fields.visit then
|
||||||
minetest.chat_send_player(name, rule_table[language].visit_msg)
|
minetest.chat_send_player(name, interact.visit_msg)
|
||||||
minetest.log("action", name.. " is just visiting.")
|
minetest.log("action", name.. " is just visiting.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -138,30 +120,37 @@ end)
|
|||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "interact_rules" then return end
|
if formname ~= "interact_rules" then return end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local language = rule_language[name] or interact.default_language
|
|
||||||
if fields.accept then
|
if fields.accept then
|
||||||
if interact.screen4 == false then
|
if interact.screen4 == false then
|
||||||
if minetest.check_player_privs(name, interact.priv) and not (interacthandler and interacthandler.player[name]) then
|
if minetest.check_player_privs(name, interact.priv) and fields.answer == "5" then
|
||||||
minetest.chat_send_player(name, rule_table[language].interact_msg1)
|
minetest.chat_send_player(name, interact.interact_msg1)
|
||||||
minetest.chat_send_player(name, rule_table[language].interact_msg2)
|
minetest.chat_send_player(name, interact.interact_msg2)
|
||||||
local privs = minetest.get_player_privs(name)
|
local privs = minetest.get_player_privs(name)
|
||||||
privs.interact = true
|
privs.interact = true
|
||||||
minetest.set_player_privs(name, privs)
|
minetest.set_player_privs(name, privs)
|
||||||
minetest.log("action", "Granted " ..name.. " interact.")
|
minetest.log("action", "Granted " ..name.. " interact.")
|
||||||
|
else
|
||||||
|
if interact.disagree_action == "kick" then
|
||||||
|
minetest.kick_player(name, interact.disagree_msg)
|
||||||
|
elseif interact.disagree_action == "ban" then
|
||||||
|
minetest.ban_player(name)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name, interact.disagree_msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_quiz", make_formspec4(player, language))
|
minetest.show_formspec(name, "interact_quiz", make_formspec4(player))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
elseif fields.decline then
|
elseif fields.decline then
|
||||||
if interact.disagree_action == "kick" then
|
if interact.disagree_action == "kick" then
|
||||||
minetest.kick_player(name, rule_table[language].disagree_msg)
|
minetest.kick_player(name, interact.disagree_msg)
|
||||||
elseif interact.disagree_action == "ban" then
|
elseif interact.disagree_action == "ban" then
|
||||||
minetest.ban_player(name)
|
minetest.ban_player(name)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, rule_table[language].disagree_msg)
|
minetest.chat_send_player(name, interact.disagree_msg)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -170,10 +159,9 @@ end)
|
|||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "interact_quiz" then return end
|
if formname ~= "interact_quiz" then return end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local language = rule_language[name] or interact.default_language
|
|
||||||
if fields.rules then
|
if fields.rules then
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_rules", make_formspec3(player, language))
|
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -195,17 +183,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
rule3 = 0
|
rule3 = 0
|
||||||
rule4 = 0
|
rule4 = 0
|
||||||
multi = 0
|
multi = 0
|
||||||
if minetest.check_player_privs(name, interact.priv) and not (interacthandler and interacthandler.player[name]) then
|
if minetest.check_player_privs(name, interact.priv) then
|
||||||
minetest.chat_send_player(name, rule_table[language].interact_msg1)
|
minetest.chat_send_player(name, interact.interact_msg1)
|
||||||
minetest.chat_send_player(name, rule_table[language].interact_msg2)
|
minetest.chat_send_player(name, interact.interact_msg2)
|
||||||
local privs = minetest.get_player_privs(name)
|
local privs = minetest.get_player_privs(name)
|
||||||
privs.interact = true
|
privs.interact = true
|
||||||
minetest.set_player_privs(name, privs)
|
minetest.set_player_privs(name, privs)
|
||||||
minetest.log("action", "Granted " ..name.. " interact.")
|
minetest.log("action", "Granted " ..name.. " interact.")
|
||||||
minetest.chat_send_all(name.. " passed the rules test, welcome him/her into CitySim")
|
|
||||||
if minetest.get_modpath("irc") ~= nil then
|
|
||||||
irc.say(name.. " passed the rules test, welcome him/her into CitySim")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
elseif fields.submit then
|
elseif fields.submit then
|
||||||
rule1 = 0
|
rule1 = 0
|
||||||
@ -214,51 +198,42 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
rule4 = 0
|
rule4 = 0
|
||||||
multi = 0
|
multi = 0
|
||||||
if interact.on_wrong_quiz == "kick" then
|
if interact.on_wrong_quiz == "kick" then
|
||||||
minetest.kick_player(name, rule_table[language].wrong_quiz_kick_msg)
|
minetest.kick_player(name, interact.wrong_quiz_kick_msg)
|
||||||
elseif interact.on_wrong_quiz == "ban" then
|
elseif interact.on_wrong_quiz == "ban" then
|
||||||
minetest.ban_player(name)
|
minetest.ban_player(name)
|
||||||
elseif interact.on_wrong_quiz == "reshow" then
|
elseif interact.on_wrong_quiz == "reshow" then
|
||||||
minetest.chat_send_player(name, rule_table[language].quiz_try_again_msg)
|
minetest.chat_send_player(name, interact.quiz_try_again_msg)
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_quiz", make_formspec4(player, language))
|
minetest.show_formspec(name, "interact_quiz", make_formspec4(player))
|
||||||
end)
|
end)
|
||||||
elseif interact.on_wrong_quiz == "rules" then
|
elseif interact.on_wrong_quiz == "rules" then
|
||||||
minetest.chat_send_player(name, rule_table[language].quiz_rules_msg)
|
minetest.chat_send_player(name, interact.quiz_rules_msg)
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_rules", make_formspec3(player, language))
|
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, rule_table[language].quiz_fail_msg)
|
minetest.chat_send_player(name, interact.quiz_fail_msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_chatcommand("rules",{
|
minetest.register_chatcommand("rules",{
|
||||||
params = "<language>",
|
params = "",
|
||||||
description = "Shows the server rules",
|
description = "Shows the server rules",
|
||||||
privs = interact.priv,
|
privs = interact.priv,
|
||||||
func = function (name,params)
|
func = function (name,params)
|
||||||
if (interacthandler and interacthandler.player[name]) then return false, "You are not allowed to use this command at this time." end
|
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
if not player then return false, "You must be ingame to use this command." end
|
|
||||||
local language = rule_language[name] or interact.default_language
|
|
||||||
if params ~= "" and rule_table[params:lower()] then
|
|
||||||
language = params:lower()
|
|
||||||
rule_language[name] = language
|
|
||||||
elseif params ~= "" then
|
|
||||||
minetest.chat_send_player(name, "There is no translation for '"..params:lower().."', Opening rules in '"..language.."'")
|
|
||||||
end
|
|
||||||
if interact.screen1 ~= false then
|
if interact.screen1 ~= false then
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_welcome", make_formspec(player, language))
|
minetest.show_formspec(name, "interact_welcome", make_formspec(player))
|
||||||
end)
|
end)
|
||||||
elseif interact.screen2 ~= false then
|
elseif interact.screen2 ~= false then
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_visit", make_formspec2(player, language))
|
minetest.show_formspec(name, "interact_visit", make_formspec2(player))
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
minetest.show_formspec(name, "interact_rules", make_formspec3(player, language))
|
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -266,14 +241,13 @@ minetest.register_chatcommand("rules",{
|
|||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local language = rule_language[name] or interact.default_language
|
if not minetest.get_player_privs(name).interact then
|
||||||
if not minetest.get_player_privs(name).interact and minetest.check_player_privs(name, interact.priv) and not (interacthandler and interacthandler.player[name]) then
|
|
||||||
if interact.screen1 ~= false then
|
if interact.screen1 ~= false then
|
||||||
minetest.show_formspec(name, "interact_welcome", make_formspec(player, language))
|
minetest.show_formspec(name, "interact_welcome", make_formspec(player))
|
||||||
elseif interact.screen2 ~= false then
|
elseif interact.screen2 ~= false then
|
||||||
minetest.show_formspec(name, "interact_visit", make_formspec2(player, language))
|
minetest.show_formspec(name, "interact_visit", make_formspec2(player))
|
||||||
else
|
else
|
||||||
minetest.show_formspec(name, "interact_rules", make_formspec3(player, language))
|
minetest.show_formspec(name, "interact_rules", make_formspec3(player))
|
||||||
end
|
end
|
||||||
elseif minetest.get_player_privs(name).server and interact.configured == false then
|
elseif minetest.get_player_privs(name).server and interact.configured == false then
|
||||||
minetest.show_formspec(name, "interact_no_changes_made", server_formspec)
|
minetest.show_formspec(name, "interact_no_changes_made", server_formspec)
|
||||||
|
25
locale/interact.ru.tr
Normal file
25
locale/interact.ru.tr
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# textdomain: interact
|
||||||
|
|
||||||
|
So, do you want interact, or do you just want to look around=Итак, вы хотите пообщаться или просто хотите осмотреться
|
||||||
|
the server?=на сервере?
|
||||||
|
Yes, I want!=Да, я хочу!
|
||||||
|
I just want to look round.=Я просто хочу осмотреться.
|
||||||
|
Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!=Приятной прогулки! Если вы хотите взаимодействовать в игре, просто введите в чат /rules, и вы сможете повторить процесс снова!
|
||||||
|
I agree=Я согласен
|
||||||
|
I disagree=Я не согласен
|
||||||
|
answer=ответ
|
||||||
|
Hello, welcome to this server!=Здравствуйте, добро пожаловать на этот сервер!
|
||||||
|
Could you please tell me if you like to grief or not?=Скажите, пожалуйста, любите ли вы горевать или нет?
|
||||||
|
No, I don't.=Нет, я не знаю.
|
||||||
|
Yes, I do!=Да!
|
||||||
|
Try out singleplayer if you like griefing, because then you'll only destroy your own stuff!=Если вам нравится грифинг, попробуйте одиночную игру, потому что тогда вы уничтожите только свои собственные имущество!
|
||||||
|
Here are the rules:=Вот правила:
|
||||||
|
Bye then! You have to agree to the rules to play on the server.=Ну тогда пока! Чтобы играть на сервере, вам необходимо согласиться с правилами.
|
||||||
|
Back to rules=Вернуться к правилам
|
||||||
|
Time for a quiz on the rules!=Пришло время викторины по правилам!
|
||||||
|
Have another go.=Попробуйте еще раз.
|
||||||
|
Have another look at the rules:=Еще раз взгляните на правила:
|
||||||
|
Pay more attention next time!=В следующий раз уделите больше внимания!
|
||||||
|
You got that wrong.=Вы поняли это неправильно.
|
||||||
|
Thanks for accepting the rules, you now are able to interact with things.=Спасибо за согласие с правилами, теперь вы можете взаимодействовать с вещами.
|
||||||
|
Happy building!=Приятного строительства!
|
@ -1,102 +0,0 @@
|
|||||||
--The actual rules.
|
|
||||||
local language = "english" --must be all lowercase
|
|
||||||
local yes = "Yes."
|
|
||||||
local no = "No."
|
|
||||||
rule_table[language] = {
|
|
||||||
secondaryname = nil, --secondary name, usually the language name in english, or in the actual language.
|
|
||||||
|
|
||||||
rules = [[
|
|
||||||
Rules:
|
|
||||||
|
|
||||||
1. PVP is allowed, excessive RDM is not. Do not Combat Log.
|
|
||||||
2. Don't be *overly* cruel, destructive, or inappropriate.
|
|
||||||
3. Keep swearing to a minimum, and don't spam.
|
|
||||||
4. No "Dating" in global chat.
|
|
||||||
5. Alternate accounts (alts) are not allowed. contact admin if you have a friend that needs an account.
|
|
||||||
6. Hacked clients or csms that give a pvp advantage are not allowed.
|
|
||||||
7. Do not steal. (temporary, you will see when the rules change)
|
|
||||||
|
|
||||||
Players may also lock you up for other crimes. (like dealing drugs or carrying unlawful weapons)
|
|
||||||
]],
|
|
||||||
|
|
||||||
--The questions on the rules, if the quiz is used.
|
|
||||||
--The checkboxes for the first 4 questions are in config.lua
|
|
||||||
question1 = "Are hacked clients or mods that give you a pvp advantage allowed?",
|
|
||||||
question2 = "Are alternative accounts allowed?",
|
|
||||||
question3 = "Can you 'date' in global chat?",
|
|
||||||
question4 = "Can you be banned for stealing?",
|
|
||||||
multiquestion = "Is PVP allowed?",
|
|
||||||
|
|
||||||
--The answers to the multiple choice questions. Only one of these should be true.
|
|
||||||
mq_answer1 = "No.",
|
|
||||||
mq_answer2 = "Only if you agree.",
|
|
||||||
mq_answer3 = "Yes, but there must be a valid reason.",
|
|
||||||
|
|
||||||
--The first screen--
|
|
||||||
--The text at the top.
|
|
||||||
s1_header = "Hello, welcome to CitySim!",
|
|
||||||
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
|
|
||||||
s1_l2 = "Could you please tell me if you like to grief a lot?",
|
|
||||||
s1_l3 = "Griefing is destroying places and generally making a mess.",
|
|
||||||
--The buttons. Each can have 15 characters, max.
|
|
||||||
s1_b1 = "No, I don't.",
|
|
||||||
s1_b2 = "Yes, I do!",
|
|
||||||
|
|
||||||
--The message to send kicked griefers.
|
|
||||||
msg_grief = "A *lot* of griefing is looked down upon, even though some is allowed by the server.",
|
|
||||||
|
|
||||||
--The second screen--
|
|
||||||
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
|
|
||||||
s2_l1 = "So, do you want interact, or do you just want to look around the server?",
|
|
||||||
s2_l2 = "",
|
|
||||||
--The buttons. These ones can have a maximum of 26 characters.
|
|
||||||
s2_b1 = "Yes, I want interact!",
|
|
||||||
s2_b2 = "I just want to look round.",
|
|
||||||
|
|
||||||
--The message the player is sent if s/he is just visiting.
|
|
||||||
visit_msg = "Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!",
|
|
||||||
|
|
||||||
--The third screen--
|
|
||||||
--The header for the rules box, this can have 60 characters, max.
|
|
||||||
s3_header = "Here are the rules:",
|
|
||||||
|
|
||||||
--The buttons. Each can have 15 characters, max.
|
|
||||||
s3_b1 = "I agree",
|
|
||||||
s3_b2 = "I disagree",
|
|
||||||
|
|
||||||
--The message to send players who disagree when they are kicked for disagring with the rules.
|
|
||||||
disagree_msg = "Bye then! You have to agree to the rules to play on the server.",
|
|
||||||
|
|
||||||
--The back to rules button. 13 characters, max.
|
|
||||||
s4_to_rules = "Back to rules",
|
|
||||||
|
|
||||||
--The header for screen 4. 60 characters max, although this is a bit of a squash. I recomend 55 as a max.
|
|
||||||
s4_header = "Time for a quiz on the rules!",
|
|
||||||
|
|
||||||
--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.
|
|
||||||
|
|
||||||
s4_question1_true = yes,
|
|
||||||
s4_question1_false = no,
|
|
||||||
s4_question2_true = yes,
|
|
||||||
s4_question2_false = no,
|
|
||||||
s4_question3_true = yes,
|
|
||||||
s4_question3_false = no,
|
|
||||||
s4_question4_true = yes,
|
|
||||||
s4_question4_false = no,
|
|
||||||
|
|
||||||
s4_submit = "Submit!",
|
|
||||||
|
|
||||||
--The message to send the player if reshow is the on_wrong_quiz option.
|
|
||||||
quiz_try_again_msg = "Have another go.",
|
|
||||||
--The message sent to the player if rules is the on_wrong_quiz option.
|
|
||||||
quiz_rules_msg = "Have another look at the rules:",
|
|
||||||
--The kick reason if kick is the on_wrong_quiz option.
|
|
||||||
wrong_quiz_kick_msg = "Pay more attention next time!",
|
|
||||||
--The message sent to the player if nothing is the on_wrong_quiz option.
|
|
||||||
quiz_fail_msg = "You answered a question incorrectly. type in '/rules' to try again. (read them carefully)",
|
|
||||||
|
|
||||||
--The messages send to the player after interact is granted.
|
|
||||||
interact_msg1 = "Thanks for accepting the rules, you now are able to interact with things.",
|
|
||||||
interact_msg2 = "Have fun! do /guide to help getting started!",
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
--The actual rules.
|
|
||||||
local language = "russian" --must be all lowercase
|
|
||||||
local yes = "да."
|
|
||||||
local no = "нет."
|
|
||||||
rule_table[language] = {
|
|
||||||
secondaryname = "русский", --secondary name, usually the language name in english, or in the actual language.
|
|
||||||
|
|
||||||
rules = [[
|
|
||||||
Правила:
|
|
||||||
|
|
||||||
1. PVP разрешен, RDM не разрешен. не выходить из боя.
|
|
||||||
2. Не будь * слишком * жестоким, разрушительным или неуместным
|
|
||||||
3. ругаться минимально, и не спамить.
|
|
||||||
4. Нет "знакомств" в глобальном чате.
|
|
||||||
5. Альтернативные аккаунты (alts) не допускаются. Свяжитесь с администратором, если у вас есть друг, которому нужна учетная запись.
|
|
||||||
6. Взломанные клиенты или csms, которые дают преимущество в pvp, не допускаются.
|
|
||||||
7. Не укради. (временно, вы увидите, когда изменятся правила)
|
|
||||||
|
|
||||||
Игроки могут также запереть вас за другие преступления. (например, продажа наркотиков или ношение незаконного оружия)
|
|
||||||
]],
|
|
||||||
|
|
||||||
--The questions on the rules, if the quiz is used.
|
|
||||||
--The checkboxes for the first 4 questions are in config.lua
|
|
||||||
question1 = "Разрешены ли взломанные клиенты или моды, которые дают вам преимущество в PvP?",
|
|
||||||
question2 = "Разрешены ли альтернативные аккаунты?",
|
|
||||||
question3 = "Вы можете встречаться в глобальном чате?",
|
|
||||||
question4 = "Вас могут забанить за кражу?",
|
|
||||||
multiquestion = "Разрешен ли PVP?",
|
|
||||||
|
|
||||||
--The answers to the multiple choice questions. Only one of these should be true.
|
|
||||||
mq_answer1 = "нет.",
|
|
||||||
mq_answer2 = "Только если ты согласен.",
|
|
||||||
mq_answer3 = "Да, но должна быть веская причина.",
|
|
||||||
|
|
||||||
--The first screen--
|
|
||||||
--The text at the top.
|
|
||||||
s1_header = "Здравствуйте, добро пожаловать в CitySim!",
|
|
||||||
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
|
|
||||||
s1_l2 = "Не могли бы вы сказать мне, если вы любите 'grief' много?",
|
|
||||||
s1_l3 = "'griefing' разрушает места и наводит беспорядок.",
|
|
||||||
--The buttons. Each can have 15 characters, max.
|
|
||||||
s1_b1 = "Нет не знаю.",
|
|
||||||
s1_b2 = "Да!",
|
|
||||||
|
|
||||||
--The message to send kicked griefers.
|
|
||||||
msg_grief = "На многие griefing смотрят свысока, хотя некоторые из них разрешены сервером.",
|
|
||||||
|
|
||||||
--The second screen--
|
|
||||||
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
|
|
||||||
s2_l1 = "Итак, вы хотите взаимодействовать, или вы просто хотите осмотреть сервер?",
|
|
||||||
s2_l2 = "",
|
|
||||||
--The buttons. These ones can have a maximum of 26 characters.
|
|
||||||
s2_b1 = "Да, я хочу построить!",
|
|
||||||
s2_b2 = "Я просто хочу осмотреться.",
|
|
||||||
|
|
||||||
--The message the player is sent if s/he is just visiting.
|
|
||||||
visit_msg = "Приятно провести время, оглядываясь вокруг! Если вы хотите взаимодействовать так же, как /rules, вы можете пройти через процесс снова!",
|
|
||||||
|
|
||||||
--The third screen--
|
|
||||||
--The header for the rules box, this can have 60 characters, max.
|
|
||||||
s3_header = "Вот правила:",
|
|
||||||
|
|
||||||
--The buttons. Each can have 15 characters, max.
|
|
||||||
s3_b1 = "согласен",
|
|
||||||
s3_b2 = "я не согласен",
|
|
||||||
|
|
||||||
--The message to send players who disagree when they are kicked for disagring with the rules.
|
|
||||||
disagree_msg = "Ну тогда пока! Вы должны согласиться с правилами игры на сервере.",
|
|
||||||
|
|
||||||
--The back to rules button. 13 characters, max.
|
|
||||||
s4_to_rules = "вернуться к правилам",
|
|
||||||
|
|
||||||
--The header for screen 4. 60 characters max, although this is a bit of a squash. I recomend 55 as a max.
|
|
||||||
s4_header = "Время для викторины о правилах!",
|
|
||||||
|
|
||||||
--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.
|
|
||||||
|
|
||||||
s4_question1_true = yes,
|
|
||||||
s4_question1_false = no,
|
|
||||||
s4_question2_true = yes,
|
|
||||||
s4_question2_false = no,
|
|
||||||
s4_question3_true = yes,
|
|
||||||
s4_question3_false = no,
|
|
||||||
s4_question4_true = yes,
|
|
||||||
s4_question4_false = no,
|
|
||||||
|
|
||||||
s4_submit = "утверждать",
|
|
||||||
|
|
||||||
--The message to send the player if reshow is the on_wrong_quiz option.
|
|
||||||
quiz_try_again_msg = "Попробуйте снова.",
|
|
||||||
--The message sent to the player if rules is the on_wrong_quiz option.
|
|
||||||
quiz_rules_msg = "Посмотрите еще раз на правила:",
|
|
||||||
--The kick reason if kick is the on_wrong_quiz option.
|
|
||||||
wrong_quiz_kick_msg = "Обратите больше внимания в следующий раз!",
|
|
||||||
--The message sent to the player if nothing is the on_wrong_quiz option.
|
|
||||||
quiz_fail_msg = "Вы ответили на вопрос неправильно. введите /rules, чтобы повторить попытку. (прочитайте их внимательно)",
|
|
||||||
|
|
||||||
--The messages send to the player after interact is granted.
|
|
||||||
interact_msg1 = "Спасибо за принятие правил, теперь вы можете взаимодействовать с вещами.",
|
|
||||||
interact_msg2 = "Повеселись! введите /guide, чтобы помочь начать! (это на английском)",
|
|
||||||
}
|
|
37
rules.lua
Normal file
37
rules.lua
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
--The actual rules.
|
||||||
|
interact.rules = [[
|
||||||
|
Rules:
|
||||||
|
|
||||||
|
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.
|
||||||
|
]]
|
||||||
|
|
||||||
|
--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?"
|
||||||
|
|
||||||
|
--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."
|
||||||
|
|
||||||
|
--Which answer is needed for the quiz questions. interact.quiz1-4 takes true or false.
|
||||||
|
--True is left, false is right.
|
||||||
|
--Please, please spell true and false right!!! If you spell it wrong it won't work!
|
||||||
|
--interact.quiz can be 1, 2 or 3.
|
||||||
|
--1 is the top one by the question, 2 is the bottom left one, 3 is the bottom right one.
|
||||||
|
--Make sure these agree with your answers!
|
||||||
|
interact.quiz1 = false
|
||||||
|
interact.quiz2 = false
|
||||||
|
interact.quiz3 = true
|
||||||
|
interact.quiz4 = false
|
||||||
|
interact.quiz_multi = 1
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 399 KiB After Width: | Height: | Size: 428 KiB |
Loading…
Reference in New Issue
Block a user