serverguide/init.lua

199 lines
7.5 KiB
Lua

local serverguide_Book_title="The server guide"
local serverguide_Tab_Text_1=[[
Type /guide to see this.
===\] Description \[===============
Welcome to "Notre Ami Le Cube"! (or NALC)
This highly modded Minetest server is designed to be balanced and gives you multiple
possibilities in the way you play.
Be a builder, an engineer, a warrior, a magician or even a trader.
The possibilities are almost endless.
But be careful, surviving will be a real challenge.
===\] Server Specs \[==============
- CPU: 2vCore at 3.8 GHz - RAM: 4 GB
- Internet speed: 1 GB Down / 700 MB Up
- OS: Gentoo Linux
- Map: Valleys Mapgen - Seed : 1681440164076556961
===\] IRC Server \[================
Official: irc.geeknode.org:6697 - Channel #minetest-nalc
Alternate: irc.sys4.fr:6697 - Channel #NALC
Server hosted by Sys4 and maintened by Sys4 and other contributors.
]]
local serverguide_Tab_Text_2= [[
EN:
Type the command /rules
To show irc rules, type the command /irc
FR:
Tapez la commande /rules
Pour montrer les règles de l'irc, tapez la commande /irc
]]
local serverguide_Tab_Text_3= [[
===\] Staff \[====================
- Administrator / Administrateur: sys4
- Moderators / Moderateurs: Cyberpangolin, farfadet46, Grossam, Getsuga
* EN: If you want to become a moderator, therefore to obtain special rights and be able to
deliver them to other players, you will of course have to have proven yourself on the server.
The decision will be exclusively mine to issue moderation rights to people
whom I will judge to be competent to obtain them.
* FR: Si vous voulez devenir modérateur, donc pour obtenir des droits spéciaux et pouvoir
en délivrer à d'autres joueurs, il faudra bien sûr que vous ayez fais vos preuves sur le serveur.
La décision m'appartiendra exclusivement de délivrer les droits de modération aux personnes
que je jugerai comme compétentes pour les obtenir.
]]
local serverguide_Tab_Text_4=[[
===\] Commands \[==================
- /guide: Montrer ce guide / Show this guide.
- /news: Voir les news du serveur / Show server news.
- /help \[all | command\]: Obtenir l'aide complète ou d'une commande / Get complete help or
help on a command.
- /hotbar \[n\]: Changer la taille de la barre d'inventaire (23 max) / Change the inventory bar
size (23 max).
- /volume: Modifier séparément les volumes sonores de la musique et des effets / Change the
sound volumes of music and effects separately.
- /report: Laisser un message aux modérateurs (rapporter un bug, faire une demande, informer
sur le comportement d'un joueur, etc.) / Leave a message to the moderators
(report a bug, make a request, inform about the behavior of a player, etc.)
- /mail <player> <msg> : Envoyer un courriel à un autre joueur / Send an email to another
player.
- /inbox: Lire ses courriels / Read your emails.
]]
local serverguide_Tab_Text_5=[[
===\] Dev & contribute \[========
- Git repositories:
- https://sys4.fr/gitea/nalc/nalc-server
- https://sys4.fr/gitea/nalc/nalc_game
- https://sys4.fr/gitea/nalc/nalc-server-mods
- Documentation (FR only):
https://sys4.fr/gitea/nalc/nalc-server/wiki/
===\] Server History \[============
Au départ, ce serveur privé a été créé pour réaliser une série de vidéos Minetest
sur Youtube co-animée par moi et Cyberpangolin.
Étant grands fans du serveur MFF, nous avions alors décidé d'en faire un fork
en rajoutant quelques mods dont nous avions besoins pour nos vidéos.
Quand MFF mit fin à son serveur (RIP), NALC a continué d'évoluer sur sa
propre voie et a depuis subi d'importants changements.
Puis les vidéos youtube ont pris fin et fût venue le temps de l'ouvrir au public.
Je considère que NALC est en quelque sorte un successeur spirituel de MFF.
-- Sys4
]]
local serverguide_Tab_1="Server"
local serverguide_Tab_2="Règles/Rules"
local serverguide_Tab_3="Staff"
local serverguide_Tab_4="Commands"
local serverguide_Tab_5="Divers"
local function serverguide_guide(user,text_to_show)
local text=""
if text_to_show==1 then text=serverguide_Tab_Text_1 end
if text_to_show==2 then text=serverguide_Tab_Text_2 end
if text_to_show==3 then text=serverguide_Tab_Text_3 end
if text_to_show==4 then text=serverguide_Tab_Text_4 end
if text_to_show==5 then text=serverguide_Tab_Text_5 end
local form="size[8.5,9]" ..default.gui_bg..default.gui_bg_img..
"button[0,0;1.5,1;tab1;" .. serverguide_Tab_1 .. "]" ..
"button[1.5,0;1.5,1;tab2;" .. serverguide_Tab_2 .. "]" ..
"button[3,0;1.5,1;tab3;" .. serverguide_Tab_3 .. "]" ..
"button[4.5,0;1.5,1;tab4;" .. serverguide_Tab_4 .. "]" ..
"button[6,0;1.5,1;tab5;" .. serverguide_Tab_5 .. "]" ..
"button_exit[7.5,0; 1,1;tab6;X]" ..
"label[0,1;"..text .."]"
minetest.show_formspec(user:get_player_name(), "serverguide",form)
end
minetest.register_on_player_receive_fields(function(player, form, pressed)
if form=="serverguide" then
if pressed.tab1 then serverguide_guide(player,1) end
if pressed.tab2 then serverguide_guide(player,2) end
if pressed.tab3 then serverguide_guide(player,3) end
if pressed.tab4 then serverguide_guide(player,4) end
if pressed.tab5 then serverguide_guide(player,5) end
end
end)
minetest.register_tool("serverguide:book", {
description = serverguide_Book_title,
inventory_image = "default_book.png",
on_use = function(itemstack, user, pointed_thing)
serverguide_guide(user,1)
return itemstack
end,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local node = minetest.get_node_or_nil(pos)
local def = node and minetest.registered_nodes[node.name]
if not def or not def.buildable_to then
pos = pointed_thing.above
node = minetest.get_node_or_nil(pos)
def = node and minetest.registered_nodes[node.name]
if not def or not def.buildable_to then return itemstack end
end
if minetest.is_protected(pos, placer:get_player_name()) then return itemstack end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos, {name = "serverguide:guide",param2 = fdir,})
itemstack:take_item()
return itemstack
end
})
minetest.register_alias("guide", "serverguide:book")
minetest.register_craft({output = "serverguide:book",recipe = {{"default:stick","default:stick"},}})
minetest.register_node("serverguide:guide", {
description = serverguide_Book_title,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drop="serverguide:book",
node_box = {
type = "fixed",
fixed = {0.35,-0.3,0.45,-0.35,-0.5,-0.45},
},
tiles = {
"default_gold_block.png^default_book.png",
"default_gold_block.png",
"default_gold_block.png",
"default_gold_block.png",
"default_gold_block.png",
"default_gold_block.png",},
groups = {cracky=1,oddly_breakable_by_hand=3},
sounds=default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", serverguide_Book_title)
end,
on_rightclick = function(pos, node, clicker)
serverguide_guide(clicker,1)
end
})
minetest.register_on_newplayer(function(player)
player:get_inventory():add_item("main", "serverguide:book")
end)
minetest.register_chatcommand("guide", {
params = "",
description = serverguide_Book_title,
func = function(name, param)
serverguide_guide(minetest.get_player_by_name(name),1)
return true
end
})
minetest.log("action", "[serverguide] loaded.")