More crag changes + some other fixes
This commit is contained in:
1 parent
5ce136682f
commit
173df09245
16 files changed
+542
-51
No files matched your search
@@ -4,6 +4,8 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Linq;
|
||||
using CalamityMod.Systems;
|
||||
using CalamityMod.Balancing;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
@@ -72,6 +74,7 @@ using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.Config;
|
||||
using Terraria.DataStructures;
|
||||
|
||||
[assembly: InternalsVisibleTo("CalTestHelpers")]
|
||||
[assembly: InternalsVisibleTo("InfernumMode")]
|
||||
@@ -144,6 +147,9 @@ namespace CalamityMod
|
||||
internal Mod varia = null;
|
||||
internal Mod wikithis = null;
|
||||
|
||||
//hell background
|
||||
private List<HellBGLoad> loadCache;
|
||||
|
||||
#region Load
|
||||
public override void Load()
|
||||
{
|
||||
@@ -239,6 +245,26 @@ namespace CalamityMod
|
||||
BalancingChangesManager.Load();
|
||||
BaseIdleHoldoutProjectile.LoadAll();
|
||||
PlayerDashManager.Load();
|
||||
|
||||
//hell background loading
|
||||
HellBGManager.Load();
|
||||
|
||||
//load stuff for hell background
|
||||
loadCache = new List<HellBGLoad>();
|
||||
|
||||
foreach (Type type in Code.GetTypes())
|
||||
{
|
||||
if (!type.IsAbstract && type.GetInterfaces().Contains(typeof(HellBGLoad)))
|
||||
{
|
||||
var instance = Activator.CreateInstance(type);
|
||||
loadCache.Add(instance as HellBGLoad);
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < loadCache.Count; k++)
|
||||
{
|
||||
loadCache[k].Load();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadClient()
|
||||
@@ -428,6 +454,19 @@ namespace CalamityMod
|
||||
manaOriginal = null;
|
||||
carpetOriginal = null;
|
||||
|
||||
//unload hell background stuff
|
||||
HellBGManager.Unload();
|
||||
|
||||
if (loadCache != null)
|
||||
{
|
||||
foreach (var loadable in loadCache)
|
||||
{
|
||||
loadable.Unload();
|
||||
}
|
||||
}
|
||||
|
||||
loadCache = null;
|
||||
|
||||
ILChanges.Unload();
|
||||
Instance = null;
|
||||
base.Unload();
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace CalamityMod.Dusts
|
||||
{
|
||||
public class CinderBlossomDust : ModDust
|
||||
{
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.velocity *= 0.05f;
|
||||
dust.velocity.Y *= 0.5f;
|
||||
dust.noGravity = true;
|
||||
dust.noLight = true;
|
||||
dust.alpha = 0;
|
||||
dust.fadeIn = 12f;
|
||||
dust.scale *= Main.rand.NextFloat(0.75f, 1f);
|
||||
}
|
||||
|
||||
public override bool Update(Dust dust)
|
||||
{
|
||||
float strength = dust.scale * 1.4f;
|
||||
Lighting.AddLight(dust.position, 0.025f * strength, 0.1f * strength, 0.1f * strength);
|
||||
|
||||
if (Main.rand.Next(20) == 0)
|
||||
{
|
||||
dust.alpha += 5;
|
||||
}
|
||||
|
||||
if (Main.rand.Next(12) == 0)
|
||||
{
|
||||
dust.velocity.X += Main.rand.NextFloat(-0.1f, 0.1f);
|
||||
dust.velocity.Y += Main.rand.NextFloat(0.02f, 0.08f);
|
||||
}
|
||||
|
||||
dust.position -= dust.velocity;
|
||||
|
||||
if (dust.alpha > 255)
|
||||
{
|
||||
dust.active = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 150 B |
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables
|
||||
Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY);
|
||||
Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1);
|
||||
|
||||
if (tile.HasTile && !tileAbove.HasTile && tile.TileType == ModContent.TileType<Tiles.Crags.ScorchedRemains>() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY))
|
||||
if (tile.HasTile && !tileAbove.HasTile && tileAbove.LiquidAmount == 0 && tile.TileType == ModContent.TileType<Tiles.Crags.ScorchedRemains>() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY))
|
||||
{
|
||||
Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType<Tiles.Crags.ScorchedRemainsGrass>();
|
||||
|
||||
|
||||
+2
-2
@@ -2934,8 +2934,8 @@ namespace CalamityMod.NPCs
|
||||
if (npc.velocity.Y == 0f)
|
||||
{
|
||||
// Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc
|
||||
SoundStyle soundToPlay = Main.getGoodWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; // move to zenith seed later
|
||||
SoundEngine.PlaySound(soundToPlay, npc.position);
|
||||
// move to zenith seed later
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound, npc.position);
|
||||
|
||||
if (Main.getGoodWorld) // move to zenith seed later
|
||||
{
|
||||
|
||||
+11
-13
@@ -218,7 +218,6 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
int iceRain = Main.getGoodWorld ? ModContent.ProjectileType<BrimstoneBarrage>() : ModContent.ProjectileType<IceRain>();
|
||||
int dustType = Main.getGoodWorld ? 235 : 67;
|
||||
|
||||
SoundStyle frostSound = Main.getGoodWorld ? SoundID.Item20 : SoundID.Item28;
|
||||
NPC.HitSound = Main.getGoodWorld ? SoundID.NPCHit41 : HitSound;
|
||||
NPC.DeathSound = Main.getGoodWorld ? SoundID.NPCDeath14 : DeathSound;
|
||||
|
||||
@@ -308,7 +307,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
if (calamityGlobalNPC.newAI[3] >= (bossRush ? 660f : 900f))
|
||||
{
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = 3;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBomb;
|
||||
@@ -339,7 +338,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 24 : 16;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -399,7 +398,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 18 : 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -473,7 +472,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
{
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceRain;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float maxVelocity = 9f + enrageScale;
|
||||
@@ -573,7 +572,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 18 : 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -619,7 +618,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
{
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceRain;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float maxVelocity = 9f + enrageScale;
|
||||
@@ -721,7 +720,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
NPC.localAI[0] = 0f;
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 18 : 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -831,7 +830,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceRain;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float velocity = 9f + enrageScale;
|
||||
@@ -914,7 +913,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
{
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceBlast;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float velocity = 1.5f + enrageScale * 0.5f;
|
||||
@@ -1028,7 +1027,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
if (calamityGlobalNPC.newAI[3] >= (bossRush ? 50f : 75f))
|
||||
{
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
SoundEngine.PlaySound(frostSound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = 2;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBomb;
|
||||
@@ -1108,8 +1107,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
private void HandlePhaseTransition(int newPhase)
|
||||
{
|
||||
// Move to zenith seed later
|
||||
SoundStyle sound = Main.getGoodWorld ? SoundID.NPCDeath14 : TransitionSound;
|
||||
SoundEngine.PlaySound(sound, NPC.Center);
|
||||
SoundEngine.PlaySound(Main.getGoodWorld ? SoundID.NPCDeath14 : TransitionSound, NPC.Center);
|
||||
if (Main.netMode != NetmodeID.Server && !Main.getGoodWorld)
|
||||
{
|
||||
int chipGoreAmount = newPhase >= 5 ? 3 : newPhase >= 3 ? 2 : 1;
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,239 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Systems
|
||||
{
|
||||
public interface HellBGLoad
|
||||
{
|
||||
void Load();
|
||||
void Unload();
|
||||
}
|
||||
|
||||
//hell background system since it will probably be used in the future
|
||||
//also example at the bottom
|
||||
internal static class HellBGManager
|
||||
{
|
||||
public static int CurrentBGID = -1;
|
||||
public static HellBGType[] HellBGs;
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
CurrentBGID = -1;
|
||||
HellBGs = new HellBGType[0];
|
||||
|
||||
//super epic detour
|
||||
On.Terraria.Main.DrawUnderworldBackground += DrawHellBG;
|
||||
}
|
||||
|
||||
public static void Unload()
|
||||
{
|
||||
HellBGs = null;
|
||||
}
|
||||
|
||||
private static void DrawHellBG(On.Terraria.Main.orig_DrawUnderworldBackground orig, Main self, bool flat)
|
||||
{
|
||||
int oldID = CurrentBGID;
|
||||
CurrentBGID = -1;
|
||||
|
||||
if (Main.gameMenu || Main.screenPosition.Y + Main.screenHeight < (Main.maxTilesY - 220) * 16f)
|
||||
{
|
||||
orig(self, flat);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < HellBGs.Length; i++)
|
||||
{
|
||||
if (HellBGs[i].IsActive())
|
||||
{
|
||||
CurrentBGID = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (oldID != CurrentBGID && oldID != -1)
|
||||
{
|
||||
CurrentBGID = oldID;
|
||||
oldID = -2;
|
||||
HellBGs[CurrentBGID].Transparency -= HellBGs[CurrentBGID].TransitionSpeed;
|
||||
}
|
||||
else if (CurrentBGID == -1)
|
||||
{
|
||||
orig(self, flat);
|
||||
return;
|
||||
}
|
||||
|
||||
var currentBG = HellBGs[CurrentBGID];
|
||||
float transparency = 1f;
|
||||
|
||||
if (currentBG.Transparency < 1f)
|
||||
{
|
||||
orig(self, flat);
|
||||
if (oldID != -2)
|
||||
{
|
||||
currentBG.Transparency += currentBG.TransitionSpeed;
|
||||
|
||||
if (currentBG.Transparency > 1f)
|
||||
{
|
||||
currentBG.Transparency = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentBG.Transparency -= currentBG.TransitionSpeed;
|
||||
|
||||
if (currentBG.Transparency < 0f)
|
||||
{
|
||||
currentBG.Transparency = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
transparency = currentBG.Transparency;
|
||||
}
|
||||
|
||||
Vector2 vector = Main.screenPosition + new Vector2((Main.screenWidth >> 1), (Main.screenHeight >> 1));
|
||||
float num = (Main.GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f;
|
||||
int bg0Height = ModContent.Request<Texture2D>(currentBG.TexturePath + "0").Height();
|
||||
bg0Height += bg0Height >> 1;
|
||||
float Scale = 1.4f; //how much the bg textures are scaled up in game
|
||||
for (int Layers = 4; Layers >= 0; Layers--)
|
||||
{
|
||||
//get each background texture
|
||||
Texture2D BGTexture = ModContent.Request<Texture2D>(currentBG.TexturePath + Layers).Value;
|
||||
//get each glowmask texture for the bg
|
||||
Texture2D BGTextureGlow = ModContent.Request<Texture2D>(currentBG.TexturePath + Layers + "_Glow").Value;
|
||||
|
||||
Vector2 vector2 = new Vector2(BGTexture.Width, BGTexture.Height) * 0.5f;
|
||||
float num2 = flat ? 1f : (Layers * 2 + 3f);
|
||||
Vector2 vector3 = new Vector2(1f / num2);
|
||||
Rectangle rectangle = new Rectangle(0, 0, BGTexture.Width, BGTexture.Height);
|
||||
Vector2 zero = Vector2.Zero;
|
||||
|
||||
switch (Layers)
|
||||
{
|
||||
//zero.Y is the y-offset for each bg, if it draws too high or too low then it can be changed to fix that
|
||||
case 0:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
zero.Y += 0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flat)
|
||||
{
|
||||
zero.Y += bg0Height * 1.3f - vector2.Y;
|
||||
}
|
||||
|
||||
vector2 *= Scale;
|
||||
|
||||
zero.Y -= num;
|
||||
float num5 = Scale * rectangle.Width;
|
||||
int num6 = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / num5);
|
||||
|
||||
for (int j = num6 - 2; j < num6 + 4 + (int)(Main.screenWidth / num5); j++)
|
||||
{
|
||||
Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), (Main.maxTilesY - 200) * 16f) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero;
|
||||
var frame = rectangle;
|
||||
var clr = currentBG.DrawColor * transparency;
|
||||
|
||||
if (currentBG.PreDraw(BGTexture, ref drawPosition, ref frame, ref clr, Scale, Layers))
|
||||
{
|
||||
//draw the bg textures themselves
|
||||
Main.spriteBatch.Draw(BGTexture, drawPosition, frame, clr, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f);
|
||||
|
||||
//draws the glowmask over each background
|
||||
Main.spriteBatch.Draw(BGTextureGlow, drawPosition, frame, Color.White * transparency, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddHellBG(HellBGType hellBG)
|
||||
{
|
||||
int id = HellBGs.Length;
|
||||
Array.Resize(ref HellBGs, id + 1);
|
||||
hellBG.ID = id;
|
||||
HellBGs[id] = hellBG;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class HellBGType : HellBGLoad
|
||||
{
|
||||
public int ID;
|
||||
public float Transparency;
|
||||
void HellBGLoad.Load()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
{
|
||||
return;
|
||||
}
|
||||
HellBGManager.AddHellBG(this);
|
||||
OnLoad();
|
||||
}
|
||||
|
||||
void HellBGLoad.Unload()
|
||||
{
|
||||
OnUnload();
|
||||
}
|
||||
|
||||
public abstract bool IsActive();
|
||||
public abstract string TexturePath { get; }
|
||||
|
||||
public virtual float TransitionSpeed => 0.02f;
|
||||
public virtual Color DrawColor => new Color(255, 255, 255, 255);
|
||||
|
||||
protected virtual void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnUnload()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool PreDraw(Texture2D texture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, float Scale, int Layer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void PostDraw(Texture2D texture, Vector2 drawPosition, Rectangle frame, Color drawColor, float Scale, int Layer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//example hell background using the system
|
||||
public class SpookyHellBG : HellBGType
|
||||
{
|
||||
//get the texture for each background
|
||||
//you dont need to put any numbers at the end of the bg texture name since the hell bg system manages that
|
||||
public override string TexturePath => "CalamityMod/Backgrounds/BgTextureName";
|
||||
|
||||
public override bool IsActive()
|
||||
{
|
||||
return whatever; //return the condition(s) required for this background to be drawn
|
||||
}
|
||||
|
||||
public override Color DrawColor => Color.Gray; //draw color of the bg
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using CalamityMod.Tiles.DraedonStructures;
|
||||
using CalamityMod.Tiles.DraedonSummoner;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using CalamityMod.Tiles.SunkenSea;
|
||||
using CalamityMod.Tiles.Crags;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
@@ -44,7 +45,8 @@ namespace CalamityMod.Tiles
|
||||
TileID.HallowedPlants2,
|
||||
TileID.CrimsonPlants,
|
||||
(ushort)ModContent.TileType<AstralShortPlants>(),
|
||||
(ushort)ModContent.TileType<AstralTallPlants>()
|
||||
(ushort)ModContent.TileType<AstralTallPlants>(),
|
||||
(ushort)ModContent.TileType<CinderBlossomTallPlants>()
|
||||
};
|
||||
|
||||
public static List<int> GrowthTiles = new List<int>()
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent.Metadata;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.Crags
|
||||
{
|
||||
public class CinderBlossomTallPlants : ModTile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileCut[Type] = true;
|
||||
Main.tileSolid[Type] = false;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileLavaDeath[Type] = true;
|
||||
Main.tileWaterDeath[Type] = true;
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
TileID.Sets.ReplaceTileBreakUp[Type] = true;
|
||||
TileID.Sets.SwaysInWindBasic[Type] = true;
|
||||
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]);
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2);
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
|
||||
AddMapEntry(new Color(200, 80, 210));
|
||||
|
||||
base.SetStaticDefaults();
|
||||
}
|
||||
|
||||
public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY)
|
||||
{
|
||||
offsetY = -16;
|
||||
height = 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -27,6 +27,17 @@ namespace CalamityMod.Tiles.Crags
|
||||
AddMapEntry(new Color(57, 52, 72));
|
||||
}
|
||||
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
Tile left = Main.tile[i - 1, j];
|
||||
Tile right = Main.tile[i + 1, j];
|
||||
|
||||
if (WorldGen.genRand.Next(3) == 0 && (left.TileType == ModContent.TileType<ScorchedRemainsGrass>() || right.TileType == ModContent.TileType<ScorchedRemainsGrass>()))
|
||||
{
|
||||
WorldGen.SpreadGrass(i, j, Type, ModContent.TileType<ScorchedRemainsGrass>(), false);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CreateDust(int i, int j, ref int type)
|
||||
{
|
||||
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Tiles.Ores;
|
||||
using CalamityMod.Dusts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -49,8 +50,60 @@ namespace CalamityMod.Tiles.Crags
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem)
|
||||
{
|
||||
if (fail && !effectOnly)
|
||||
{
|
||||
Main.tile[i, j].TileType = (ushort)ModContent.TileType<ScorchedRemains>();
|
||||
}
|
||||
}
|
||||
|
||||
//do this in animate tile because its the only hook that updates a tile constantly unlike random update
|
||||
public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
|
||||
{
|
||||
//convert this tile back into scorched remains if any liquid is above it
|
||||
//will change this to only check for lava if necessary
|
||||
if (Main.tile[i, j - 1].LiquidAmount > 0)
|
||||
{
|
||||
Main.tile[i, j].TileType = (ushort)ModContent.TileType<ScorchedRemains>();
|
||||
}
|
||||
}
|
||||
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
Tile up = Main.tile[i, j - 1];
|
||||
Tile up2 = Main.tile[i, j - 2];
|
||||
|
||||
if (WorldGen.genRand.Next(5) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount == 0)
|
||||
{
|
||||
up.TileType = (ushort)ModContent.TileType<CinderBlossomTallPlants>();
|
||||
up.HasTile = true;
|
||||
up.TileFrameY = 0;
|
||||
up.TileFrameX = (short)(WorldGen.genRand.Next(21) * 18);
|
||||
WorldGen.SquareTileFrame(i, j - 1, true);
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
|
||||
{
|
||||
bool isPlayerNear = WorldGen.PlayerLOS(i, j);
|
||||
Tile Above = Framing.GetTileSafely(i, j - 1);
|
||||
|
||||
if (!Main.gamePaused && Main.instance.IsActive && !Above.HasTile && isPlayerNear)
|
||||
{
|
||||
if (Main.rand.Next(550) == 0)
|
||||
{
|
||||
int newDust = Dust.NewDust(new Vector2((i - 2) * 16, (j - 1) * 16), 5, 5, ModContent.DustType<CinderBlossomDust>());
|
||||
Main.dust[newDust].velocity.Y += 0.09f;
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type ||
|
||||
Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type)
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace CalamityMod
|
||||
PlantCheckAgainst[TileID.CrimsonPlants] = new int[1] { TileID.CrimsonPlants };
|
||||
PlantCheckAgainst[ModContent.TileType<AstralShortPlants>()] = new int[1] { ModContent.TileType<AstralGrass>() };
|
||||
PlantCheckAgainst[ModContent.TileType<AstralTallPlants>()] = new int[1] { ModContent.TileType<AstralGrass>() };
|
||||
PlantCheckAgainst[ModContent.TileType<CinderBlossomTallPlants>()] = new int[1] { ModContent.TileType<ScorchedRemainsGrass>() };
|
||||
|
||||
VineToGrass = new Dictionary<ushort, ushort>
|
||||
{
|
||||
|
||||
@@ -455,7 +455,8 @@ namespace CalamityMod.World
|
||||
// WorldGen.gen prevents NewItem from working, and thus prevents a bunch of dumb items from being spawned immediately and deleting the WoF/Aureus loot in the process.
|
||||
WorldGen.gen = true;
|
||||
bool _ = true;
|
||||
SchematicManager.PlaceSchematic<Action<Chest>>(SchematicManager.AstralBeaconKey, new Point(i, (int)height), SchematicAnchor.TopCenter, ref _);
|
||||
int xOffset = WorldGen.dungeonX < Main.maxTilesX / 2 ? -50 : 50;
|
||||
SchematicManager.PlaceSchematic<Action<Chest>>(SchematicManager.AstralBeaconKey, new Point(i + xOffset, (int)height), SchematicAnchor.TopCenter, ref _);
|
||||
WorldGen.gen = false;
|
||||
}
|
||||
}
|
||||
|
||||
+91
-33
@@ -9,6 +9,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.WorldBuilding;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.GameContent.Generation;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
@@ -31,6 +32,7 @@ namespace CalamityMod.World
|
||||
//the 25's are there to offset it from the exact edge of the world so no "out of bounds" crashing occurs
|
||||
StartX = WorldGen.dungeonX < Main.maxTilesX / 2 ? 25 : (Main.maxTilesX - (Main.maxTilesX / 6)) - 25;
|
||||
|
||||
//set these to be able to easily place things in certain locations, like structures
|
||||
int biomeStart = StartX;
|
||||
int biomeEdge = biomeStart + (Main.maxTilesX / 6);
|
||||
int biomeMiddle = (biomeStart + biomeEdge) / 2;
|
||||
@@ -76,17 +78,13 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//TODO: make a better way of generating patches of grass
|
||||
for (int x = biomeStart; x <= biomeEdge; x++)
|
||||
{
|
||||
if (WorldGen.genRand.Next(150) == 0)
|
||||
if (WorldGen.genRand.Next(100) == 0)
|
||||
{
|
||||
WorldGen.TileRunner(x - 20, Main.maxTilesY - 120, WorldGen.genRand.Next(8, 22),
|
||||
WorldGen.genRand.Next(8, 22), ModContent.TileType<ScorchedRemains>(), false, 0f, 0f, false, true);
|
||||
ScorchedGrassPatches(new Point(x, Main.maxTilesY - 135));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//place ceiling across the top of the biome
|
||||
for (int x = biomeStart - 20; x <= biomeEdge + 20; x++)
|
||||
@@ -228,9 +226,9 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
|
||||
bool place = true;
|
||||
SchematicManager.PlaceSchematic<Action<Chest>>(SchematicManager.CragBridgeKey, new Point(biomeMiddle, Main.maxTilesY - 100),
|
||||
SchematicAnchor.Center, ref place, new Action<Chest>(FillBrimstoneChests));
|
||||
bool firstItem = false;
|
||||
SchematicManager.PlaceSchematic(SchematicManager.CragBridgeKey, new Point(biomeMiddle, Main.maxTilesY - 100),
|
||||
SchematicAnchor.Center, ref firstItem, new Action<Chest, int, bool>(FillBrimstoneChests));
|
||||
|
||||
for (int x = biomeStart; x <= biomeEdge; x++)
|
||||
{
|
||||
@@ -246,46 +244,106 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
|
||||
//this is wip, ignore it for now
|
||||
public static int[] ItemArray = { 0, 1, 2 };
|
||||
public int chestIncrement = 0;
|
||||
public static void FillBrimstoneChests(Chest chest)
|
||||
public static void FillBrimstoneChests(Chest chest, int Type, bool firstItem)
|
||||
{
|
||||
/*
|
||||
Potential other item ideas:
|
||||
Charred Idol (??)
|
||||
Obsidian Rose (?)
|
||||
Demon Conch (?)
|
||||
Lava Charm (?)
|
||||
Coastal Demonfish
|
||||
Demonic Bone Ash
|
||||
Hellstone Bars
|
||||
Hellfire Arrows
|
||||
Charred Idol
|
||||
Obsidian Rose
|
||||
Demon Conch
|
||||
Lava Charm
|
||||
*/
|
||||
|
||||
int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion);
|
||||
int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ObsidianSkinPotion, ItemID.BattlePotion, ItemID.InfernoPotion, ItemID.PotionOfReturn);
|
||||
List<ChestItem> contents = new List<ChestItem>()
|
||||
{
|
||||
new ChestItem(ItemID.Torch, WorldGen.genRand.Next(15, 29 + 1)),
|
||||
new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(5, 11 + 1)),
|
||||
new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(5, 7 + 1)),
|
||||
new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)),
|
||||
new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)),
|
||||
new ChestItem(ItemID.HellstoneBar, WorldGen.genRand.Next(2, 5)),
|
||||
new ChestItem(ModContent.ItemType<Items.Materials.DemonicBoneAsh>(), WorldGen.genRand.Next(4, 15)),
|
||||
new ChestItem(ModContent.ItemType<Items.Fishing.BrimstoneCragCatches.CoastalDemonfish>(), WorldGen.genRand.Next(2, 5)),
|
||||
new ChestItem(ItemID.HellfireArrow, WorldGen.genRand.Next(25, 50)),
|
||||
new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 12)),
|
||||
};
|
||||
|
||||
if (!firstItem)
|
||||
{
|
||||
contents.Insert(0, new ChestItem(ModContent.ItemType<Items.Weapons.Rogue.AshenStalactite>(), 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
contents.RemoveAt(0);
|
||||
contents.Insert(0, new ChestItem(ModContent.ItemType<Items.Weapons.Melee.BladecrestOathsword>(), 1));
|
||||
}
|
||||
|
||||
for (int i = 0; i < contents.Count; i++)
|
||||
{
|
||||
/*
|
||||
contents.Insert(0, new ChestItem(ModContent.ItemType<Items.Weapons.Summon.CinderBlossomStaff>(), 1));
|
||||
contents.Insert(0, new ChestItem(ModContent.ItemType<Items.Weapons.Rogue.AshenStalactite>(), 1));
|
||||
contents.Insert(0, new ChestItem(ModContent.ItemType<Items.Weapons.Melee.BladecrestOathsword>(), 1));
|
||||
*/
|
||||
|
||||
chest.item[i].SetDefaults(contents[i].Type);
|
||||
chest.item[i].stack = contents[i].Stack;
|
||||
}
|
||||
}
|
||||
|
||||
//shamelessly copy pasted from the astral biome generation
|
||||
public static void ScorchedGrassPatches(object obj)
|
||||
{
|
||||
//Pre-calculate all variables necessary for elliptical area checking
|
||||
Point origin = (Point)obj;
|
||||
Vector2 center = origin.ToVector2() * 16f + new Vector2(8f);
|
||||
|
||||
float angle = MathHelper.Pi * 0.15f;
|
||||
float otherAngle = MathHelper.PiOver2 - angle;
|
||||
|
||||
int distanceInTiles = WorldGen.genRand.Next(20, 50);
|
||||
float distance = distanceInTiles * 16f;
|
||||
float constant = distance * 2f / (float)Math.Sin(angle);
|
||||
|
||||
float fociSpacing = distance * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle);
|
||||
int verticalRadius = (int)(constant / 16f);
|
||||
|
||||
Vector2 fociOffset = Vector2.UnitY * fociSpacing;
|
||||
Vector2 topFoci = center - fociOffset;
|
||||
Vector2 bottomFoci = center + fociOffset;
|
||||
|
||||
UnifiedRandom rand = WorldGen.genRand;
|
||||
for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++)
|
||||
{
|
||||
for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++)
|
||||
{
|
||||
if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out float dist, y < origin.Y))
|
||||
{
|
||||
//If we're in the outer blurPercent% of the ellipse
|
||||
float percent = dist / constant;
|
||||
float blurPercent = 0.98f;
|
||||
if (percent > blurPercent)
|
||||
{
|
||||
float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent);
|
||||
if (rand.NextFloat(1f) > outerEdgePercent && Main.tile[x, y].HasTile && WorldGen.InWorld(x, y))
|
||||
{
|
||||
Main.tile[x, y].TileType = (ushort)ModContent.TileType<ScorchedRemains>();
|
||||
}
|
||||
}
|
||||
else if (Main.tile[x, y].HasTile && WorldGen.InWorld(x, y))
|
||||
{
|
||||
Main.tile[x, y].TileType = (ushort)ModContent.TileType<ScorchedRemains>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//shamelessly copy pasted from the astral biome generation
|
||||
public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false)
|
||||
{
|
||||
Vector2 point = tile.ToWorldCoordinates();
|
||||
if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance.
|
||||
{
|
||||
float distY = center.Y - point.Y;
|
||||
point.Y -= distY * 8f;
|
||||
}
|
||||
float distance1 = Vector2.Distance(point, focus1);
|
||||
float distance2 = Vector2.Distance(point, focus2);
|
||||
distance = distance1 + distance2;
|
||||
return distance <= distanceConstant;
|
||||
}
|
||||
|
||||
//place a circular clump of tiles
|
||||
public static void NaturalCircle(int i, int j, int size, int tileType)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user