First commit

master
Zughy 2020-11-29 15:00:54 +01:00
parent 6f243839f0
commit 83579d646e
6 changed files with 110 additions and 1 deletions

View File

@ -1,3 +1,5 @@
# A.E.S. - Terms of service
The terms to accept in order to play
The terms to accept in order to play
Highly modified version of the Kaeza mod

3
init.lua Executable file
View File

@ -0,0 +1,3 @@
--originally by keaza
dofile(minetest.get_modpath("terms_of_service") .. "/player_manager.lua")
dofile(minetest.get_modpath("terms_of_service") .. "/privs.lua")

18
locale/terms_of_use.it.tr Executable file
View File

@ -0,0 +1,18 @@
# textdomain: terms_of_service
Always respect other players=Rispettare gli altri giocatori, sempre e comunque
No excessive swearing=Niente bestemmie o eccesso di imprecazioni
No modified clients=Niente client modificati
Admins reserve the right to remove whoever transgress the rules. In case of repeated misbehaviours, the user will be banned=Gli admin si riservano il diritto di allontanare chi trasgredisce le regole. In caso di comportamenti ripetuti, l'utente verrà bannato
never=mai
SERVER RULES=REGOLAMENTO SERVER
When can I insult a user? One word=Quando posso insultare un utente? Una parola
Accept=Accetto
Deny=Rifiuto
always=sempre
You're funny, but we're funnier=Sei simpatico/a, ma noi di più
Enjoy your staying!=Buon divertimento!
Wrong, try again=Sbagliato, riprova
Please read carefully and click 'accept'=Per favore leggi meglio e clicca 'accetto'
All the players must adhere to the rules=Tutti i giocatori devono aderire al regolamento

1
mod.conf Executable file
View File

@ -0,0 +1 @@
name = terms_of_service

84
player_manager.lua Normal file
View File

@ -0,0 +1,84 @@
local S = minetest.get_translator("terms_of_service")
local function make_formspec() end
local TOS = [[
]] .. "1) " .. S("Always respect other players") .. "\n" .. [[
]] .. "2) " .. S("No excessive swearing") .. "\n" .. [[
]] .. "3) " .. S("No modified clients") .. "\n" .. [[
]] .. "\n" .. [[
]] .. S("Admins reserve the right to remove whoever transgress the rules. In case of repeated misbehaviours, the user will be banned")
minetest.register_on_joinplayer(function(player)
local p_name = player:get_player_name()
if not minetest.get_player_privs(p_name).tos_accepted then
minetest.after(1, function()
minetest.show_formspec(p_name, "tos:tos_fs", make_formspec())
end)
end
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "tos:tos_fs" then return end
local p_name = player:get_player_name()
if fields.ok or fields.key_enter then
if fields.hidden_word == string.lower(fields.entry) then
local privs = minetest.get_player_privs(p_name)
privs.tos_accepted = true
privs.interact = true
minetest.set_player_privs(p_name, privs)
minetest.chat_send_player(p_name, S("Enjoy your staying!"))
else
minetest.chat_send_player(p_name, S("Wrong, try again"))
minetest.show_formspec(p_name, "tos:tos_fs", make_formspec())
return
end
elseif fields.quit then
if not minetest.get_player_privs(p_name).tos_accepted then
minetest.chat_send_player(p_name, S("Please read carefully and click 'accept'"))
minetest.show_formspec(p_name, "tos:tos_fs", make_formspec())
return
end
elseif fields.no then
minetest.kick_player(p_name, S("All the players must adhere to the rules"))
return
else
minetest.show_formspec(p_name, "tos:tos_fs", make_formspec())
end
end)
----------------------------------------------
---------------FUNZIONI LOCALI----------------
----------------------------------------------
function make_formspec()
local word = S("never")
local formspec = {
"size[9,8]",
"textarea[0.5,0.5;8,7;TOS;".. S("SERVER RULES") .. ";"..TOS.."]",
"field[0.5,7.5;6,1;entry;" .. S("When can I insult a user? One word") .. ";]",
"button_exit[6,7.4;1.5,0.5;ok;" .. S("Accept") .. "]",
"button[7.5,7.4;1.5,0.5;no;" .. S("Deny") .. "]",
"field[10,10;0.1,0.1;hidden_word;;"..word.."]",
"field_close_on_enter[;false]"
}
return table.concat(formspec, "")
end

1
privs.lua Normal file
View File

@ -0,0 +1 @@
minetest.register_privilege("tos_accepted", "TOS Accepted")