summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2016-05-17 23:25:31 -0500
committercheapie <no-email-for-you@example.com>2016-05-17 23:25:31 -0500
commit2557f7f590f0e2b9a93b777d33c6198b5f279a89 (patch)
tree2c6fc6e4dfe6124d7a4dbc93fe55f73d8771b01c
parentcbf1f754aa58ed2a0e9ac3092ade5b5e080626fd (diff)
downloadnewplayer-2557f7f590f0e2b9a93b777d33c6198b5f279a89.tar
newplayer-2557f7f590f0e2b9a93b777d33c6198b5f279a89.tar.gz
newplayer-2557f7f590f0e2b9a93b777d33c6198b5f279a89.tar.bz2
newplayer-2557f7f590f0e2b9a93b777d33c6198b5f279a89.tar.xz
newplayer-2557f7f590f0e2b9a93b777d33c6198b5f279a89.zip
Change rules file location
-rw-r--r--README2
-rw-r--r--init.lua6
2 files changed, 4 insertions, 4 deletions
diff --git a/README b/README
index d2e64d2..0130cf1 100644
--- a/README
+++ b/README
@@ -5,7 +5,7 @@ This mod adds a form containing the rules that is shown to players without inter
If they press "I agree", they are teleported to the normal spawn. The /spawn command will also take them back there (or to the non-interact spawn if they don't have interact).
If they press "I do not agree", they are allowed to play normally (but without interact), although bright red text will be placed in the middle of the screen explaining the situation.
At any point, the /rules command will show the rules. The /set_interact_spawn and /set_no_interact_spawn commands (requiring the server priv) will set the respective spawn point to your current location.
-To set the rules, either place a file called "rules.txt" in the mod's directory, press the "Edit" button at the rules screen, or use the /editrules command (the latter two methods require the "server" priv). If this file does not exist, the mod will tell you where to create it if you attempt to view the rules.
+To set the rules, either place a file called "newplayer-rules.txt" in the world directory, press the "Edit" button at the rules screen, or use the /editrules command (the latter two methods require the "server" priv). If this file does not exist, the mod will tell you where to create it if you attempt to view the rules.
If a keyword is set (Use /set_keyword to set it or /get_keyword to see what it's set to, both require server privs. It can also be edited from the rules editor.), then players will have to enter it into a provided text box before clicking the agree button. It is then possible to put the string "@KEYWORD" in the rules, which will be replaced with the keyword when they are shown to a player without interact. This substitution (intentionally) does not occur when the rules are being shown to somebody with interact (for example, if they use the /rules command because they want to re-read them)* so that they can't see the keyword, preventing them from telling other players what it is provided that it is changed freqently enough.
If a keyword is not set, players are not asked for it and simply pressing the "I agree" button is enough.
diff --git a/init.lua b/init.lua
index ffd6cf3..a7b2f3c 100644
--- a/init.lua
+++ b/init.lua
@@ -5,13 +5,13 @@ if newplayer.keyword == "" then newplayer.keyword = nil end
newplayer.hudids = {}
-local f = io.open(minetest.get_modpath("newplayer")..DIR_DELIM.."rules.txt","r")
+local f = io.open(minetest.get_worldpath()..DIR_DELIM.."newplayer-rules.txt","r")
if f then
local d = f:read("*all")
newplayer.rules = minetest.formspec_escape(d)
f:close()
else
- newplayer.rules = "Rules file not found!\n\nThe file should be named \"rules.txt\" and placed in the following location:\n\n"..minetest.get_modpath("newplayer")..DIR_DELIM
+ newplayer.rules = "Rules file not found!\n\nThe file should be named \"newplayer-rules.txt\" and placed in the following location:\n\n"..minetest.get_worldpath()..DIR_DELIM
end
function newplayer.showrulesform(name)
@@ -117,7 +117,7 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
elseif formname == "newplayer:editrules" then
if minetest.check_player_privs(name, {server=true}) then
if fields.save then
- local f = io.open(minetest.get_modpath("newplayer")..DIR_DELIM.."rules.txt","w")
+ local f = io.open(minetest.get_worldpath()..DIR_DELIM.."newplayer-rules.txt","w")
f:write(fields.rules)
f:close()
newplayer.rules = fields.rules