mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-15 12:31:09 +00:00
23 lines
No EOL
444 B
JavaScript
23 lines
No EOL
444 B
JavaScript
|
|
module.exports = inject;
|
|
|
|
function inject(serv, settings) {
|
|
serv.setTime = function(time) {
|
|
serv.time = time;
|
|
serv._writeAll('update_time', {
|
|
age: [0, 0], // TODO
|
|
time: [0, serv.time]
|
|
});
|
|
}
|
|
|
|
serv.doDaylightCycle = true;
|
|
|
|
serv.time = 0;
|
|
|
|
serv.on('tick', function(count) {
|
|
if (!serv.doDaylightCycle) return;
|
|
if (count % 20 == 0) {
|
|
serv.setTime((serv.time + 20) % 24000); // Vanilla only does it every second
|
|
}
|
|
})
|
|
} |