Class CalendarConstants
ENGINE: Single source of truth for calendar constants. All time-related code should reference these constants instead of hardcoding values.
Design Rationale:
- Real Earth calendar: 365 days, real month lengths (31/30/28)
- No leap years: Deterministic for multiplayer (Feb always 28 days)
- Pre-calculated derived constants: Avoid multiplication in hot paths
MULTIPLAYER CRITICAL: These constants define the time unit conversions that must be identical across all clients.
public static class CalendarConstants
- Inheritance
-
objectCalendarConstants
Fields
DAYS_BEFORE_MONTH
Cumulative days before each month (1-indexed, for fast day-of-year calculation). Index 1 = 0 (Jan starts at day 0), Index 2 = 31 (Feb starts at day 31), etc.
public static readonly int[] DAYS_BEFORE_MONTH
Field Value
- int[]
DAYS_IN_MONTH
Days in each month (1-indexed, index 0 unused). Jan=31, Feb=28 (no leap), Mar=31, Apr=30, May=31, Jun=30, Jul=31, Aug=31, Sep=30, Oct=31, Nov=30, Dec=31
public static readonly int[] DAYS_IN_MONTH
Field Value
- int[]
DAYS_PER_WEEK
Days per week (for weekly tick events)
public const int DAYS_PER_WEEK = 7
Field Value
- int
DAYS_PER_YEAR
Days per year (365, no leap years for determinism)
public const int DAYS_PER_YEAR = 365
Field Value
- int
HOURS_PER_DAY
Hours per day (universal constant)
public const int HOURS_PER_DAY = 24
Field Value
- int
HOURS_PER_WEEK
Hours per week (24 × 7 = 168)
public const int HOURS_PER_WEEK = 168
Field Value
- int
HOURS_PER_YEAR
Hours per year (24 × 365 = 8760)
public const int HOURS_PER_YEAR = 8760
Field Value
- int
MONTHS_PER_YEAR
Months per year
public const int MONTHS_PER_YEAR = 12
Field Value
- int
SIMPLIFIED_DAYS_PER_MONTH
Simplified: days per month (all months equal)
public const int SIMPLIFIED_DAYS_PER_MONTH = 30
Field Value
- int
SIMPLIFIED_DAYS_PER_YEAR
Simplified: days per year (30 × 12 = 360)
public const int SIMPLIFIED_DAYS_PER_YEAR = 360
Field Value
- int
SIMPLIFIED_HOURS_PER_YEAR
Simplified: hours per year (24 × 360 = 8640)
public const int SIMPLIFIED_HOURS_PER_YEAR = 8640
Field Value
- int