diff options
author | cheapie <no-email-for-you@example.com> | 2021-03-05 00:00:51 -0600 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2021-03-05 00:00:51 -0600 |
commit | 7dc5c49155e5b610af5a9467c66ef7f9e82997bd (patch) | |
tree | fbf2422297581e123479eb12145f65ce1d08cb12 | |
download | daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar.gz daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar.bz2 daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar.xz daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.zip |
Add initial content
-rw-r--r-- | COPYING | 24 | ||||
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | init.lua | 27 | ||||
-rw-r--r-- | mod.conf | 5 |
4 files changed, 61 insertions, 0 deletions
@@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +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 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. + +For more information, please refer to <http://unlicense.org/> @@ -0,0 +1,5 @@ +daynightratio +============= + +Allows players to choose permanent day, permanent night, anywhere in between, or normal day/night cycling. +Settings are accessed from and documented in the settings menu from "playersettings". diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..7a5f9e8 --- /dev/null +++ b/init.lua @@ -0,0 +1,27 @@ +local function set(name,old,new) + local player = minetest.get_player_by_name(name) + if playersettings.get(name,"daynightratio:enabled") then + player:override_day_night_ratio(playersettings.get(name,"daynightratio:ratio")) + else + player:override_day_night_ratio(nil) + end +end + +playersettings.register("daynightratio:enabled",{ + shortdesc = "Day/Night Ratio: Use fixed ratio", + longdesc = "If enabled, a fixed day/night ratio will be used as set\nin the \"Day/Night Ratio: Custom ratio\" setting.\nIf disabled, day and night will cycle normally.", + type = "boolean", + default = false, + onjoin = set, + afterchange = set, +}) + +playersettings.register("daynightratio:ratio",{ + shortdesc = "Day/Night Ratio: Custom ratio", + longdesc = "If the \"Day/Night Ratio: Use fixed ratio\" setting is enabled,\nthis day ratio will be used at all times.\nIf that setting is disabled, this setting\nwill have no effect.\n0: Darker than night\n0.2: Night\n1: Day", + type = "number", + min = 0, + max = 1, + default = 1, + afterchange = set, +}) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..9506663 --- /dev/null +++ b/mod.conf @@ -0,0 +1,5 @@ +name = daynightratio +description = Day/night ratio selector for use with the playersettings mod +depends = playersettings +author = cheapie +title = Day/Night Ratio Settings |