summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2024-09-14 16:58:08 -0500
committercheapie <no-email-for-you@example.com>2024-09-14 16:58:08 -0500
commit9ab552ae19fb10d4630192aaeb494d6f1fd88e7b (patch)
tree8e2181cd321e67d79e150966308d249fd69fd1f7
parent7dc5c49155e5b610af5a9467c66ef7f9e82997bd (diff)
downloaddaynightratio-main.tar
daynightratio-main.tar.gz
daynightratio-main.tar.bz2
daynightratio-main.tar.xz
daynightratio-main.zip
Add luacheck configuration and some minor cleanupHEADmain
-rw-r--r--.luacheckrc6
-rw-r--r--init.lua14
2 files changed, 17 insertions, 3 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..063f893
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,6 @@
+max_line_length = 160
+
+read_globals = {
+ "playersettings",
+ "minetest",
+}
diff --git a/init.lua b/init.lua
index 7a5f9e8..e1bd304 100644
--- a/init.lua
+++ b/init.lua
@@ -1,4 +1,4 @@
-local function set(name,old,new)
+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"))
@@ -9,7 +9,9 @@ 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.",
+ 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,
@@ -18,7 +20,13 @@ playersettings.register("daynightratio:enabled",{
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",
+ 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,