import Component from '@/ecs/component.js'; import {IRL_MINUTES_PER_GAME_DAY} from '@/util/constants'; const realSecondsPerGameDay = 60 * IRL_MINUTES_PER_GAME_DAY; const realSecondsPerGameHour = realSecondsPerGameDay / 24; const realSecondsPerGameMinute = realSecondsPerGameHour / 60; export default class Time extends Component { instanceFromSchema() { return class TimeInstance extends super.instanceFromSchema() { static gameDayLengthInRealSeconds = 24 * realSecondsPerGameHour; get hour() { return this.$$irlSeconds / realSecondsPerGameHour; } get minute() { return (this.$$irlSeconds % realSecondsPerGameHour) / realSecondsPerGameMinute; } }; } static properties = { irlSeconds: {defaultValue: 6 * realSecondsPerGameHour, type: 'uint16'}, }; }