Deathmax

Untitled

Sep 11th, 2011
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Terraria;
  6. using TerrariaAPI;
  7. using TerrariaAPI.Hooks;
  8.  
  9. namespace TerrariaPeaceMod
  10. {
  11.     [APIVersion(1, 8)]
  12.     public class TerrariaPeaceMod : TerrariaPlugin
  13.     {
  14.         public static DateTime LastUpdate;
  15.         public override string Author
  16.         {
  17.             get { return "Deathmax"; }
  18.         }
  19.         public override string Description
  20.         {
  21.             get { return "Changes the game to be more peaceful"; }
  22.         }
  23.         public override string Name
  24.         {
  25.             get { return "PeaceMod"; }
  26.         }
  27.         public override Version Version
  28.         {
  29.             get { return new Version(1, 0, 0, 0); }
  30.         }
  31.  
  32.         public TerrariaPeaceMod(Main game)
  33.             : base(game)
  34.         {
  35.         }
  36.  
  37.         public override void Initialize()
  38.         {
  39.             GameHooks.Update += GameHooks_Update;
  40.             LastUpdate = DateTime.UtcNow;
  41.         }
  42.  
  43.         void GameHooks_Update(GameTime obj)
  44.         {
  45.             WorldGen.spawnEye = false;
  46.             WorldGen.spawnMeteor = false;
  47.             Main.time = 27000.0;
  48.             if ((DateTime.UtcNow - LastUpdate).TotalSeconds >= 1)
  49.             {
  50.                 LastUpdate = DateTime.UtcNow;
  51.                 Main.bloodMoon = false;
  52.                 Main.invasionSize = 0;
  53.                 Main.invasionDelay = 0;
  54.                 Main.invasionWarn = 0;
  55.                 Main.dayTime = true;   
  56.                 NetMessage.SendData((int)PacketTypes.WorldInfo);
  57.  
  58.                 for (int i = 0; i < Main.maxNPCs; i++)
  59.                 {
  60.                     if (Main.npc[i].active)
  61.                         if (Main.npc[i].friendly)
  62.                             continue;
  63.                     Main.npc[i].SetDefaults(46);
  64.                 }
  65.             }
  66.         }
  67.  
  68.         public override void DeInitialize()
  69.         {
  70.             GameHooks.Update -= GameHooks_Update;
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment