コード例 #1
0
 public static void DropItemsHook(On.Terraria.Player.orig_DropItems orig, Player self)
 {
     if (!Subworld.IsActive <DreamBattleWorld>())
     {
         orig.Invoke(self);
     }
 }
コード例 #2
0
 public static void DropTombstoneHook(On.Terraria.Player.orig_DropTombstone orig, Player self, int coinowned, NetworkText deathText, int hitDirection)
 {
     if (!Subworld.IsActive <DreamBattleWorld>())
     {
         orig.Invoke(self, coinowned, deathText, hitDirection);
     }
 }
コード例 #3
0
 public override void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor)
 {
     if (Subworld.IsActive <DreamBattleWorld>())
     {
         backgroundColor = Color.DarkGray;
     }
 }
コード例 #4
0
 public static void KillMeForGoodHook(On.Terraria.Player.orig_KillMeForGood orig, Player self)
 {
     if (!Subworld.IsActive <DreamBattleWorld>())
     {
         orig.Invoke(self);
     }
 }
コード例 #5
0
 public override void PreUpdate()
 {
     if (Subworld.IsActive <Moon>())
     {
         Main.time += 0.125;
     }
 }
コード例 #6
0
 public override void PreUpdate()
 {
     /*
      *          while (0 < Main.maxTilesX * Main.maxTilesY * (3E-05f * Main.worldRate))
      *          {
      *                  int tileX = WorldGen.genRand.Next(10, Main.maxTilesX - 10); //a random x tile
      *                  int tileY = WorldGen.genRand.Next(10, (int)Main.worldSurface - 1); //a psuedo random y tile based on the world surface
      *
      *                  int tileYAbovetileY = tileY - 1 < 10 ? 10 : tileY - 1; //the tile above the psuedo random tile y position
      *
      *                  Tile groundTile = Framing.GetTileSafely(tileX, tileY); //the ground tile that the new tile will be placed on
      *
      *                  //an array of all the tiles that will need to be free
      *                  Tile[] spaceRequired = new Tile[]
      *                  {
      *                          Framing.GetTileSafely(tileX, tileYAbovetileY), //bottom left
      *                          Framing.GetTileSafely(tileX, tileYAbovetileY - 1), //top left
      *                          Framing.GetTileSafely(tileX + 1, tileYAbovetileY), //bottom right
      *                          Framing.GetTileSafely(tileX + 1, tileYAbovetileY - 1) //top right
      *                  };
      *
      *                  //if the ground tile isnt null and its grass
      *                  if (groundTile != null && groundTile.type == TileID.Grass)
      *                  {
      *                          //loop through every required tile
      *                          foreach (Tile tile in spaceRequired)
      *                          {
      *                                  //if the tile isnt active; there is space for the new tile
      *                                  if (!tile.active())
      *                                  {
      *                                          if (WorldGen.genRand.NextBool(50)) //Random amount to slow down growing
      *                                          {
      *                                                  //place the 2x2 strawberry multitile
      *                                                  WorldGen.Place2x2(tileX, tileYAbovetileY - 1, (ushort)ModContent.TileType<StrawberryPlantTile>(), 0);
      *
      *                                                  //if its still active
      *                                                  if (tile.active())
      *                                                  {
      *                                                          //set the paint color to the ground tiles paint color
      *                                                          tile.color(groundTile.color());
      *
      *                                                          //Synce the multitile placement
      *                                                          if (Main.netMode == NetmodeID.Server)
      *                                                                  NetMessage.SendTileRange(-1, tileX, tileYAbovetileY - 1, 2, 2);
      *                                                  }
      *                                          }
      *                                  }
      *                          }
      *                  }
      *          }*/
     if (Subworld.IsActive <Dimensions.PlasmaDesert>())
     {
         if (++Liquid.skipCount > 1)
         {
             Liquid.UpdateLiquid();
             Liquid.skipCount = 0;
         }
     }
 }
コード例 #7
0
 public override void PostAI()
 {
     base.PostAI();
     if (!Subworld.IsActive <Moon>())
     {
         npc.active = false;
     }
 }
コード例 #8
0
 public override void PostUpdateMiscEffects()
 {
     if (Subworld.IsActive <Moon>())
     {
         ZoneMoon       = true;
         player.gravity = 0.068f;
     }
 }
コード例 #9
0
 private static void NPC_UpdateNPC_UpdateGravity(On.Terraria.NPC.orig_UpdateNPC_UpdateGravity orig, NPC self, out float maxFallSpeed)
 {
     orig(self, out maxFallSpeed);
     if (Subworld.IsActive <Moon>())
     {
         NPCGravity.SetValue(null, 0.05f);
     }
 }
コード例 #10
0
 private static void Main_DrawBG(On.Terraria.Main.orig_DrawBG orig, Main self)
 {
     orig(self);
     if (Subworld.IsActive <Moon>())
     {
         var earthTexture = MacrocosmMod.GetTexture("Assets/Earth");
         var sb           = Main.spriteBatch;
         sb.Draw(earthTexture, new Vector2(Main.screenWidth / 2, 200), null, Color.White, 0.4101524f, earthTexture.Size() / 2, 1f, default, 0f); // 0.4101524 is earth's axial tilt to radians
コード例 #11
0
 public override void PostDraw(int i, int j, SpriteBatch spriteBatch)             //debug drawing
 {
     if (Main.tile[i, j].frameX >= 0 && !Subworld.IsActive <Ship.ShipSubworld>()) // to be completely commented out when done
     {
         Vector2   zero     = new Vector2(Main.offScreenRange, Main.offScreenRange);
         Texture2D texture2 = ModContent.GetTexture("PlanetMod/Tiles/BarrierOverlay");                 //Overlay
         Main.spriteBatch.Draw(texture2, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(0, 0, texture2.Width, texture2.Height), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
     }
 }
コード例 #12
0
ファイル: DreamBattleWorld.cs プロジェクト: DarthHA/HKBoss
 public override void AI(NPC npc)
 {
     if (Subworld.IsActive <DreamBattleWorld>())
     {
         if (npc.type != ModContent.NPCType <Marx>())
         {
             npc.active = false;
         }
     }
 }
コード例 #13
0
 public override void PostUpdateBuffs()
 {
     if (Subworld.IsActive <Moon>())
     {
         if (!player.GetModPlayer <MacrocosmPlayer>().accMoonArmor)
         {
             player.AddBuff(ModContent.BuffType <SuitBreach>(), 2);
         }
     }
 }
コード例 #14
0
 public static int DropCoinsHook(On.Terraria.Player.orig_DropCoins orig, Player self)
 {
     if (Subworld.IsActive <DreamBattleWorld>())
     {
         self.lostCoins      = 0;
         self.lostCoinString = " ";
     }
     else
     {
         orig.Invoke(self);
     }
     return(0);
 }
コード例 #15
0
ファイル: DreamBattleWorld.cs プロジェクト: DarthHA/HKBoss
 public override void AI(Projectile projectile)
 {
     if (Subworld.IsActive <DreamBattleWorld>())
     {
         if (projectile.type == ProjectileID.SandBallFalling || projectile.type == ProjectileID.SandBallGun ||
             projectile.type == ProjectileID.PearlSandBallFalling || projectile.type == ProjectileID.PearlSandBallGun ||
             projectile.type == ProjectileID.EbonsandBallFalling || projectile.type == ProjectileID.EbonsandBallGun ||
             projectile.type == ProjectileID.CrimsandBallFalling || projectile.type == ProjectileID.CrimsandBallGun || projectile.type == ProjectileID.IceBlock)
         {
             projectile.active = false;
         }
     }
 }
コード例 #16
0
 public override void PreUpdate()
 {
     if (Subworld.IsActive <Moon>())
     {
         Main.time += 0.125f; //
         // Main.time += 10f; // One tenth the duration of a normal day/night
         // Main.time += 5f; // Half the duration of a normal day/night
         // Main.time += 0.5f; // Double the duration of a normal day/night
     }
     else
     {
         Main.time += 1f;
     }
 }
コード例 #17
0
 public override void EditSpawnPool(IDictionary <int, float> pool, NPCSpawnInfo spawnInfo)
 {
     foreach (var id in EnemyCategorization.MoonEnemies)
     {
         if (!Subworld.IsActive <Moon>())
         {
             return;
         }
         if (Subworld.IsActive <Moon>())
         {
             pool.Clear();
             pool.Add(id, 1f);
         }
     }
 }
コード例 #18
0
 public static int GetCurrentWorldID()//Main way to get the current world ID, -1 is ship, zero is earth/other mod's subworld
 {
     if (Subworld.AnyActive <PlanetMod>())
     {
         if (!Subworld.IsActive <ShipSubworld>())
         {
             return(SelectedPlanet);
         }
         else
         {
             return(-1);//ship ID
         }
     }
     return(0);//earth (or another mod's subworld)
 }
コード例 #19
0
        public override void OnInitialize()
        {
            toEarth         = Subworld.IsActive <Moon>();
            lunaBackground  = ModContent.GetTexture($"{nameof(Macrocosm)}/Content/Subworlds/LoadingBackgrounds/Luna");
            earthBackground = ModContent.GetTexture($"{nameof(Macrocosm)}/Content/Subworlds/LoadingBackgrounds/Earth");
            var textFileLoader = new TextFileLoader();

            if (toEarth)
            {
                _chosenMessage = ListRandom.Pick(textFileLoader.Parse("Content/Subworlds/Earth/EarthMessages"));
            }
            else
            {
                _chosenMessage = ListRandom.Pick(textFileLoader.Parse("Content/Subworlds/Moon/MoonMessages"));
            }
        }
コード例 #20
0
        public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
        {
            Texture2D SunTexture = mod.GetTexture("Backgrounds/Sun_0");
            // Texture2D MoonTexture = mod.GetTexture("Backgrounds/Sun_0");
            Texture2D SkyTex = mod.GetTexture("Backgrounds/MoonSky");

            if (maxDepth >= 3.40282347E+38f && minDepth < 3.40282347E+38f)
            {
                if (Subworld.IsActive <Moon>())
                {
                    spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * Intensity);
                    spriteBatch.Draw(SkyTex, new Rectangle(0, Math.Max(0, (int)((Main.worldSurface * 16.0 - Main.screenPosition.Y - 2400.0) * 0.10000000149011612)), Main.screenWidth, Main.screenHeight), Color.OrangeRed * Math.Min(1f, (Main.screenPosition.Y - 800f) / 1000f * Intensity));
                    float num64 = 1f;
                    num64 -= Main.cloudAlpha * 1.5f;
                    if (num64 < 0f)
                    {
                        num64 = 0f;
                    }
                    int    num20    = (int)(Main.time / 54000.0 * (Main.screenWidth + Main.sunTexture.Width * 2)) - Main.sunTexture.Width;
                    int    num21    = 0;
                    float  num22    = 1f;
                    float  rotation = (float)(Main.time / 54000.0) * 2f - 7.3f;
                    double bgTop    = (-Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0;
                    if (Main.dayTime)
                    {
                        double num26;
                        if (Main.time < 27000.0)
                        {
                            num26 = Math.Pow(1.0 - Main.time / 54000.0 * 2.0, 2.0);
                            num21 = (int)(bgTop + num26 * 250.0 + 180.0);
                        }
                        else
                        {
                            num26 = Math.Pow((Main.time / 54000.0 - 0.5) * 2.0, 2.0);
                            num21 = (int)(bgTop + num26 * 250.0 + 180.0);
                        }
                        num22 = (float)(1.2 - num26 * 0.4);
                    }
                    Color color6 = new Color((byte)(255f * num64), (byte)(Color.White.G * num64), (byte)(Color.White.B * num64), (byte)(255f * num64));
                    Main.spriteBatch.Draw(SunTexture, new Vector2(num20, num21 + Main.sunModY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, SunTexture.Width, SunTexture.Height)), color6, rotation, new Vector2(SunTexture.Width / 2, SunTexture.Height / 2), num22, SpriteEffects.None, 0f);
                    // Main.spriteBatch.Draw(MoonTexture, new Vector2(num20, num21 + Main.moonModY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, MoonTexture.Width, MoonTexture.Height)), color6, rotation, new Vector2(MoonTexture.Width / 2, MoonTexture.Height / 2), num22, SpriteEffects.None, 0f);
                }
            }
        }
コード例 #21
0
 public static void TeleportCorrectWorld(bool noVote = false)
 {
     if (Subworld.IsActive <ShipSubworld>())//based on active subworld, may change to use active subworld ID
     {
         //Main.NewText(planetArray[SelectedPlanet].EntryString);
         if (planetArray[SelectedPlanet].EntryString == string.Empty)
         {
             Subworld.Exit(noVote);
         }
         else
         {
             Subworld.Enter(planetArray[SelectedPlanet].EntryString, noVote);
         }
     }
     else
     {
         Subworld.Enter <ShipSubworld>(noVote);
     }
 }
コード例 #22
0
ファイル: NoxiumWorld.cs プロジェクト: daim0/NoxiumMod
        public override void Load(TagCompound tag)
        {
            // Make the bubbles update just after the world is updated.
            On.Terraria.WorldGen.UpdateWorld += (On.Terraria.WorldGen.orig_UpdateWorld orig) =>
            {
                orig();

                if (Subworld.IsActive <Dimensions.PlasmaDesert>())
                {
                    ShouldUpdateBubbles.Invoke();
                }
            };

            // Make the bubbles draw just after cached NPCs draw.
            On.Terraria.Main.CacheNPCDraws += (On.Terraria.Main.orig_CacheNPCDraws orig, Main self) =>
            {
                if (Subworld.IsActive <Dimensions.PlasmaDesert>())
                {
                    ShouldDrawBubbles.Invoke(Main.spriteBatch);
                }

                orig(self);
            };

            var spawned     = tag.GetList <string>("spawned");
            var ahmSpawnedV = tag.GetList <string>("ahmSpawned");
            var downed      = tag.GetList <string>("downed");
            var shown       = tag.GetList <string>("shown");
            var dspawned    = tag.GetList <string>("dspawned");

            oculumOreSpawn = spawned.Contains("oculumOreSpawn");

            downedAHM = downed.Contains("downedAHM");

            ahmSpawned = ahmSpawnedV.Contains("spawned");

            ahmBarShown = shown.Contains("shown");

            desertDwellerSpawned = dspawned.Contains("dspawned");
        }
コード例 #23
0
        public override void Activate(Vector2 position, params object[] args)
        {
            pillarS = mod.GetTexture("Texture/Sun/PillarStardust");
            if (!Main.gameMenu)
            {
                if (Subworld.IsActive <StardustSubworld>())
                {
                    isActive = true;
                    for (int i = 0; i < 50; i++)
                    {
                        zDistance[i] = Main.rand.NextFloat(0.1f, 0.7f);               // get a random 3rd Dimension distance
                        xPos[i]      = (Main.rand.NextFloat(0, Main.maxTilesX)) * 16; //makes so that objects dont spawn outside of the world
                        yPos[i]      = (Main.rand.NextFloat(50, 51));                 //same for Y
                    }
                }
            }

            /*for (int i = 0; i < Main.npc.Length; i++) {
             *  if (Main.npc[i].active && Main.npc[i].type == NPCID.EyeofCthulhu) {
             *      EoCUp = true;
             *  }
             * }*/
        }
コード例 #24
0
ファイル: TUA.cs プロジェクト: Dradonhunter11/TUA
 private void UpdateInGameMusic(ref int music, ref MusicPriority musicPriority)
 {
     if (this.GetBiome("Meteoridon").InBiome(Main.LocalPlayer))
     {
         music = this.GetSoundSlot(SoundType.Music, "Sounds/Music/Stars_Lament_Loop");
     }
     else if (MoonEventManagerWorld.IsActive("Apocalypse Moon"))
     {
         music         = this.GetSoundSlot(SoundType.Music, "Sounds/Music/Terminal_Inception");
         musicPriority = MusicPriority.BossHigh;
     }
     else if (Subworld.IsActive <SolarSubworld>())
     {
         music         = MusicID.TheTowers;
         Main.musicBox = 36;
         musicPriority = MusicPriority.Environment;
     }
     else if (Main.LocalPlayer.position.Y / 16 > Main.maxTilesY - 200 &&
              Main.ActiveWorldFileData.HasCrimson)
     {
         music         = this.GetSoundSlot(SoundType.Music, "Sounds/Music/Exclusion_Zone");
         musicPriority = MusicPriority.Environment;
     }
 }
コード例 #25
0
 public override void UpdateBiomes()
 {
     ZoneMoon   = Subworld.IsActive <Moon>();
     ZoneBasalt = MacrocosmWorld.moonBiome > 20;
 }
コード例 #26
0
 public override bool ChooseBgStyle()
 {
     return(Subworld.IsActive <Ship.ShipSubworld>());           //biome backround is active if this dimension is active
     //return Subworld.AnyActive<PlanetMod>();
 }
コード例 #27
0
ファイル: DreamBattleWorld.cs プロジェクト: DarthHA/HKBoss
 public override bool CanPlace(int i, int j, int type)
 {
     return(!Subworld.IsActive <DreamBattleWorld>());
 }
コード例 #28
0
ファイル: DreamBattleWorld.cs プロジェクト: DarthHA/HKBoss
 public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged)
 {
     return(!Subworld.IsActive <DreamBattleWorld>());
 }
コード例 #29
0
 public override void UpdateBiomes()
 {
     zonePlasma = NoxiumWorld.plasmaSandTiles > 50 || Subworld.IsActive <PlasmaDesert>();
 }
コード例 #30
0
 public override bool ChooseBgStyle()
 {
     return(Subworld.IsActive <Planets.MoonEarth>());
 }