Skip to content

Latest commit

 

History

History
471 lines (304 loc) · 7.38 KB

File metadata and controls

471 lines (304 loc) · 7.38 KB

Time

Singleton

Extends: Node

Table of contents

Constants

Name Type Default
IN_GAME_SECONDS_PER_REAL_TIME_SECONDS int 5400

Variables

Name Type Default
game_start_hour int 12
game_start_day int 1
game_start_month int 1
game_start_year int 2021
state_dawn_start_hour int 5
state_day_start_hour int 8
state_dusk_start_hour int 16
state_night_start_hour int 19
state_transition_seconds int 3600
freeze_time bool true

Functions

Name Type Default
set_current_hour int -
seconds_to_minutes float -
seconds_to_hours float -
seconds_to_days float -
seconds_to_months float -
seconds_to_years float -
minutes_to_seconds float -
minutes_to_hours float -
hours_to_seconds float -
hours_to_days float -
days_to_months float -
months_to_years float -

Constants

IN_GAME_SECONDS_PER_REAL_TIME_SECONDS

const IN_GAME_SECONDS_PER_REAL_TIME_SECONDS: int = 5400

The amount of in-game seconds that should elapse for each real-time second.

It has to be at least 60 so that seconds_elapsed can be stored as an int.

90 minutes (5400 seconds) in game == 1 second in real time.

Name Type Default
IN_GAME_SECONDS_PER_REAL_TIME_SECONDS int 5400

Variables

game_start_hour

var game_start_hour: int = 12

The hour of the day at which the game starts (0-23).

Name Type Default
game_start_hour int 12

game_start_day

var game_start_day: int = 1

The day of the month at which the game starts (1-30).

Name Type Default
game_start_day int 1

game_start_month

var game_start_month: int = 1

The month at which the game starts (1-12).

Name Type Default
game_start_month int 1

game_start_year

var game_start_year: int = 2021

The year at which the game starts (0-INF).

Name Type Default
game_start_year int 2021

state_dawn_start_hour

var state_dawn_start_hour: int = 5

The starting hour of the dawn cycle state (0-23).

Name Type Default
state_dawn_start_hour int 5

state_day_start_hour

var state_day_start_hour: int = 8

The starting hour of the day cycle state (0-23).

Name Type Default
state_day_start_hour int 8

state_dusk_start_hour

var state_dusk_start_hour: int = 16

The starting hour of the dusk cycle state (0-23).

Name Type Default
state_dusk_start_hour int 16

state_night_start_hour

var state_night_start_hour: int = 19

The starting hour of the night cycle state (0-23).

Name Type Default
state_night_start_hour int 19

state_transition_seconds

var state_transition_seconds: int = 3600

The duration, in in-game seconds, of the time it takes to transition from one state to another.

Name Type Default
state_transition_seconds int 3600

freeze_time

var freeze_time: bool = true setget _set_freeze_time

Stops the time.

Name Type Default Setter
freeze_time bool true _set_freeze_time

Functions

get_current_second

func get_current_second() -> int

Returns the current second.

Returns: int

get_current_minute

func get_current_minute() -> int

Returns the current minute.

Returns: int

get_current_hour

func get_current_hour() -> int

Returns the current hour.

Returns: int

get_current_day

func get_current_day() -> int

Returns the current day.

Returns: int

get_current_month

func get_current_month() -> int

Returns the current month.

Returns: int

get_current_year

func get_current_year() -> int

Returns the current year.

Returns: int

set_current_hour

func set_current_hour(hour: int)

Sets the current hour.

Parameters

Name Type Default
hour int -

current_time_string

func current_time_string() -> String

Returns the current time in H:M:S.

Returns: String

current_date_string

func current_date_string() -> String

Returns the current date in D/M/Y.

Returns: String

current_cycle_to_string

func current_cycle_to_string() -> String

Returns the current cycle state in a String format.

Returns: String

seconds_to_minutes

func seconds_to_minutes(seconds: float) -> float

Converts seconds into minutes.

Returns: float

Parameters

Name Type Default
seconds float -

seconds_to_hours

func seconds_to_hours(seconds: float) -> float

Converts seconds into hours.

Returns: float

Parameters

Name Type Default
seconds float -

seconds_to_days

func seconds_to_days(seconds: float) -> float

Converts seconds into days.

Returns: float

Parameters

Name Type Default
seconds float -

seconds_to_months

func seconds_to_months(seconds: float) -> float

Converts seconds into months.

Returns: float

Parameters

Name Type Default
seconds float -

seconds_to_years

func seconds_to_years(seconds: float) -> float

Converts seconds into years.

Returns: float

Parameters

Name Type Default
seconds float -

minutes_to_seconds

func minutes_to_seconds(minutes: float) -> float

Converts minutes into seconds.

Returns: float

Parameters

Name Type Default
minutes float -

minutes_to_hours

func minutes_to_hours(minutes: float) -> float

Converts minutes into hours.

Returns: float

Parameters

Name Type Default
minutes float -

hours_to_seconds

func hours_to_seconds(hours: float) -> float

Converts hours into seconds.

Returns: float

Parameters

Name Type Default
hours float -

hours_to_days

func hours_to_days(hours: float) -> float

Converts hours into days.

Returns: float

Parameters

Name Type Default
hours float -

days_to_months

func days_to_months(days: float) -> float

Converts days into months.

Returns: float

Parameters

Name Type Default
days float -

months_to_years

func months_to_years(months: float) -> float

Converts months into years.

Returns: float

Parameters

Name Type Default
months float -

Powered by GDScriptify.