More Lua API enhancements

This commit is contained in:
Oliver Brakmann
2014-06-30 00:08:48 +02:00
parent a1ce37ddc5
commit 5140ce4762
5 changed files with 98 additions and 8 deletions

View File

@@ -17,7 +17,8 @@ namespace OpenRA.Mods.RA.Scripting
[ScriptGlobal("Date")]
public class DateGlobal : ScriptGlobal
{
public DateGlobal(ScriptContext context) : base(context) { }
public DateGlobal(ScriptContext context)
: base(context) { }
[Desc("True on the 31st of October.")]
public bool IsHalloween
@@ -25,4 +26,17 @@ namespace OpenRA.Mods.RA.Scripting
get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; }
}
}
[ScriptGlobal("Time")]
public class TimeGlobal : ScriptGlobal
{
public TimeGlobal(ScriptContext context)
: base(context) { }
[Desc("Get the current game time (in ticks)")]
public int GameTime
{
get { return context.World.WorldTick; }
}
}
}