Ported Astral Solution conversions
This commit is contained in:
1 parent
c561b71521
commit
f2c13839e7
3 files changed
+124
-53
No files matched your search
@@ -20,10 +20,5 @@ namespace CalamityMod.Items.Ammo
|
||||
{
|
||||
itemGroup = ContentSamples.CreativeHelper.ItemGroup.Solutions;
|
||||
}
|
||||
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
{
|
||||
return !(player.itemAnimation < player.ActiveItem().useAnimation - 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -10,69 +11,50 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
public bool ShotFromTerraformer => Projectile.ai[1] == 1f;
|
||||
|
||||
public static int ConversionType;
|
||||
public override void SetStaticDefaults() => ConversionType = ModContent.GetInstance<AstralConversion>().Type;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 16;
|
||||
Projectile.height = 16;
|
||||
Projectile.aiStyle = -1;
|
||||
Projectile.friendly = true;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DefaultToSpray();
|
||||
Projectile.aiStyle = 0;
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override bool PreAI()
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.timeLeft > 133)
|
||||
Projectile.timeLeft = 133;
|
||||
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
int x = (int)(Projectile.Center.X / 16f);
|
||||
int y = (int)(Projectile.Center.Y / 16f);
|
||||
int size = ShotFromTerraformer ? 3 : 2;
|
||||
Point tileCenter = Projectile.Center.ToTileCoordinates();
|
||||
WorldGen.Convert(tileCenter.X, tileCenter.Y, ConversionType, size);
|
||||
}
|
||||
|
||||
AstralBiome.ConvertToAstral(x - 1, x + 1, y - 1, y + 1);
|
||||
}
|
||||
if (Projectile.timeLeft > 133)
|
||||
float dustStart = ShotFromTerraformer ? 3f : 7f;
|
||||
if (Time > dustStart)
|
||||
{
|
||||
Projectile.timeLeft = 133;
|
||||
}
|
||||
if (Projectile.ai[0] > 7f)
|
||||
{
|
||||
float scalar = 1f;
|
||||
if (Projectile.ai[0] == 8f)
|
||||
float dustScale = Utils.Remap(Time, dustStart + 1f, dustStart + 5f, 0.2f, 1f);
|
||||
int dustArea = 0;
|
||||
if (ShotFromTerraformer)
|
||||
{
|
||||
scalar = 0.2f;
|
||||
dustScale *= 1.2f;
|
||||
dustArea = (int)(12f * dustScale);
|
||||
}
|
||||
else if (Projectile.ai[0] == 9f)
|
||||
{
|
||||
scalar = 0.4f;
|
||||
}
|
||||
else if (Projectile.ai[0] == 10f)
|
||||
{
|
||||
scalar = 0.6f;
|
||||
}
|
||||
else if (Projectile.ai[0] == 11f)
|
||||
{
|
||||
scalar = 0.8f;
|
||||
}
|
||||
Projectile.ai[0]++;
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Ice_Purple, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100);
|
||||
Main.dust[d].noGravity = true;
|
||||
Main.dust[d].scale *= 1.75f * scalar;
|
||||
Main.dust[d].velocity.X *= 2f;
|
||||
Main.dust[d].velocity.Y *= 2f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.ai[0]++;
|
||||
|
||||
Dust spray = Dust.NewDustDirect(Projectile.position - Vector2.One * dustArea, Projectile.width + dustArea * 2, Projectile.height + dustArea * 2, DustID.Ice_Purple, Projectile.velocity.X * 0.4f, Projectile.velocity.Y * 0.4f, 100);
|
||||
spray.noGravity = true;
|
||||
spray.scale *= 1.75f * dustScale;
|
||||
}
|
||||
|
||||
Time++;
|
||||
Projectile.rotation += 0.3f * Projectile.direction;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.Tiles.Astral;
|
||||
using CalamityMod.Tiles.AstralDesert;
|
||||
using CalamityMod.Tiles.AstralSnow;
|
||||
using CalamityMod.Tiles.FurnitureMonolith;
|
||||
using CalamityMod.Tiles.Ores;
|
||||
using CalamityMod.Walls;
|
||||
using CalamityMod.Walls.UnsafeWalls;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.World
|
||||
{
|
||||
public class AstralConversion : ModBiomeConversion
|
||||
{
|
||||
public static int GrassType;
|
||||
public static int DirtType;
|
||||
public static int StoneType;
|
||||
public static int SandType;
|
||||
public static int SandstoneType;
|
||||
public static int HardenedSandType;
|
||||
public static int SnowType;
|
||||
public static int IceType;
|
||||
public static int ClayType;
|
||||
public static int SiltType;
|
||||
public static int FossilType;
|
||||
public static int WoodType;
|
||||
public static int OreType;
|
||||
|
||||
public static int GrassWallType;
|
||||
public static int DirtWallType;
|
||||
public static int StoneWallType;
|
||||
public static int SnowWallType;
|
||||
public static int IceWallType;
|
||||
public static int SandstoneWallType;
|
||||
public static int HardenedSandWallType;
|
||||
public static int FossilWallType;
|
||||
public static int WoodWallType;
|
||||
|
||||
public override void PostSetupContent()
|
||||
{
|
||||
GrassType = TileType<AstralGrass>();
|
||||
DirtType = TileType<AstralDirt>();
|
||||
StoneType = TileType<AstralStone>();
|
||||
SnowType = TileType<AstralSnow>();
|
||||
IceType = TileType<AstralIce>();
|
||||
SandType = TileType<AstralSand>();
|
||||
SandstoneType = TileType<AstralSandstone>();
|
||||
HardenedSandType = TileType<HardenedAstralSand>();
|
||||
ClayType = TileType<AstralClay>();
|
||||
SiltType = TileType<NovaeSlag>();
|
||||
FossilType = TileType<CelestialRemains>();
|
||||
WoodType = TileType<AstralMonolith>();
|
||||
OreType = TileType<AstralOre>();
|
||||
|
||||
DirtWallType = WallType<UnsafeAstralDirtWall>();
|
||||
GrassWallType = WallType<UnsafeAstralGrassWall>();
|
||||
StoneWallType = WallType<UnsafeAstralStoneWall>();
|
||||
SnowWallType = WallType<UnsafeAstralSnowWall>();
|
||||
IceWallType = WallType<UnsafeAstralIceWall>();
|
||||
SandstoneWallType = WallType<UnsafeAstralSandstoneWall>();
|
||||
HardenedSandWallType = WallType<UnsafeHardenedAstralSandWall>();
|
||||
FossilWallType = WallType<CelestialRemainsWall>();
|
||||
WoodWallType = WallType<AstralMonolithWall>();
|
||||
|
||||
TileLoader.RegisterSimpleConversion(TileID.Grass, Type, GrassType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.Dirt, Type, DirtType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.Stone, Type, StoneType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.SnowBlock, Type, SnowType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.IceBlock, Type, IceType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.Sand, Type, SandType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.Sandstone, Type, SandstoneType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.HardenedSand, Type, HardenedSandType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.ClayBlock, Type, ClayType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.Silt, Type, SiltType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.DesertFossil, Type, FossilType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.LivingWood, Type, WoodType);
|
||||
TileLoader.RegisterSimpleConversion(TileID.Meteorite, Type, OreType);
|
||||
|
||||
WallLoader.RegisterSimpleConversion(WallID.GrassUnsafe, Type, GrassWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.DirtUnsafe, Type, DirtWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.Stone, Type, StoneWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.SnowWallUnsafe, Type, SnowWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.IceUnsafe, Type, IceWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.Sandstone, Type, SandstoneWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.HardenedSand, Type, HardenedSandWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.DesertFossil, Type, FossilWallType);
|
||||
WallLoader.RegisterSimpleConversion(WallID.LivingWoodUnsafe, Type, WoodWallType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user