You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently using something like this...which doesn't use any particular custom units, or their respective make functions. But it lets me synchronize the time to the real world, which I like. Also it prevents the game time from restarting every time the mud reboots (and I don't have to worry about saving it to disk or anything).
If this seems like a good feature to you, maybe I'll try to write it in a modular fashion to account for custom units and make functions.
here's my current manual way of doing it
function getSynchronize(datetime){
let yfloat = (datetime * 48) / 31536000000;
let ywhole = Math.floor(yfloat);
let yremainder = yfloat - ywhole;
let mfloat = yremainder * 12;
let mwhole = Math.floor(mfloat);
let mremainder = mfloat - mwhole;
let dfloat = mremainder * 30;
let dwhole = Math.floor(dfloat);
let dremainder = dfloat - dwhole;
let hfloat = dremainder * 24;
let hwhole = Math.floor(hfloat);
let hremainder = hfloat - hwhole;
let ifloat = hremainder * 60;
let iwhole = Math.floor(ifloat);
let iremainder = ifloat - iwhole;
return {minute: iwhole, hour: hwhole, day: dwhole, month: mwhole, year: ywhole - 2000};
}
An integrated function could be called with something like
let syncTo.timestamp = Date.now();
syncTo.offsets[customUnit] = -230
syncTo.offsets[otherCustomUnit] = +23
syncTo.conversionRatio = 48 // 1unit
syncTo.conversionUnit = 'minute'
or just add options in the config itself is probably a better idea...
state.TimeCrunch = new TimeCrunch(config,syncTo);
The text was updated successfully, but these errors were encountered:
Yes, it would be nice to be able to define a relation between the smallest defined unit of fantasy time and real-world milliseconds. I'd be open to that. Not sure about relying on the JavaScript Date object, though, but you're welcome to take a swing at a PR. Thanks for trying this out!
I am currently using something like this...which doesn't use any particular custom units, or their respective make functions. But it lets me synchronize the time to the real world, which I like. Also it prevents the game time from restarting every time the mud reboots (and I don't have to worry about saving it to disk or anything).
If this seems like a good feature to you, maybe I'll try to write it in a modular fashion to account for custom units and make functions.
here's my current manual way of doing it
An integrated function could be called with something like
The text was updated successfully, but these errors were encountered: