mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-11 18:41:31 +00:00
23 lines
No EOL
465 B
JavaScript
23 lines
No EOL
465 B
JavaScript
|
|
module.exports = inject;
|
|
|
|
function inject(serv, settings) {
|
|
serv.setTime = (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', (delta,count) => {
|
|
if (!serv.doDaylightCycle) return;
|
|
if (count % 20 == 0) {
|
|
serv.setTime((serv.time + 20) % 24000); // Vanilla only does it every second
|
|
}
|
|
})
|
|
} |