Added option for digital clock to timeofday.

This commit is contained in:
FrozenCow 2011-03-31 16:00:47 +02:00
parent bda2c5f460
commit 4b8ac8442c
2 changed files with 41 additions and 37 deletions

View file

@ -89,8 +89,9 @@ web:
messagettl: 5
- type: playermarkers
showplayerfaces: true
- type: digitalclock
#- type: timeofdayclock
#- type: digitalclock
- type: timeofdayclock
showdigitalclock: true
defaultworld: world
worlds:

View file

@ -22,6 +22,7 @@ componentconstructors['timeofdayclock'] = function(dynmap, configuration) {
.css('background-position', (-150) + 'px ' + (-150) + 'px')
.appendTo(sun);
if (configuration.showdigitalclock) {
var clock = $('<div/>')
.addClass('timeofday')
.addClass('digitalclock')
@ -57,6 +58,10 @@ componentconstructors['timeofdayclock'] = function(dynmap, configuration) {
}
};
$(dynmap).bind('worldupdated', function(event, update) {
setTime(update.servertime);
});
}
$(dynmap).bind('worldupdated', function(event, update) {
var sunangle;
var time = update.servertime;
@ -80,7 +85,5 @@ componentconstructors['timeofdayclock'] = function(dynmap, configuration) {
sun.css('background-position', (-50 * Math.cos(sunangle)) + 'px ' + (-50 * Math.sin(sunangle)) + 'px');
moon.css('background-position', (-50 * Math.cos(moonangle)) + 'px ' + (-50 * Math.sin(moonangle)) + 'px');
setTime(update.servertime);
});
};