randomscreenshot: make it nice :)
This commit is contained in:
parent
96e1367839
commit
b88f3fd140
@ -4,16 +4,30 @@
|
|||||||
|
|
||||||
randomscreenshot = {}
|
randomscreenshot = {}
|
||||||
|
|
||||||
local interval=10 -- minimum number of minutes to wait til next screenshot
|
local function init_settings(setting_table)
|
||||||
local rnd=10 --random time
|
for k, v in pairs(setting_table) do
|
||||||
local nextsc=0
|
if minetest.settings:get(k) == nil then
|
||||||
|
if type(v) == "boolean" then
|
||||||
|
minetest.settings:set_bool(k, v)
|
||||||
|
else
|
||||||
|
minetest.settings:set(k, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
init_settings({
|
||||||
|
randomscreenshot_interval = 10,
|
||||||
|
randomscreenshot_rnd = 10
|
||||||
|
})
|
||||||
|
|
||||||
|
local nextsc=0
|
||||||
|
|
||||||
minetest.register_globalstep(function()
|
minetest.register_globalstep(function()
|
||||||
if not minetest.settings:get_bool("randomsc") then return end
|
if not minetest.settings:get_bool("randomsc") then return end
|
||||||
if os.time() < nextsc then return end
|
if os.time() < nextsc then return end
|
||||||
math.randomseed(os.clock())
|
math.randomseed(os.clock())
|
||||||
nextsc=os.time() + ( interval * 60 ) + math.random(rnd * 60)
|
nextsc=os.time() + ( minetest.settings:get('randomscreenshot_interval') * 60 ) + math.random(minetest.settings:get('randomscreenshot_rnd') * 60)
|
||||||
minetest.after("15.0",function()
|
minetest.after("15.0",function()
|
||||||
minetest.hide_huds()
|
minetest.hide_huds()
|
||||||
minetest.display_chat_message("\n\n\n\n\n\n\n\n\n")
|
minetest.display_chat_message("\n\n\n\n\n\n\n\n\n")
|
||||||
|
@ -1 +1,4 @@
|
|||||||
randomsc (Enable Autoscreenshot) bool false
|
randomsc (Enable Autoscreenshot) bool false
|
||||||
|
|
||||||
|
randomscreenshot_interval ( Minimum time to wait between screenshots in minutes ) int 10
|
||||||
|
randomscreenshot_rnd (Random time between screenshots in minutes ) int 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user