Add server_news mod

master
Solebull 2019-02-28 16:18:26 +01:00
parent dfa62197b5
commit 97845c77f9
7 changed files with 118 additions and 5 deletions

View File

@ -208,3 +208,8 @@ Voici la liste des commandes implémentées. Pour y accéder taper
whoin : Get all members of a faction
stats : Get stats of a faction
seen : Check the last time a faction had a member logged in
## Server news
Le fichier affiché par le mod *server_news* est `mods/server_news/news.txt`.

15
ROADMAP
View File

@ -178,18 +178,21 @@ It's really fast. May be used on a website, to show the actual map.
**** Try mumble-link
- see https://github.com/chipgw/minetest-mumble-wrapper
**** TODO More bugfixes
CLOCK: [2019-02-28 jeu. 15:45]
CLOCK: [2019-02-26 mar. 03:24]--[2019-02-26 mar. 03:40] => 0:16
- [X] Test singleplayer in death mesage
- [-] May use https://content.minetest.net/packages/Shara/server_news/
To replace our welcome message.
But the news.txt must be placed in the world directory, bad
- [X] Explain local changes
- [ ] Remove welcome message mod
- [ ] There is a shadow issue in the caves. Too much light
There was a mod for this in *random content*
- [ ] May use https://content.minetest.net/packages/Shara/server_news/
To replace our welcome message
- [ ] Maybe cement ?? https://content.minetest.net/packages/Linuxdirk/cement/
- [ ] Mayebe skills ? https://content.minetest.net/packages/domtron%20vox/skillsframework/
- [ ] Maybe skills ? https://content.minetest.net/packages/domtron%20vox/skillsframework/
- [ ] Give a look at https://content.minetest.net/packages/rubenwardy/ctf_pvp_engine/
- [ ] Maybe this chat filter https://content.minetest.net/packages/sofar/filter/
- [ ] I love the way *the legend of minetest* is showing we're mining a block
A progressive blue halo
- [ ] Mayber a cannon mod ? https://content.minetest.net/packages/addi/cannons/
- [ ] Faction chest must be for faction only (no parcel needed)
- [ ] Try to find a protector mod, test it
- [ ] Make the protector/faction_protector available to all members of
@ -228,6 +231,8 @@ It's really fast. May be used on a website, to show the actual map.
- [ ] Rebuild minetest with master
- Don't forget to issue a *git pull* before
- [ ] May also test with the stable-0.4 branch
**** *Next stream test*
- [ ] New texture pack Picel Perfection
**** DONE Improve minetestmapper
*Should show factions*
- [X] Clone this project and create a gitlab project as minetestmapper-factions

View File

@ -0,0 +1,20 @@
Server News
===
Simple server news mod by Shara RedCat.
This displays a news formspec when the player joins. To set the news text make
a file named news.txt in this mod's directory. The contents of this file will
display as the news. When changing the contents of the file, there is no need
to restart the server for it to update in game.
Players can also type /news to display the formspec at any time.
Players with the news_bypass privilege will not see the formspec when they
sign in, but can still use the /news command.
License
-------
Code for this mod is released under MIT (https://opensource.org/licenses/MIT).

44
mods/server_news/init.lua Normal file
View File

@ -0,0 +1,44 @@
-- register bypass priv
minetest.register_privilege("news_bypass", {
description = "Skip the news.", give_to_singleplayer = false})
-- create formspec from text file
local function get_formspec()
local news_file = io.open(minetest.get_modpath("server_news").."/news.txt", "r")
if news_file == nil then
minetest.log("error", "Can't open server_news news file")
return ""
end
local news_fs = 'size[12,8.25]'..
"button_exit[-0.05,7.8;2,1;exit;Close]"
if news_file then
local news = news_file:read("*a")
news_file:close()
news_fs = news_fs.."textarea[0.25,0;12.1,9;news;;"..news.."]"
else
news_fs = news_fs.."textarea[0.25,0;12.1,9;news;;No current news.]"
end
return news_fs
end
-- show news formspec on player join, unless player has bypass priv
minetest.register_on_joinplayer(function (player)
local name = player:get_player_name()
if minetest.get_player_privs(name).news_bypass then
return
else
minetest.show_formspec(name, "news", get_formspec())
end
end)
-- command to display server news at any time
minetest.register_chatcommand("news", {
description = "Shows server news to the player",
func = function (name)
local player = minetest.get_player_by_name(name)
minetest.show_formspec(name, "news", get_formspec())
end
})

View File

@ -0,0 +1,27 @@
License: MIT
Mod by: Shara RedCat.
---
The MIT License (MIT)
Copyright (c) 2018 Shara RedCat
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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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.

11
mods/server_news/news.txt Normal file
View File

@ -0,0 +1,11 @@
Bienvenue sur le serveur PVP/Faction de Solebull !
Ce serveur et cette map ne servent pour le moment qu'a des fins
de test et de développement.
La configuration peut changer a tout moment et la map peut être
réinitialisée au prochain stream.
Merci et bon jeu!

1
news.txt Symbolic link
View File

@ -0,0 +1 @@
mods/server_news/news.txt