Table of Contents

Interface IGameCalendar

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Main API for retrieving anything calender or astronomy related

public interface IGameCalendar

Properties

CalendarSpeedMul

A multiplier thats applied to the progression of the calendar. Set this to 0.1 and a day will last 10 times longer, does not affect physics.

float CalendarSpeedMul { get; set; }

Property Value

float

DayOfYear

The current day of the year (goes from 0 to DaysPerYear)

int DayOfYear { get; }

Property Value

int

DayOfYearf

The current day of the year (goes from 0 to DaysPerYear)

float DayOfYearf { get; }

Property Value

float

DaysPerMonth

Amount of days per month

int DaysPerMonth { get; }

Property Value

int

DaysPerYear

Amount of days per year

int DaysPerYear { get; }

Property Value

int

ElapsedDays

Amount of in-game days that have passed since the game started

double ElapsedDays { get; }

Property Value

double

ElapsedHours

Amount of in-game hours that have passed since the game started

double ElapsedHours { get; }

Property Value

double

ElapsedSeconds

Amount of in-game seconds that have passed since the game started

long ElapsedSeconds { get; }

Property Value

long

FullHourOfDay

The current hour of the day as integer

int FullHourOfDay { get; }

Property Value

int

HourOfDay

The current hour of the day as decimal

float HourOfDay { get; }

Property Value

float

HoursPerDay

Amount of hours per day

float HoursPerDay { get; }

Property Value

float

Month

int Month { get; }

Property Value

int

MonthName

EnumMonth MonthName { get; }

Property Value

EnumMonth

MoonPhase

The current moonphase

EnumMoonPhase MoonPhase { get; }

Property Value

EnumMoonPhase

MoonPhaseBrightness

The moons current brightness (higher during full moon)

float MoonPhaseBrightness { get; }

Property Value

float

MoonPhaseExact

The current moonphase represented by number from 0..8

double MoonPhaseExact { get; }

Property Value

double

MoonSize

The moons current size (larger during full moon)

float MoonSize { get; }

Property Value

float

OnGetHemisphere

Assigned by the survival mod. Must return the hemisphere at give location

HemisphereDelegate OnGetHemisphere { get; set; }

Property Value

HemisphereDelegate

OnGetLatitude

Assigned by the survival mod. Must return the latitude for given position. If not set, the calendar uses a default value of 0.5
-1 for south pole, 0 for equater, 1 for north pole

GetLatitudeDelegate OnGetLatitude { get; set; }

Property Value

GetLatitudeDelegate

OnGetSolarSphericalCoords

Assigned by the survival mod. The calendar uses this method to determine the solar altitude at given location and time. If not set, the calendar uses a default value of about 0.75

SolarSphericalCoordsDelegate OnGetSolarSphericalCoords { get; set; }

Property Value

SolarSphericalCoordsDelegate

SeasonOverride

float? SeasonOverride { get; set; }

Property Value

float?

SpeedOfTime

This acts as a multiplier on how much faster an ingame second passes by compared to a real life second. Affects physics, like the motion speed of waving grass. The default is 60, hence per default a day lasts 24 minutes, but it's also multiplied by CalendarSpeedMul which is 0.5 by default so the end result is 48 minutes per day This is the sum of all modifiers

float SpeedOfTime { get; }

Property Value

float

Timelapse

Can be used to adjust apparent time of day and season for rendering, e.g. to create a series of timelapse images; restore to 0 when done

float Timelapse { get; set; }

Property Value

float

TotalDays

Total passed days since the game has started

double TotalDays { get; }

Property Value

double

TotalHours

Total passed hours since the game has started

double TotalHours { get; }

Property Value

double

Year

Returns the year. Every game begins with 1386

int Year { get; }

Property Value

int

YearRel

Returns the current season in a value of 0 to 1

float YearRel { get; }

Property Value

float

Methods

Add(float)

Adds given time to the calendar

void Add(float hours)

Parameters

hours float

GetDayLightStrength(double, double)

Retrieve the current daylight strength at given coordinates, the values are roughly beween 0 and 1.2f

float GetDayLightStrength(double x, double z)

Parameters

x double
z double

Returns

float

GetDayLightStrength(BlockPos)

Retrieve the current daylight strength at given coordinates. The Y-Component is ignored

float GetDayLightStrength(BlockPos pos)

Parameters

pos BlockPos

Returns

float

GetHemisphere(BlockPos)

Returns the hemisphere at given position

EnumHemisphere GetHemisphere(BlockPos pos)

Parameters

pos BlockPos

Returns

EnumHemisphere

GetSeason(BlockPos)

Returns the season at given position

EnumSeason GetSeason(BlockPos pos)

Parameters

pos BlockPos

Returns

EnumSeason

GetSeasonRel(BlockPos)

Returns the season at given position between 0..1, respects hemisphere

float GetSeasonRel(BlockPos pos)

Parameters

pos BlockPos

Returns

float

PrettyDate()

The worlds current date, nicely formatted

string PrettyDate()

Returns

string

RemoveTimeSpeedModifier(string)

To remove a previously added time speed modifier

void RemoveTimeSpeedModifier(string name)

Parameters

name string

SetSeasonOverride(float?)

If non-null, will override the value retrieved by GetSeason(). Set to null to have seasons progress normally again.

void SetSeasonOverride(float? seasonRel)

Parameters

seasonRel float?

SetTimeSpeedModifier(string, float)

If you want to modify the time speed, set a value here

void SetTimeSpeedModifier(string name, float speed)

Parameters

name string
speed float