Skip to content

Instantly share code, notes, and snippets.

@GreenXenith
Created November 15, 2017 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GreenXenith/37c00bf410e1c0338e76c09d20d7843d to your computer and use it in GitHub Desktop.
Save GreenXenith/37c00bf410e1c0338e76c09d20d7843d to your computer and use it in GitHub Desktop.
local second = tonumber(os.date("%S"))
local minute = tonumber(os.date("%M"))
--Inside the node
on_construct = function(pos, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
if second > 10 then
meta:set_int("next_min", minute + 1)
minetest.log("none", "second is " ..second.. " which is greater than 10, setting fill date to next minute (" .. minute + 1 ..") from current minute (" .. minute .. ")")
elseif second <= 10 then
meta:set_int("next_min", minute)
minetest.log("none", "second is " ..second.. " which is less than 10, setting fill date to current minute (" .. minute ..")")
end
end,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment