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 /init.lua | |
download | daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar.gz daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar.bz2 daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.tar.xz daynightratio-7dc5c49155e5b610af5a9467c66ef7f9e82997bd.zip |
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 27 |
1 files changed, 27 insertions, 0 deletions
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, +}) |