refactor: toNetwork

This commit is contained in:
cha0s 2019-09-22 22:34:24 -05:00
parent aff492d0f4
commit 4534d0b5ea

View File

@ -71,9 +71,7 @@ export class WorldTime extends decorate(class {}) {
if (!this._isUpdateReady) {
return;
}
return new WorldTimePacket({
hour: this.toNetwork(),
});
return new WorldTimePacket(this.toNetwork());
}
secondsPerHour() {
@ -87,13 +85,13 @@ export class WorldTime extends decorate(class {}) {
}
toNetwork() {
return (this._hour * MAGIC_TO_FIT_HOUR_INTO_USHORT) >> 0;
return {
hour: (this._hour * MAGIC_TO_FIT_HOUR_INTO_USHORT) >> 0,
};
}
toJSON() {
return {
hour: this.toNetwork(),
}
return this.toNetwork();
}
}