From f08c1449c9e601275157b7c46b3f24ecd0290e49 Mon Sep 17 00:00:00 2001 From: k0rd Date: Mon, 30 Sep 2013 22:58:32 -0400 Subject: [PATCH] added /eclipse command --- TShockAPI/Commands.cs | 7 +++++++ TShockAPI/TSPlayer.cs | 6 ++++++ 2 files changed, 13 insertions(+) mode change 100755 => 100644 TShockAPI/Commands.cs diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs old mode 100755 new mode 100644 index 3516831e..4b7af800 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -185,6 +185,7 @@ namespace TShockAPI add(Permissions.causeevents, Star, "star"); add(Permissions.causeevents, Fullmoon, "fullmoon"); add(Permissions.causeevents, Bloodmoon, "bloodmoon"); + add(Permissions.causeevents, Eclipse, "eclipse"); add(Permissions.causeevents, Invade, "invade"); add(Permissions.causeevents, Rain, "rain"); add(Permissions.spawnboss, Eater, "eater"); @@ -1353,6 +1354,12 @@ namespace TShockAPI TShock.Utils.Broadcast(string.Format("{0} turned on the blood moon.", args.Player.Name), Color.Green); } + private static void Eclipse(CommandArgs args) + { + TSPlayer.Server.SetEclipse(true); + TShock.Utils.Broadcast(string.Format("{0} has forced an Eclipse!", args.Player.Name), Color.Green); + } + private static void Invade(CommandArgs args) { if (Main.invasionSize <= 0) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 930cf5f0..6f231876 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -907,6 +907,12 @@ namespace TShockAPI Main.bloodMoon = bloodMoon; SetTime(false, 0); } + + public void SetEclipse(bool Eclipse) + { + Main.eclipse = Eclipse; + SetTime(true, 150); + } public void SetTime(bool dayTime, double time) {