Page 1 of 1

clock mod

PostPosted: Thu Apr 25, 2013 19:28
by 12Me21
I want to make a clock mod, but I need some way of detecting the time, rounding it to the nearest 1000, then making the right clock node appear over the old one.

PostPosted: Thu Apr 25, 2013 20:46
by Evergreen
To quote kaeza
kaeza wrote:Use minetest.env:get_timeofday()
The number is 0-1 (0=midnight, 0.5=12:00, 0.75=18:00, etc).
See my testclock here for a way to convert to the HH:MM:SS format.

PostPosted: Thu Apr 25, 2013 21:03
by 12Me21
oh, I see

PostPosted: Thu Apr 25, 2013 21:38
by 12Me21
I almost finished, but now it says
"17:38:26: ERROR[ServerThread]: Map::setNode(): Not allowing to place CONTENT_IGNORE while trying to replace "clock:clock_12" at (-21,10,-857) (block (-2,0,-54))
17:38:26: ERROR[main]: Map::setNode(): Not allowing to place CONTENT_IGNORE while trying to replace "clock:clock_12" at (-21,10,-857) (block (-2,0,-54))"
all the time.

PostPosted: Thu Apr 25, 2013 21:41
by Evergreen
Can you copy the code here? Use the code tags.

PostPosted: Thu Apr 25, 2013 21:45
by 12Me21
I will, but do you know what is causing the errors?

PostPosted: Thu Apr 25, 2013 22:25
by 12Me21
fixed:
http://ompldr.org/vaTgyYw/clock.zip
(when clocks update, there is no way to keep them facing the same direction, so your clocks may face a different direction after updating.)

PostPosted: Thu Apr 25, 2013 22:29
by 12Me21

PostPosted: Thu Apr 25, 2013 22:30
by Evergreen
Hmm, I tried it and I'm kind of confused. Let me give a go at making a clock mod.