Merge of Brimstone Crags and tons of other worldgen updates

Also Dylan's dev item (slug pet)
This commit is contained in:
Cameron Ewell authored and GitHub committed 2023-01-21 22:30:39 -05:00
commit 998ff928c7
145 files changed
+3483 -547

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.BiomeManagers
public override bool IsBiomeActive(Player player)
{
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !player.ZoneDesert && player.ZoneSnow;
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && player.ZoneSnow;
}
public override void SpecialVisuals(Player player, bool isActive)
+1 -1
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.BiomeManagers
public override bool IsBiomeActive(Player player)
{
return BiomeTileCounterSystem.BrimstoneCragTiles > 100;
return BiomeTileCounterSystem.BrimstoneCragTiles > 100 && player.ZoneUnderworldHeight;
}
}
}
+29
View File
@@ -0,0 +1,29 @@
using CalamityMod.Projectiles.Pets;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Pets
{
public class SeaSlugBuff : ModBuff
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sea Slug");
Description.SetDefault("The bioluminscent sea slug is following you");
Main.buffNoTimeDisplay[Type] = true;
Main.vanityPet[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.Calamity().seaSlugPet = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType<SeaSlug>()] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, ModContent.ProjectileType<SeaSlug>(), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

+2
View File
@@ -326,6 +326,7 @@ namespace CalamityMod.CalPlayer
public bool bendyPet = false;
public bool littleLightPet = false;
public bool pineapplePet = false;
public bool seaSlugPet = false;
#endregion
#region Rage
@@ -1477,6 +1478,7 @@ namespace CalamityMod.CalPlayer
bendyPet = false;
littleLightPet = false;
pineapplePet = false;
seaSlugPet = false;
onyxExcavator = false;
rimehound = false;
-9
View File
@@ -2030,8 +2030,6 @@ namespace CalamityMod.CalPlayer
// New textures
if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer)
{
Asset<Texture2D> sulphSeaRain = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaReplacements/RainSulphSea");
Asset<Texture2D> rainOriginal = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaReplacements/RainOriginal");
Asset<Texture2D> cometShard = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/ManaCometShard");
Asset<Texture2D> etherealCore = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/ManaEtherealCore");
Asset<Texture2D> phantomHeart = ModContent.Request<Texture2D>("CalamityMod/UI/HealthManaTextures/ManaPhantomHeart");
@@ -2059,13 +2057,6 @@ namespace CalamityMod.CalPlayer
break;
}
if (Main.bloodMoon)
TextureAssets.Rain = rainOriginal;
else if (Main.raining && ZoneSulphur)
TextureAssets.Rain = sulphSeaRain;
else
TextureAssets.Rain = rainOriginal;
if (auricSet)
TextureAssets.FlyingCarpet = carpetAuric;
else
+47
View File
@@ -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,29 @@ namespace CalamityMod
BalancingChangesManager.Load();
BaseIdleHoldoutProjectile.LoadAll();
PlayerDashManager.Load();
/*
//keep this disabled for now, hell bg system isnt used and there is a better way to load it
//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()
@@ -279,6 +308,9 @@ namespace CalamityMod
Filters.Scene["CalamityMod:MonolithAccursed"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:MonolithAccursed"] = new MonolithSky();
Filters.Scene["CalamityMod:BrimstoneCrag"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0f).UseOpacity(0f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:BrimstoneCrag"] = new BrimstoneCragSky();
SkyManager.Instance["CalamityMod:Astral"] = new AstralSky();
SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky();
SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky();
@@ -425,6 +457,21 @@ 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();
+46
View File
@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

+10 -2
View File
@@ -837,6 +837,12 @@ namespace CalamityMod.ILEditing
if (liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricWater").Slot)
SelectSulphuricWaterColor(x, y, ref initialColor);
if (liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/SunkenSeaWater").Slot)
SelectSulphuricWaterColor(x, y, ref initialColor);
if (liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/AbyssWater").Slot)
SelectSulphuricWaterColor(x, y, ref initialColor);
// Apply any extra color conditions.
initialColor = ExtraColorChangeConditions?.Invoke(initialColor, liquidType, new(x, y)) ?? initialColor;
@@ -961,11 +967,13 @@ namespace CalamityMod.ILEditing
orig(self, x, y, out outputColor);
Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y);
if (tile.LiquidAmount <= 0 || tile.HasTile || Main.waterStyle != ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricWater").Slot)
if (tile.LiquidAmount <= 0 || tile.HasTile || Main.waterStyle != ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricWater").Slot &&
Main.waterStyle != ModContent.Find<ModWaterStyle>("CalamityMod/SunkenSeaWater").Slot)
return;
Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1);
if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9))
if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) &&
Main.waterStyle == ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricWater").Slot)
{
MediumMistParticle acidFoam = new(new(x * 16f + Main.rand.NextFloat(16f), y * 16f + 8f), -Vector2.UnitY.RotatedByRandom(0.67f) * Main.rand.NextFloat(1f, 2.4f), Color.LightSeaGreen, Color.White, 0.16f, 128f, 0.02f);
GeneralParticleHandler.SpawnParticle(acidFoam);
@@ -49,12 +49,12 @@ namespace CalamityMod.Items.Armor.Fearmonger
public override void UpdateArmorSet(Player player)
{
player.setBonus = @"20% increased minion damage and +2 max minions
The minion damage nerf while wielding weaponry is reduced
Immunity to all forms of frost and flame
All minion attacks grant colossal life regeneration
15% increased damage reduction during the Pumpkin and Frost Moons
This extra damage reduction ignores the soft cap";
player.setBonus = "20% increased minion damage and +2 max minions\n" +
"The minion damage nerf while wielding weaponry is reduced\n" +
"Immunity to all forms of frost and flame\n" +
"All minion attacks grant colossal life regeneration\n" +
"15% increased damage reduction during the Pumpkin and Frost Moons\n" +
"This extra damage reduction ignores the soft cap";
// This bool encompasses cross-class nerf immunity, colossal life regen on minion attack, and the holiday moon DR
// TODO -- Fearmonger life regen from minion attacks needs some sort of cool visual effect
+8 -8
View File
@@ -45,14 +45,14 @@ namespace CalamityMod.Items.Armor.GodSlayer
modPlayer.godSlayerDamage = true;
var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString();
player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" +
"Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" +
"Enemies you dash through take massive damage\n" +
"During the dash you are immune to most debuffs\n" +
"The dash has a " + GodslayerArmorDash.GodslayerCooldown + " second cooldown\n" +
"Enemies are more likely to target you\n" +
"Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" +
"Enemies take a lot of damage when they hit you\n" +
"An attack that would deal 80 damage or less will have its damage reduced to 1";
"Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" +
"Enemies you dash through take massive damage\n" +
"During the dash you are immune to most debuffs\n" +
"The dash has a " + GodslayerArmorDash.GodslayerCooldown + " second cooldown\n" +
"Enemies are more likely to target you\n" +
"Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" +
"Enemies take a lot of damage when they hit you\n" +
"An attack that would deal 80 damage or less will have its damage reduced to 1";
player.thorns += 2.5f;
player.aggro += 1000;
+48
View File
@@ -0,0 +1,48 @@
using CalamityMod.Buffs.Pets;
using CalamityMod.Projectiles.Pets;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Pets
{
public class SeaSlugCerata : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 1;
DisplayName.SetDefault("Sea Slug Cerata");
Tooltip.SetDefault("Summons a bioluminescent sea slug to follow you"
+ "\nThe sea slug will change colors in different environments");
}
public override void SetDefaults()
{
Item.damage = 0;
Item.useStyle = ItemUseStyleID.Swing;
Item.useAnimation = 20;
Item.useTime = 20;
Item.noMelee = true;
Item.width = 26;
Item.height = 28;
Item.value = Item.sellPrice(gold: 20);
Item.rare = ModContent.RarityType<Turquoise>();
Item.Calamity().devItem = true;
Item.shoot = ModContent.ProjectileType<SeaSlug>();
Item.buffType = ModContent.BuffType<SeaSlugBuff>();
Item.UseSound = SoundID.Item2;
}
public override void UseStyle(Player player, Rectangle heldItemFrame)
{
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
{
player.AddBuff(Item.buffType, 15, true);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

+1
View File
@@ -1,6 +1,7 @@
using CalamityMod.Items.Placeables.Walls;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables
{
public class BrimstoneSlab : ModItem
+46
View File
@@ -0,0 +1,46 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Items.Placeables
{
public class CinderBlossomSeeds : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Cinder Blossom Seeds");
Tooltip.SetDefault("Places cinder blossom grass on scorched remains");
}
public override void SetDefaults()
{
Item.useTurn = true;
Item.autoReuse = true;
Item.consumable = true;
Item.width = 16;
Item.height = 16;
Item.useTime = 15;
Item.useAnimation = 15;
Item.useStyle = ItemUseStyleID.Swing;
Item.maxStack = 999;
}
public override bool? UseItem(Player player)
{
Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY);
Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1);
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>();
SoundEngine.PlaySound(SoundID.Dig, player.Center);
return true;
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

+49
View File
@@ -0,0 +1,49 @@
using CalamityMod.Items.Placeables;
using CalamityMod.Items.Placeables.Walls;
using CalamityMod.Tiles.Crags;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables
{
public class ScorchedBone : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 100;
DisplayName.SetDefault("Scorched Bone");
}
public override void SetDefaults()
{
Item.width = 26;
Item.height = 22;
Item.maxStack = 999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.rare = ItemRarityID.Orange;
Item.createTile = ModContent.TileType<Tiles.Crags.ScorchedBone>();
}
public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup)
{
itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood;
}
//i assume this is supposed to be for when the platforms and walls for this tile are finished
/*public override void AddRecipes()
{
CreateRecipe().
AddIngredient<AcidwoodPlatform>(2).
Register();
CreateRecipe(1).
AddIngredient(ModContent.ItemType<AcidwoodWallItem>(), 4).
AddTile(TileID.WorkBenches).Register();
}*/
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

+31
View File
@@ -0,0 +1,31 @@
using CalamityMod.Items.Placeables.Walls;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables
{
public class ScorchedRemains : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 100;
DisplayName.SetDefault("Scorched Remains");
}
public override void SetDefaults()
{
Item.createTile = ModContent.TileType<Tiles.Crags.ScorchedRemains>();
Item.useStyle = ItemUseStyleID.Swing;
Item.useTurn = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.autoReuse = true;
Item.consumable = true;
Item.width = 13;
Item.height = 10;
Item.maxStack = 999;
Item.value = 1000;
Item.rare = ItemRarityID.Orange;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

+1 -1
View File
@@ -11,7 +11,7 @@ namespace CalamityMod.Localization
{
_localizations = new[]
{
new [] { "SkyOreText", "The ground is glittering with cyan light." },
new [] { "SkyOreText", "The sky is glittering with cyan light." },
new [] { "IceOreText", "The ice caves are crackling with frigid energy." },
new [] { "PlantOreText", "Energized plant matter has formed in the underground." },
new [] { "TreeOreText", "Fossilized tree bark is bursting through the jungle's mud." },
+20 -3
View File
@@ -2939,8 +2939,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
{
@@ -7475,7 +7475,24 @@ namespace CalamityMod.NPCs
position.X += npc.velocity.X;
int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 16f);
int y = (int)((position.Y + (float)npc.height - 1f) / 16f);
if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile)) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - num10, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - num10, y - 3].TileType]))
// 21JAN2023: Ozzatron -- this is probably the single most unmaintainable if statement I've ever seen
// I have broken all the individual statements out even though I do not fully understand the code.
Tile t_xy = CalamityUtils.ParanoidTileRetrieval(x, y);
Tile t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1);
Tile t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2);
Tile t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3);
Tile t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - num10, y - 3); // 3 down, offset 1 in the direction of the NPC's movement
Tile t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4);
bool positionCheck = (float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X;
bool tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType];
bool oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile;
bool canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || (t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType]));
bool twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType];
bool threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType];
// Notice it doesn't check for platforms in ther offset position. This is why walking AIs twirl on 1-wide platforms in hellevators. They have to turn around before this check succeeds.
bool threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType];
if (positionCheck && (tileSolidityCheck1 || oneBelowIsSolidHalf) && canFallThrough && twoDownIsNonSolid && threeDownIsNonSolid && threeDownOffsetIsNonSolid)
{
float num13 = (float)(y * 16);
if (Main.tile[x, y].IsHalfBlock)
+133 -1
View File
@@ -1,18 +1,30 @@
using CalamityMod.BiomeManagers;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent.Bestiary;
using Terraria.GameContent.ItemDropRules;
using Terraria.ID;
using Terraria.ModLoader;
using ReLogic.Utilities;
using System;
namespace CalamityMod.NPCs.Crags
{
public class DespairStone : ModNPC
{
public SlotId ChainsawSoundSlot;
public static readonly SoundStyle ChainsawStartSound = new("CalamityMod/Sounds/Custom/ChainsawStart") { Volume = 0.15f };
public static readonly SoundStyle ChainsawEndSound = new("CalamityMod/Sounds/Custom/ChainsawEnd") { Volume = 0.15f };
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Despair Stone");
@@ -59,7 +71,84 @@ namespace CalamityMod.NPCs.Crags
public override void AI()
{
CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f);
float buzzsawStartTime = 480f;
NPC.ai[1]++;
if (NPC.ai[2] != 0f) BuzzsawMode();
if (NPC.ai[1] > buzzsawStartTime) //time needed for buzzsaw mode to be able to be started
{
if (NPC.ai[2] == 0f)
{
NPC.ai[1] = buzzsawStartTime + 1f; //freeze buzzsaw timer until buzzsaw mode is initiated.
NPC.rotation += NPC.velocity.X * 0.01f;
NPC.spriteDirection = -NPC.direction;
if (NPC.velocity.Y == 0f || NPC.lavaWet) BuzzsawMode(); //initiate Buzzsaw mode once the npc hits the ground
}
}
else //run regular ai if buzzsaw mode isn't available
{
NPC.ai[2] = 0f;
CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f);
}
if (NPC.lavaWet) //float on lava
NPC.velocity.Y += -0.8f;
}
public void BuzzsawMode()
{
float distance;
float speedCap = 10f;
//Choose Direction
if (NPC.ai[2] == 0f)
{
ChainsawSoundSlot = SoundEngine.PlaySound(ChainsawStartSound, NPC.Center);
if (NPC.velocity.X < 0f) //left
{
NPC.ai[2] = -1f;
}
else if (NPC.velocity.X > 0f) //right
{
NPC.ai[2] = 1f;
}
else //if npc is stationary when selecting direction, go towards target.
{
distance = Main.player[NPC.target].Center.X - NPC.Center.X;
if (distance != 0f)
{
NPC.ai[2] = distance / Math.Abs(distance);
}
else NPC.ai[2] = 1f;
}
}
if (SoundEngine.TryGetActiveSound(ChainsawSoundSlot, out var chainsawSound) && chainsawSound.IsPlaying)
chainsawSound.Position = NPC.Center;
if (NPC.velocity.X == 0f) //go up if against wall
{
if (NPC.velocity.Y > -speedCap) //Accelerate to top speed
NPC.velocity.Y += -1.66f;
if (NPC.velocity.Y < -speedCap) //Cap top speed
NPC.velocity.Y = -speedCap;
}
if (NPC.velocity.X == 0f || NPC.velocity.Y == 0f) //check if on solid ground
SpawnSparks();
else if (Main.player[NPC.target].Center.Y - NPC.Center.Y < 0f && NPC.velocity.Y < 0f && !NPC.lavaWet) //if not on solid ground and target player is above the NPC, reduce gravity
NPC.velocity.Y += -0.03f;
if (Math.Abs(NPC.velocity.X) < speedCap) //Accelerate to top speed
NPC.velocity.X += 1.66f * NPC.ai[2];
if (Math.Abs(NPC.velocity.X) > speedCap) //Cap top speed
NPC.velocity.X = speedCap * NPC.ai[2];
NPC.rotation += speedCap * 0.03f * NPC.ai[2]; //rotate sprite in chosen direction
NPC.spriteDirection = -NPC.direction;
//stop buzzsaw mode
if (NPC.ai[1] > Main.rand.Next(670, 740))
{
NPC.ai[1] = 0f;
NPC.velocity.Y += -3f;
chainsawSound?.Stop();
SoundEngine.PlaySound(ChainsawEndSound, NPC.Center);
}
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
@@ -100,5 +189,48 @@ namespace CalamityMod.NPCs.Crags
}
}
}
public override bool PreKill()
{
if (SoundEngine.TryGetActiveSound(ChainsawSoundSlot, out var chainsawSound) && chainsawSound.IsPlaying)
chainsawSound?.Stop();
return true;
}
public void SpawnSparks()
{
Vector2 particleSpawnDisplacement;
Vector2 splatterDirection;
if (NPC.velocity.X == 0f)
{
particleSpawnDisplacement = new Vector2 (24f * NPC.ai[2], 20f);
splatterDirection = new Vector2(0f, 1f);
}
else
{
particleSpawnDisplacement = new Vector2(20f * -NPC.ai[2], 24f);
splatterDirection = new Vector2(-NPC.ai[2], 0f);
}
//Color impactColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.5f));
Vector2 bloodSpawnPosition = NPC.Center + particleSpawnDisplacement;
if (NPC.ai[1] % 4 == 0)
{
for (int i = 0; i < 2; i++)
{
int sparkLifetime = Main.rand.Next(14, 21);
float sparkScale = Main.rand.NextFloat(0.8f, 1f) + 1f * 0.05f;
Color sparkColor = Color.Lerp(Color.DarkGray, Color.DarkRed, Main.rand.NextFloat(0.7f));
sparkColor = Color.Lerp(sparkColor, Color.OrangeRed, Main.rand.NextFloat());
if (Main.rand.NextBool(10))
sparkScale *= 1.4f;
Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.45f) * Main.rand.NextFloat(6f, 13f);
sparkVelocity.Y -= 6f;
SparkParticle spark = new SparkParticle(bloodSpawnPosition, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor);
GeneralParticleHandler.SpawnParticle(spark);
}
}
}
}
}
+11 -13
View File
@@ -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;
+1 -1
View File
@@ -1136,7 +1136,7 @@ namespace CalamityMod.NPCs.HiveMind
{
string key = "Mods.CalamityMod.SkyOreText";
Color messageColor = Color.Cyan;
CalamityUtils.SpawnOre(ModContent.TileType<AerialiteOre>(), 12E-05, 0.5f, 0.7f, 3, 8);
CalamityUtils.SpawnAerialiteOre();
CalamityUtils.DisplayLocalizedText(key, messageColor);
}
+3 -3
View File
@@ -51,12 +51,12 @@ namespace CalamityMod.NPCs.NormalNPCs
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.PlayerSafe || (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator) || spawnInfo.Player.Calamity().ZoneAbyss ||
spawnInfo.Player.Calamity().ZoneSunkenSea)
if (spawnInfo.PlayerSafe || (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator))
{
return 0f;
}
return SpawnCondition.Cavern.Chance * 0.05f;
return SpawnCondition.Sky.Chance * 0.2f;
}
public override void HitEffect(int hitDirection, double damage)
+1 -1
View File
@@ -521,7 +521,7 @@ namespace CalamityMod.NPCs.Perforator
{
string key = "Mods.CalamityMod.SkyOreText";
Color messageColor = Color.Cyan;
CalamityUtils.SpawnOre(ModContent.TileType<AerialiteOre>(), 12E-05, 0.5f, 0.7f, 3, 8);
CalamityUtils.SpawnAerialiteOre();
CalamityUtils.DisplayLocalizedText(key, messageColor);
}
+3
View File
@@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.Items.Pets;
using CalamityMod.Projectiles.Rogue;
using System.Collections.Generic;
using Terraria;
@@ -375,6 +376,8 @@ namespace CalamityMod.NPCs.TownNPCs
nextSlot++;
shop.item[nextSlot].SetDefaults(ModContent.ItemType<PolypLauncher>());
nextSlot++;
shop.item[nextSlot].SetDefaults(ModContent.ItemType<SeaSlugCerata>());
nextSlot++;
if (CalamityConfig.Instance.PotionSelling)
{
shop.item[nextSlot].SetDefaults(ItemID.GillsPotion);
+411
View File
@@ -0,0 +1,411 @@
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using System;
namespace CalamityMod.Projectiles.Pets
{
public class SeaSlug : ModProjectile
{
private int playerStill = 0;
private bool fly = false;
private int idleTimer = 0;
private Form SeaSlugColor = Form.Normal;
private enum Form
{
Normal, Sulphur, Abyss, Sunken, Astral, Crags, Snow, Desert, Jungle
}
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sea Slug");
Main.projFrames[Projectile.type] = 6;
Main.projPet[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.netImportant = true;
Projectile.width = 54;
Projectile.height = 38;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.timeLeft *= 5;
Projectile.tileCollide = true;
Projectile.ignoreWater = true;
}
private void UpdateColor(Player player)
{
if (player.InSulphur())
{
SeaSlugColor = Form.Sulphur;
}
else if (player.InAbyss())
{
SeaSlugColor = Form.Abyss;
}
else if (player.InSunkenSea())
{
SeaSlugColor = Form.Sunken;
}
else if (player.InAstral())
{
SeaSlugColor = Form.Astral;
}
else if (player.InCalamity())
{
SeaSlugColor = Form.Crags;
}
else if (player.ZoneSnow)
{
SeaSlugColor = Form.Snow;
}
else if (player.ZoneDesert)
{
SeaSlugColor = Form.Desert;
}
else if (player.ZoneJungle)
{
SeaSlugColor = Form.Jungle;
}
else
{
SeaSlugColor = Form.Normal;
}
}
public override bool PreDraw(ref Color lightColor)
{
Draw(lightColor, ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlug").Value);
return false;
}
public override void PostDraw(Color lightColor)
{
DrawGlowmask(Color.White, ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlug_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSulphur_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugAbyss_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSunken_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugAstral_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugCrags_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSnow_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugDesert_Glow").Value,
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugJungle_Glow").Value);
}
private void Draw(Color color, Texture2D texture)
{
int height = texture.Height / Main.projFrames[Projectile.type];
int frameHeight = height * Projectile.frame;
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0);
}
private void DrawGlowmask(Color color, Texture2D normal, Texture2D sulphur, Texture2D abyss, Texture2D sunken, Texture2D astral, Texture2D crags, Texture2D snow, Texture2D desert, Texture2D jungle)
{
Texture2D texture = normal;
switch (SeaSlugColor)
{
case Form.Normal:
texture = normal;
break;
case Form.Sulphur:
texture = sulphur;
break;
case Form.Abyss:
texture = abyss;
break;
case Form.Sunken:
texture = sunken;
break;
case Form.Astral:
texture = astral;
break;
case Form.Crags:
texture = crags;
break;
case Form.Snow:
texture = snow;
break;
case Form.Desert:
texture = desert;
break;
case Form.Jungle:
texture = jungle;
break;
}
int height = texture.Height / Main.projFrames[Projectile.type];
int frameHeight = height * Projectile.frame;
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0);
}
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
fallThrough = playerDistance > 200f;
return true;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
if (!player.active)
{
Projectile.active = false;
return;
}
CalamityPlayer modPlayer = player.Calamity();
if (player.dead)
{
modPlayer.seaSlugPet = false;
}
if (modPlayer.seaSlugPet)
{
Projectile.timeLeft = 2;
}
UpdateColor(player);
Vector2 vector46 = Projectile.position;
if (!fly)
{
Projectile.rotation = 0;
Vector2 center2 = Projectile.Center;
Vector2 vector48 = player.Center - center2;
float playerDistance = vector48.Length();
if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -8f;
}
Projectile.velocity.Y += 0.35f;
if (Projectile.velocity.Y > 15f)
{
Projectile.velocity.Y = 15f;
}
if (playerDistance > 600f)
{
fly = true;
Projectile.velocity.X = 0f;
Projectile.velocity.Y = 0f;
}
if (playerDistance > 100f)
{
if (player.position.X - Projectile.position.X > 0f)
{
Projectile.velocity.X += 0.10f;
if (Projectile.velocity.X > 5f)
{
Projectile.velocity.X = 5f;
}
}
else
{
Projectile.velocity.X -= 0.10f;
if (Projectile.velocity.X < -5f)
{
Projectile.velocity.X = -5f;
}
}
}
if (playerDistance < 100f)
{
if (Projectile.velocity.X != 0f)
{
if (Projectile.velocity.X > 0.8f)
{
Projectile.velocity.X -= 0.25f;
}
else if (Projectile.velocity.X < -0.8f)
{
Projectile.velocity.X += 0.25f;
}
else if (Projectile.velocity.X < 0.8f && Projectile.velocity.X > -0.8f)
{
Projectile.velocity.X = 0f;
}
}
}
if (playerDistance < 70f)
{
Projectile.velocity.X *= 0.5f;
}
if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0)
{
Projectile.frame = 0;
Projectile.frameCounter = 0;
}
if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y)
{
Projectile.frame = 4;
Projectile.frameCounter = 0;
}
else
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 3)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 4)
{
Projectile.frame = 1;
}
}
if (Projectile.velocity.X > 0.8f)
{
Projectile.spriteDirection = 1;
}
else if (Projectile.velocity.X < -0.8f)
{
Projectile.spriteDirection = -1;
}
}
else if (fly)
{
float num16 = 0.5f;
Projectile.tileCollide = false;
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
vertiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)player.direction);
vertiPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
float num21 = 18f;
float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
if (playerDistance > 1200f)
{
Projectile.position.X = player.Center.X - (float)(Projectile.width / 2);
Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2);
Projectile.netUpdate = true;
}
if (playerDistance < 100f)
{
num16 = 0.5f;
if (player.velocity.Y == 0f)
{
++playerStill;
}
else
{
playerStill = 0;
}
if (playerStill > 10 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))
{
fly = false;
Projectile.velocity *= 0.2f;
Projectile.tileCollide = true;
}
}
if (playerDistance < 50f)
{
if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f)
{
Projectile.velocity *= 0.90f;
}
num16 = 0.02f;
}
else
{
if (playerDistance < 100f)
{
num16 = 0.35f;
}
if (playerDistance > 300f)
{
num16 = 1f;
}
playerDistance = num21 / playerDistance;
horiPos *= playerDistance;
vertiPos *= playerDistance;
}
if (Projectile.velocity.X <= horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
if (num16 > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + num16;
}
}
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
if (num16 > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - num16;
}
}
if (Projectile.velocity.Y <= vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16;
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
}
}
if (Projectile.velocity.Y > vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16;
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
}
}
Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
if (Projectile.Center.X < Main.player[Projectile.owner].Center.X)
{
Projectile.spriteDirection = 1;
}
else if (Projectile.Center.X > Main.player[Projectile.owner].Center.X)
{
Projectile.spriteDirection = -1;
}
Projectile.frame = 5;
idleTimer = 0;
}
}
private bool HoleBelow()
{
int tileWidth = 4;
int tileX = (int)(Projectile.Center.X / 16f) - tileWidth;
if (Projectile.velocity.X > 0)
{
tileX += tileWidth;
}
int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f);
for (int y = tileY; y < tileY + 2; y++)
{
for (int x = tileX; x < tileX + tileWidth; x++)
{
if (Main.tile[x, y].HasTile)
{
return false;
}
}
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

+17
View File
@@ -0,0 +1,17 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Systems
{
public class BrimstoneCragScene : ModSceneEffect
{
public override SceneEffectPriority Priority => SceneEffectPriority.Environment;
public override bool IsSceneEffectActive(Player player) => player.Calamity().ZoneCalamity;
public override void SpecialVisuals(Player player, bool isActive)
{
player.ManageSpecialBiomeVisuals("CalamityMod:BrimstoneCrag", isActive);
}
}
}
Binary file not shown.
+6
View File
@@ -64,6 +64,9 @@ namespace CalamityMod.Schematics
internal const string AstralBeaconKey = "Astral Beacon";
internal const string AstralBeaconFilename = "Schematics/AstralBeacon.csch";
internal const string CragBridgeKey = "Crags Bridge";
internal const string CragBridgeFilename = "Schematics/CragBridge.csch";
internal static Dictionary<string, SchematicMetaTile[,]> TileMaps;
internal static Dictionary<string, PilePlacementFunction> PilePlacementMaps;
@@ -98,6 +101,9 @@ namespace CalamityMod.Schematics
// Astral world gen structures
[AstralBeaconKey] = CalamitySchematicIO.LoadSchematic(AstralBeaconFilename),
//crag bridge
[CragBridgeKey] = CalamitySchematicIO.LoadSchematic(CragBridgeFilename),
// Sulphurous Sea scrap world gen structures
["Sulphurous Scrap 1"] = CalamitySchematicIO.LoadSchematic("Schematics/SulphurousScrap1.csch").ShaveOffEdge(),
["Sulphurous Scrap 2"] = CalamitySchematicIO.LoadSchematic("Schematics/SulphurousScrap2.csch").ShaveOffEdge(),
+133
View File
@@ -0,0 +1,133 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Skies
{
public class BrimstoneCragSky : CustomSky
{
public int skyActiveLeeway = 0;
public class Cinder
{
public int Time;
public int Lifetime;
public int IdentityIndex;
public float Scale;
public float Depth;
public Color DrawColor;
public Vector2 Velocity;
public Vector2 Center;
public Cinder(int lifetime, int identity, float depth, Color color, Vector2 startingPosition, Vector2 startingVelocity)
{
Lifetime = lifetime;
IdentityIndex = identity;
Depth = depth;
DrawColor = color;
Center = startingPosition;
Velocity = startingVelocity;
}
}
private bool skyActive;
private float opacity;
public List<Cinder> Cinders = new List<Cinder>();
public override void Deactivate(params object[] args) => skyActive = false;
public override void Reset() => skyActive = false;
public override bool IsActive() => skyActive || opacity > 0f;
public override void Activate(Vector2 position, params object[] args) => skyActive = true;
public override void Update(GameTime gameTime)
{
if (!Main.LocalPlayer.Calamity().ZoneCalamity || Main.gameMenu)
{
skyActive = false;
if (skyActiveLeeway > 0) skyActiveLeeway--;
}
else if (skyActiveLeeway < 60) skyActiveLeeway++;
if (skyActive && opacity < 1f)
{
opacity += 0.02f;
}
else if (!skyActive && opacity > 0f)
{
opacity -= 0.02f;
}
static Color selectCinderColor()
{
if (Main.rand.NextBool(3))
return Color.Lerp(Color.DarkGray, Color.LightGray, Main.rand.NextFloat());
return Color.Lerp(Color.Red, Color.Yellow, Main.rand.NextFloat(0.9f));
}
// Randomly add cinders.
if (Main.rand.NextBool(12) && skyActive)
{
int lifetime = Main.rand.Next(285, 445);
float depth = Main.rand.NextFloat(1.8f, 5f);
Vector2 startingPosition = Main.screenPosition + new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f);
Vector2 startingVelocity = -Vector2.UnitY.RotatedByRandom(0.91f);
Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, selectCinderColor(), startingPosition, startingVelocity));
}
// Update all cinders.
if (skyActive || skyActiveLeeway > 0)
{
float cinderSpeed = 5.6f;
for (int i = 0; i < Cinders.Count; i++)
{
Cinders[i].Scale = Utils.GetLerpValue(Cinders[i].Lifetime, Cinders[i].Lifetime / 3, Cinders[i].Time, true);
Cinders[i].Scale *= MathHelper.Lerp(0.6f, 0.9f, Cinders[i].IdentityIndex % 6f / 6f);
Vector2 idealVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.94f, 0.94f, (float)Math.Sin(Cinders[i].Time / 36f + Cinders[i].IdentityIndex) * 0.5f + 0.5f)) * cinderSpeed;
float movementInterpolant = MathHelper.Lerp(0.01f, 0.08f, Utils.GetLerpValue(45f, 145f, Cinders[i].Time, true));
Cinders[i].Velocity = Vector2.Lerp(Cinders[i].Velocity, idealVelocity, movementInterpolant);
Cinders[i].Velocity = Cinders[i].Velocity.SafeNormalize(-Vector2.UnitY) * cinderSpeed;
Cinders[i].Time++;
Cinders[i].Center += Cinders[i].Velocity;
}
}
// Clear away all dead cinders.
Cinders.RemoveAll(c => c.Time >= c.Lifetime);
if (!Main.LocalPlayer.Calamity().ZoneCalamity)
Filters.Scene["CalamityMod:BrimstoneCrag"].Deactivate(Array.Empty<object>());
}
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
if (!Main.LocalPlayer.Calamity().ZoneCalamity && skyActiveLeeway == 0)
return;
// Draw cinders.
Texture2D cinderTexture = ModContent.Request<Texture2D>("CalamityMod/Skies/CalamitasCinder").Value;
float scaleFade = skyActiveLeeway / 60f;
for (int i = 0; i < Cinders.Count; i++)
{
Vector2 drawPosition = Cinders[i].Center - Main.screenPosition;
for (int j = 0; j < 3; j++)
{
Vector2 offsetDrawPosition = drawPosition + (MathHelper.TwoPi * j / 3f).ToRotationVector2() * 1.4f;
Color offsetDrawColor = Color.Red * 0.56f;
offsetDrawColor.A = 0;
spriteBatch.Draw(cinderTexture, offsetDrawPosition, null, offsetDrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale * 1.5f * scaleFade, SpriteEffects.None, 0f);
}
spriteBatch.Draw(cinderTexture, drawPosition, null, Cinders[i].DrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale * scaleFade, SpriteEffects.None, 0f);
}
}
}
}
Binary file not shown.
Binary file not shown.
+239
View File
@@ -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
}
}
*/
+30 -54
View File
@@ -29,6 +29,7 @@ namespace CalamityMod.Systems
#region ModifyWorldGenTasks
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
//evil island
int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses"));
if (islandIndex != -1)
{
@@ -39,12 +40,14 @@ namespace CalamityMod.Systems
}));
}
//biome chests in dungeon
int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon"));
if (DungeonChestIndex != -1)
{
tasks.Insert(DungeonChestIndex + 1, new PassLegacy("CalamityDungeonBiomeChests", MiscWorldgenRoutines.GenerateBiomeChests));
}
//big jungle temple
int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple"));
tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) =>
{
@@ -52,8 +55,9 @@ namespace CalamityMod.Systems
CustomTemple.NewJungleTemple();
});
int hiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives"));
tasks[JungleTempleIndex] = new PassLegacy("Giant Hive", (progress, config) =>
//giant hive
int HiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives"));
tasks[HiveIndex] = new PassLegacy("Giant Hive", (progress, config) =>
{
progress.Message = "Building a giant beehive";
int attempts = 0;
@@ -66,6 +70,7 @@ namespace CalamityMod.Systems
}
});
//big jungle temple golem arena i assume
int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple"));
tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) =>
{
@@ -91,6 +96,7 @@ namespace CalamityMod.Systems
}));
}
//better temple altar
int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars"));
tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) =>
{
@@ -98,11 +104,11 @@ namespace CalamityMod.Systems
CustomTemple.NewJungleTempleLihzahrdAltar();
});
// TODO -- Most of the below worldgen should be spaced out at better points of generation instead of all crammed at the end
//stuff that gens after vanilla worldgen
int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup"));
if (FinalIndex != -1)
{
//gem deposits
int currentFinalIndex = FinalIndex;
tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) =>
{
@@ -110,43 +116,10 @@ namespace CalamityMod.Systems
MiscWorldgenRoutines.SmartGemGen();
}));
//planetoids
tasks.Insert(++currentFinalIndex, new PassLegacy("Planetoids", Planetoid.GenerateAllBasePlanetoids));
//Not touching this yet because the Crags will be reworked in the future
#region BrimstoneCrag
tasks.Insert(++currentFinalIndex, new PassLegacy("Brimstone Crag", (progress, config) =>
{
progress.Message = "Uncovering the ruins of a fallen empire";
int x = Main.maxTilesX;
int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15));
int yUnderworldGen = Main.maxTilesY - 100;
MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136);
MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71);
MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71);
MiscWorldgenRoutines.ChasmGenerator(xUnderworldGen - 110, yUnderworldGen - 10, WorldGen.genRand.Next(150) + 150);
MiscWorldgenRoutines.ChasmGenerator(xUnderworldGen + 110, yUnderworldGen - 10, WorldGen.genRand.Next(150) + 150);
MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41);
MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41);
MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41);
MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen, yUnderworldGen + 30, 1323);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 22, yUnderworldGen + 15, 1322);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 22, yUnderworldGen + 15, 535);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 50, yUnderworldGen - 30, 112);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 50, yUnderworldGen - 30, 906);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 150, yUnderworldGen - 30, 218);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 150, yUnderworldGen - 30, 3019);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 180, yUnderworldGen - 20, 274);
MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 180, yUnderworldGen - 20, 220);
}));
#endregion
//sulfur sea
int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes"));
if (SulphurIndex != -1)
{
@@ -157,6 +130,21 @@ namespace CalamityMod.Systems
}));
}
//brimstone crags
tasks.Insert(++currentFinalIndex, new PassLegacy("Brimstone Crag", (progress, config) =>
{
progress.Message = "Uncovering the ruins of a fallen empire";
BrimstoneCrag.GenAllCragsStuff();
}));
//biome shrines
tasks.Insert(++currentFinalIndex, new PassLegacy("Special Shrines", (progress, config) =>
{
progress.Message = "Placing hidden shrines";
UndergroundShrines.PlaceShrines();
}));
//draedon labs
tasks.Insert(++currentFinalIndex, new PassLegacy("Draedon Structures", (progress, config) =>
{
progress.Message = "Rust and Dust";
@@ -196,33 +184,22 @@ namespace CalamityMod.Systems
workshopPositions.Add(placementPosition);
}
}));
tasks.Insert(++currentFinalIndex, new PassLegacy("Special Shrines", (progress, config) =>
{
progress.Message = "Placing hidden shrines";
UndergroundShrines.PlaceCorruptionShrine(WorldGen.structures);
UndergroundShrines.PlaceCrimsonShrine(WorldGen.structures);
UndergroundShrines.PlaceDesertShrine(WorldGen.structures);
UndergroundShrines.PlaceGraniteShrine(WorldGen.structures);
UndergroundShrines.PlaceIceShrine(WorldGen.structures);
UndergroundShrines.PlaceMarbleShrine(WorldGen.structures);
UndergroundShrines.PlaceMushroomShrine(WorldGen.structures);
UndergroundShrines.PlaceSurfaceShrine(WorldGen.structures);
}));
//abyss
tasks.Insert(++currentFinalIndex, new PassLegacy("Abyss", (progress, config) =>
{
progress.Message = "Discovering the new Challenger Deep";
Abyss.PlaceAbyss();
}));
//sulfur sea extra gen
tasks.Insert(++currentFinalIndex, new PassLegacy("Sulphur Sea 2", (progress, config) =>
{
progress.Message = "Further polluting one of the oceans";
SulphurousSea.SulphurSeaGenerationAfterAbyss();
}));
//roxcalibur
tasks.Insert(++currentFinalIndex, new PassLegacy("Roxcalibur", (progress, config) =>
{
progress.Message = "I Wanna Rock";
@@ -317,7 +294,6 @@ namespace CalamityMod.Systems
}
}
}
}
}
+91 -7
View File
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -9,8 +8,7 @@ namespace CalamityMod.Tiles.Abyss
{
public class AbyssGravel : ModTile
{
int subsheetHeight = 270;
int subsheetWidth = 288;
int animationFrameWidth = 288;
public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3);
@@ -43,14 +41,100 @@ namespace CalamityMod.Tiles.Abyss
public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
{
frameXOffset = i % 1 * subsheetWidth; //the 1 should be 2, but it looks weird right now, should be looked into later
frameYOffset = j % 1 * subsheetHeight;
int uniqueAnimationFrameX = 0;
int xPos = i % 4;
int yPos = j % 4;
switch (xPos)
{
case 0:
switch (yPos)
{
case 0:
uniqueAnimationFrameX = 0;
break;
case 1:
uniqueAnimationFrameX = 2;
break;
case 2:
uniqueAnimationFrameX = 1;
break;
case 3:
uniqueAnimationFrameX = 2;
break;
default:
uniqueAnimationFrameX = 2;
break;
}
break;
case 1:
switch (yPos)
{
case 0:
uniqueAnimationFrameX = 2;
break;
case 1:
uniqueAnimationFrameX = 0;
break;
case 2:
uniqueAnimationFrameX = 2;
break;
case 3:
uniqueAnimationFrameX = 2;
break;
default:
uniqueAnimationFrameX = 2;
break;
}
break;
case 2:
switch (yPos)
{
case 0:
uniqueAnimationFrameX = 2;
break;
case 1:
uniqueAnimationFrameX = 0;
break;
case 2:
uniqueAnimationFrameX = 1;
break;
case 3:
uniqueAnimationFrameX = 2;
break;
default:
uniqueAnimationFrameX = 2;
break;
}
break;
case 3:
switch (yPos)
{
case 0:
uniqueAnimationFrameX = 1;
break;
case 1:
uniqueAnimationFrameX = 2;
break;
case 2:
uniqueAnimationFrameX = 0;
break;
case 3:
uniqueAnimationFrameX = 2;
break;
default:
uniqueAnimationFrameX = 2;
break;
}
break;
}
frameXOffset = uniqueAnimationFrameX * animationFrameWidth;
}
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
{
TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt);
return false;
}
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

+2 -1
View File
@@ -14,10 +14,11 @@ namespace CalamityMod.Tiles.Abyss
Main.tileSolid[Type] = true;
Main.tileMergeDirt[Type] = false;
Main.tileBlockLight[Type] = true;
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]);
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]);
CalamityUtils.MergeWithGeneral(Type);
CalamityUtils.MergeDecorativeTiles(Type);
CalamityUtils.MergeWithAbyss(Type);
ItemDrop = ModContent.ItemType<Acidwood>();
HitSound = SoundID.Dig;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

+2 -2
View File
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
@@ -30,6 +29,7 @@ namespace CalamityMod.Tiles.Abyss
ItemDrop = ModContent.ItemType<Items.Placeables.Voidstone>();
AddMapEntry(new Color(15, 15, 15));
}
int animationFrameWidth = 288;
public override bool CreateDust(int i, int j, ref int type)
+3 -1
View File
@@ -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>()
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

+43
View File
@@ -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

+46
View File
@@ -0,0 +1,46 @@
using CalamityMod.Tiles.Ores;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Tiles.Crags
{
public class ScorchedBone : ModTile
{
private int sheetWidth = 450;
private int sheetHeight = 270;
public override void SetStaticDefaults()
{
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = true;
CalamityUtils.MergeWithGeneral(Type);
CalamityUtils.MergeWithHell(Type);
CalamityUtils.SetMerge(Type, ModContent.TileType<BrimstoneSlag>());
DustType = 155;
HitSound = SoundID.Dig;
MineResist = 1f;
MinPick = 100;
ItemDrop = ModContent.ItemType<Items.Placeables.ScorchedBone>();
AddMapEntry(new Color(87, 62, 67));
}
public override bool CanExplode(int i, int j)
{
return false;
}
public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
{
frameXOffset = i % 3 * sheetWidth;
frameYOffset = j % 3 * sheetHeight;
}
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
{
return TileFraming.BrimstoneFraming(i, j, resetFrame);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

+65
View File
@@ -0,0 +1,65 @@
using CalamityMod.Tiles.Ores;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Tiles.Crags
{
public class ScorchedRemains : ModTile
{
private int sheetWidth = 288;
private int sheetHeight = 270;
public override void SetStaticDefaults()
{
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = true;
CalamityUtils.MergeWithGeneral(Type);
CalamityUtils.MergeWithHell(Type);
CalamityUtils.SetMerge(Type, ModContent.TileType<BrimstoneSlag>());
DustType = 155;
HitSound = SoundID.Dig;
MineResist = 1f;
MinPick = 100;
ItemDrop = ModContent.ItemType<Items.Placeables.ScorchedRemains>();
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);
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f);
return false;
}
public override bool CanExplode(int i, int j)
{
return false;
}
public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
{
frameXOffset = i % 3 * sheetWidth;
frameYOffset = j % 3 * sheetHeight;
}
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
{
TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType<BrimstoneSlag>(), false, false, false, false, resetFrame);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

+408
View File
@@ -0,0 +1,408 @@
using CalamityMod.Tiles.Ores;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Tiles.Crags
{
public class ScorchedRemainsGrass : ModTile
{
private const short subsheetWidth = 450;
private const short subsheetHeight = 198;
private int extraFrameHeight = 36;
private int extraFrameWidth = 90;
public override void SetStaticDefaults()
{
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = true;
Main.tileLighted[Type] = true;
CalamityUtils.MergeWithGeneral(Type);
CalamityUtils.MergeWithHell(Type);
CalamityUtils.SetMerge(Type, ModContent.TileType<ScorchedRemains>());
HitSound = SoundID.Dig;
MineResist = 1f;
MinPick = 100;
ItemDrop = ModContent.ItemType<Items.Placeables.ScorchedRemains>();
AddMapEntry(new Color(212, 82, 227));
}
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
{
r = 1.82f;
g = 0.56f;
b = 1.07f;
}
public override bool CreateDust(int i, int j, ref int type)
{
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f);
return false;
}
public override bool CanExplode(int i, int j)
{
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>();
}
}
public override void RandomUpdate(int i, int j)
{
Tile up = Main.tile[i, j - 1];
Tile up2 = Main.tile[i, j - 2];
//convert this tile back into scorched remains if any liquid is above it
//will change this to only check for lava if necessary
if (up.LiquidAmount > 0)
{
Main.tile[i, j].TileType = (ushort)ModContent.TileType<ScorchedRemains>();
}
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)
{
try
{
Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
}
catch { }
}
}
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
{
Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero;
Color drawColour = GetDrawColour(i, j);
Texture2D leaves = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/CinderBlossomGrassGrass").Value;
DrawExtraTop(i, j, leaves, drawOffset, drawColour);
DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour);
DrawExtraDrapes(i, j, leaves, drawOffset, drawColour);
}
#region 'Extra Drapes' Drawing
private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
{
/*
If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface
*/
if (
CheckTile(Type, false, 0, 1, i, j) ||
(CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j))
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
DrawExtraOverhang(i, j, extras, drawOffset, drawColour);
}
}
private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
{
/*
Ending the Extra when a wall is reached
*/
//Left
if (
CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
(CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j))
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
//Right
if (
CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
(CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j))
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
}
private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
{
/*
Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached
*/
//Left
if (
CheckTile(Type, false, -1, 0, i, j)
)
{
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
//Right
if (
CheckTile(Type, false, 1, 0, i, j)
)
{
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
}
private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour)
{
/*
Hanging 'drapes' of the extra element
*/
//Base
if (
(CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) ||
(CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j))
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
//Left Wall
if (
CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
(CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j))
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
//Right Wall
if (
CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) &&
(CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j))
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
//Left Overhang
if (
CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j)
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
//Right Overhang
if (
CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j)
)
{
Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
}
#endregion
#region Tile Data
private bool CheckTile(int type, bool equal, int x, int y, int i, int j)
{
//Subtract y so that y is vertical for ease of readability
return Main.tile[i + x, j - y].TileType == type == equal;
}
private Color GetDrawColour(int i, int j)
{
int colType = Main.tile[i, j].TileColor;
Color paintCol = WorldGen.paintColor(colType);
if (colType < 13)
{
paintCol.R = (byte)((paintCol.R / 2f) + 128);
paintCol.G = (byte)((paintCol.G / 2f) + 128);
paintCol.B = (byte)((paintCol.B / 2f) + 128);
}
if (colType == 29)
{
paintCol = Color.Black;
}
Color col = Lighting.GetColor(i, j);
col.R = (byte)(paintCol.R / 255f * col.R);
col.G = (byte)(paintCol.G / 255f * col.G);
col.B = (byte)(paintCol.B / 255f * col.B);
return col;
}
private int GetExtraState(string type)
{
switch (type)
{
case "middle":
return 36;
case "overhangLeft":
return 18;
case "overhangRight":
return 54;
case "wallEndLeft":
return 0;
case "wallEndRight":
return 72;
default:
Main.NewText(type.ToString() + " is not a valid Extra sheet state");
return 0;
}
}
private int GetExtraPattern(int i)
{
return i % 3 * extraFrameHeight;
}
private int GetExtraVariant(int i, int j)
{
return Main.tile[i, j].TileFrameNumber * extraFrameWidth;
}
/*
private int GetTileVariant(int i, int j)
{
int variant = 0; //Default to using variant 1
Tile sourceTile = Main.tile[i, j];
//Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using
int frameX = sourceTile.frameX / 18;
int frameY = sourceTile.frameY / 18;
if (frameY < 3 && !(frameX >= 6 && frameX < 9))
{
int group = 0;
int[] group1XPos = new int[] { 1, 2, 3 };
int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 };
foreach (int k in group1XPos)
{
if (frameX < k + 1 && frameX >= k)
{
group = 1;
}
}
foreach (int k in group2XPos)
{
if (frameX < k + 1 && frameX >= k)
{
group = 2;
}
}
if (group == 1)
{
if (frameX < 2)
{
variant = 0;
}
else if (frameX < 3)
{
variant = 1;
}
else
{
variant = 2;
}
}
else if (group == 2)
{
if (frameY < 1)
{
variant = 0;
}
else if (frameY < 2)
{
variant = 1;
}
else
{
variant = 2;
}
}
}
else if (frameX < 6 && frameY >= 3)
{
if (frameX < 2)
{
variant = 0;
}
else if (frameX < 4)
{
variant = 1;
}
else
{
variant = 2;
}
}
else if (frameX >= 6 && frameX < 9)
{
if (frameX < 7)
{
variant = 0;
}
else if (frameX < 8)
{
variant = 1;
}
else
{
variant = 2;
}
}
else if (frameX >= 9 && frameY >= 3)
{
if (frameX < 10)
{
variant = 0;
}
else if (frameX < 11)
{
variant = 1;
}
else
{
variant = 2;
}
}
return (variant);
}
*/
#endregion
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalactiteGiant1 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 4;
TileObjectData.newTile.Height = 8;
TileObjectData.newTile.Origin = new Point16(2, 1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.AnchorBottom = default(AnchorData);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = -3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
public class CragStalactiteGiant2 : CragStalactiteGiant1
{
}
public class CragStalactiteGiant3 : CragStalactiteGiant1
{
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,34 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalactiteLarge3 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 2;
TileObjectData.newTile.Height = 4;
TileObjectData.newTile.Origin = new Point16(1, 1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.AnchorBottom = default(AnchorData);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = -3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
}
@@ -0,0 +1,38 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalactiteLarge1 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 2;
TileObjectData.newTile.Height = 5;
TileObjectData.newTile.Origin = new Point16(1, 1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.AnchorBottom = default(AnchorData);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = -3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
public class CragStalactiteLarge2 : CragStalactiteLarge1
{
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

@@ -0,0 +1,32 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalactiteSmall3 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
TileObjectData.newTile.Origin = new Point16(1, 1);
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.AnchorBottom = default(AnchorData);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = -3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
}
@@ -0,0 +1,38 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalactiteSmall1 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 2;
TileObjectData.newTile.Height = 3;
TileObjectData.newTile.Origin = new Point16(1, 1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.AnchorBottom = default(AnchorData);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = -3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
public class CragStalactiteSmall2 : CragStalactiteSmall1
{
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

+41
View File
@@ -0,0 +1,41 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalagmiteGiant1 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 4;
TileObjectData.newTile.Height = 8;
TileObjectData.newTile.Origin = new Point16(2, 7);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = 3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
public class CragStalagmiteGiant2 : CragStalagmiteGiant1
{
}
public class CragStalagmiteGiant3 : CragStalagmiteGiant1
{
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 B

@@ -0,0 +1,33 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalagmiteLarge3 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 2;
TileObjectData.newTile.Height = 4;
TileObjectData.newTile.Origin = new Point16(1, 3);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = 3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
}
@@ -0,0 +1,37 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalagmiteLarge1 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 2;
TileObjectData.newTile.Height = 5;
TileObjectData.newTile.Origin = new Point16(1, 4);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = 3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
public class CragStalagmiteLarge2 : CragStalagmiteLarge1
{
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

@@ -0,0 +1,31 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalagmiteSmall3 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
TileObjectData.newTile.Origin = new Point16(1, 1);
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = 3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
}
@@ -0,0 +1,37 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Enums;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Tiles.Crags.Spike
{
public class CragStalagmiteSmall1 : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileSolid[Type] = false;
TileObjectData.newTile.Width = 2;
TileObjectData.newTile.Height = 3;
TileObjectData.newTile.Origin = new Point16(1, 2);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 };
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.DrawYOffset = 3;
TileObjectData.addTile(Type);
AddMapEntry(new Color(43, 23, 46));
DustType = 155;
HitSound = SoundID.Tink;
}
}
public class CragStalagmiteSmall2 : CragStalagmiteSmall1
{
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Loaded 100 of 145 files, more files were not shown because too many files have changed in this diff. Show more