User:PROXiCiDE/TimeUtil

From the CreationKit Wiki
Jump to navigation Jump to search
;=================================================================================
; Properties
;=================================================================================
GlobalVariable Property GameHour Auto
GlobalVariable Property GameDay Auto
GlobalVariable Property GameMonth Auto
GlobalVariable Property GameYear Auto
GlobalVariable Property GameDaysPassed Auto

;=================================================================================
; Time / Date Functions
;=================================================================================

Float Function GetGameHour()
	Return GameHour.GetValue()
EndFunction

Float Function GetGameDay()
	Return GameDay.GetValue()
EndFunction

Float Function GetGameMonth()
	Return GameMonth.GetValue()
EndFunction

Float Function GetGameYear()
	Return GameYear.GetValue()
EndFunction

Float Function GetGameDaysPassed()
	Return GameDaysPassed.GetValue()
EndFunction

Bool Function IsMorning()
	If GetGameHour() >= 6 && GetGameHour() < 12 
		Return True
	EndIf
	
	Return False
EndFunction

Bool Function IsAfternoon()
	If GetGameHour() >= 12 && GetGameHour() < 18
		Return True
	EndIf
	
	Return False
EndFunction

Bool Function IsEvening()
	If GetGameHour() >= 18 && GetGameHour() < 24
		Return True
	EndIf
	
	Return False
EndFunction

Bool Function IsEarlyMorning()
	If GetGameHour() >= 0 && GetGameHour() < 6
		Return True
	EndIf
	
	Return False
EndFunction

Bool Function IsNightTime()
	Return IsEarlyMorning() || IsEvening()
EndFunction

Bool Function IsDayTime()
	Return IsMorning() || IsAfternoon()
EndFunction