Beispiel #1
0
 public static void AIHook(On.Terraria.NPC.orig_AI_007_TownEntities orig, NPC self)
 {
     if (SomeUtils.BuffNPC() && (self.townNPC || self.type == NPCID.SkeletonMerchant))
     {
         Rectangle Screen = new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight);
         if (self.Hitbox.Intersects(Screen))
         {
             NPCOverrideAI.AI_007_TownEntities(self);
             return;
         }
     }
     orig.Invoke(self);
 }
 private void NPC_AI_007_TownEntities(On.Terraria.NPC.orig_AI_007_TownEntities orig, NPC self)
 {
     if (LWMUtils.IsTypeOfVillager(self))
     {
         self.townNPC   = true;
         self.homeTileX = (int)((Villager)self.modNPC).homePosition.X;
         self.homeTileY = (int)((Villager)self.modNPC).homePosition.Y;
     }
     orig(self);
     if (LWMUtils.IsTypeOfVillager(self))
     {
         self.townNPC = false;
     }
 }