Move Utils.Seconds and .Minutes into DateTime global

Also renames Date.IsHalloween to DateTime.IsHalloween
This commit is contained in:
Oliver Brakmann
2014-10-19 16:30:03 +02:00
parent 6a44c265e2
commit 37c5d51f19
15 changed files with 127 additions and 134 deletions

View File

@@ -14,7 +14,7 @@ using OpenRA.Scripting;
namespace OpenRA.Mods.RA.Scripting
{
[ScriptGlobal("Date")]
[ScriptGlobal("DateTime")]
public class DateGlobal : ScriptGlobal
{
public DateGlobal(ScriptContext context)
@@ -25,18 +25,23 @@ 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; }
}
[Desc("Converts the number of seconds into game time (ticks).")]
public int Seconds(int seconds)
{
return seconds * 25;
}
[Desc("Converts the number of minutes into game time (ticks).")]
public int Minutes(int minutes)
{
return Seconds(minutes * 60);
}
}
}

View File

@@ -95,17 +95,5 @@ namespace OpenRA.Mods.RA.Scripting
{
return context.World.Map.CenterOfCell(cell);
}
[Desc("Converts the number of seconds into game time (ticks).")]
public int Seconds(int seconds)
{
return seconds * 25;
}
[Desc("Converts the number of minutes into game time (ticks).")]
public int Minutes(int minutes)
{
return Seconds(minutes * 60);
}
}
}