summaryrefslogtreecommitdiff
path: root/init.lua
blob: e1bd304c6aafbcd3e34f588485901e29953b595c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local function set(name)
	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\n"..
	           "in the \"Day/Night Ratio: Custom ratio\" setting.\n"..
	           "If 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,\n"..
	           "this day ratio will be used at all times.\n"..
	           "If that setting is disabled, this setting\n"..
	           "will have no effect.\n"..
	           "0: Darker than night\n"..
	           "0.2: Night\n"..
	           "1: Day",
	type = "number",
	min = 0,
	max = 1,
	default = 1,
	afterchange = set,
})