From b394e15998b8b08269a0c911727fd736a3c47df4 Mon Sep 17 00:00:00 2001 From: Pavel Penev Date: Tue, 17 Oct 2023 09:40:12 +0300 Subject: [PATCH] Added current datetime properties to the Lua API Also deprecated the IsHalloween property in favour of them. --- OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs index cc0fcf77b9..c8cea8c967 100644 --- a/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs @@ -43,6 +43,13 @@ namespace OpenRA.Mods.Common.Scripting return seconds * ticksPerSecond; } + public int CurrentYear => DateTime.Now.Year; + public int CurrentMonth => DateTime.Now.Month; + public int CurrentDay => DateTime.Now.Day; + public int CurrentHour => DateTime.Now.Hour; + public int CurrentMinute => DateTime.Now.Minute; + public int CurrentSecond => DateTime.Now.Second; + [Desc("Converts the number of minutes into game time (ticks).")] public int Minutes(int minutes) {