Initial Commit
This commit is contained in:
commit
00e9c18ce6
15
.luacheckrc
Normal file
15
.luacheckrc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
unused_args = false
|
||||||
|
allow_defined_top = true
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
"DIR_DELIM",
|
||||||
|
"minetest", "core",
|
||||||
|
"dump",
|
||||||
|
"vector", "nodeupdate",
|
||||||
|
"VoxelManip", "VoxelArea",
|
||||||
|
"PseudoRandom", "ItemStack",
|
||||||
|
"intllib",
|
||||||
|
"default",
|
||||||
|
table = { fields = { "copy", "getn" } }
|
||||||
|
}
|
||||||
|
|
0
depends.txt
Normal file
0
depends.txt
Normal file
1
description.txt
Normal file
1
description.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Allows you to have different day and night speeds.
|
66
init.lua
Normal file
66
init.lua
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
|
Copyright 2018 - Auke Kok <sofar@foo-projects.org>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for
|
||||||
|
any purpose with or without fee is hereby granted, provided that the
|
||||||
|
above copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||||
|
BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||||
|
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
local S = minetest.get_mod_storage()
|
||||||
|
assert(S)
|
||||||
|
local G = minetest.settings
|
||||||
|
assert(G)
|
||||||
|
|
||||||
|
local function nightandday()
|
||||||
|
minetest.after(3.7, nightandday)
|
||||||
|
|
||||||
|
local ds = S:get_int("day_time_speed") or 72
|
||||||
|
local ns = S:get_int("night_time_speed") or 72
|
||||||
|
|
||||||
|
local t = minetest.get_timeofday()
|
||||||
|
|
||||||
|
if t > 0.25 and t <= 0.75 then
|
||||||
|
if t ~= ds then
|
||||||
|
G:set("time_speed", ds)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if t ~= ns then
|
||||||
|
G:set("time_speed", ns)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("nightandday", {
|
||||||
|
params = "nightandday server",
|
||||||
|
description = "Change day and night speeds",
|
||||||
|
privs = {server = true},
|
||||||
|
func = function(name, param)
|
||||||
|
local p = string.split(param, " ", false, 2, false)
|
||||||
|
if #p == 2 then
|
||||||
|
local ds = tonumber(p[1])
|
||||||
|
local ns = tonumber(p[2])
|
||||||
|
if ds < 1 or ns < 1 then
|
||||||
|
return false, "Usage: /nightandday dayspeed nightspeed"
|
||||||
|
end
|
||||||
|
S:set_int("day_time_speed", ds)
|
||||||
|
S:set_int("night_time_speed", ns)
|
||||||
|
return true, "Speeds set to: " .. ds .. ", " .. ns
|
||||||
|
else
|
||||||
|
return false, "Usage: /nightandday dayspeed nightspeed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.after(3.7, nightandday)
|
Loading…
x
Reference in New Issue
Block a user