From 7dc5c49155e5b610af5a9467c66ef7f9e82997bd Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 5 Mar 2021 00:00:51 -0600 Subject: Add initial content --- COPYING | 24 ++++++++++++++++++++++++ README | 5 +++++ init.lua | 27 +++++++++++++++++++++++++++ mod.conf | 5 +++++ 4 files changed, 61 insertions(+) create mode 100644 COPYING create mode 100644 README create mode 100644 init.lua create mode 100644 mod.conf diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/COPYING @@ -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 diff --git a/README b/README new file mode 100644 index 0000000..373912b --- /dev/null +++ b/README @@ -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 -- cgit v1.2.3