Merge pull request #1581 from CalamityTeam/generic-bug-fixes
Generic bug fixes
This commit is contained in:
21 files changed
+83
-97
No files matched your search
@@ -4812,7 +4812,7 @@ namespace CalamityMod.CalPlayer
|
||||
Player.velocity.Y = 0.5f;
|
||||
}
|
||||
else
|
||||
Player.velocity.Y = 0f;
|
||||
Player.velocity.Y = 1E-05f;
|
||||
|
||||
if (CalamityKeybinds.ExoChairSlowdownHotkey.Current)
|
||||
Player.velocity *= 0.5f;
|
||||
@@ -6053,7 +6053,10 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size * 0.4f;
|
||||
if (ProfanedMoonlightAuroraDrawer is null || ProfanedMoonlightAuroraDrawer.Size != size)
|
||||
{
|
||||
ProfanedMoonlightAuroraDrawer?.Dispose();
|
||||
ProfanedMoonlightAuroraDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f);
|
||||
}
|
||||
|
||||
int sourceArea = (int)Math.Ceiling(6f / ProfanedMoonlightAuroraDrawer.Scale) + 1;
|
||||
ProfanedMoonlightAuroraDrawer.ShouldUpdate = Player.miscCounter % 2 == 0;
|
||||
|
||||
@@ -709,7 +709,10 @@ namespace CalamityMod.ILEditing
|
||||
ref FluidField calamityFireDrawer = ref player.Calamity().CalamityFireDrawer;
|
||||
ref Vector2 firePosition = ref player.Calamity().FireDrawerPosition;
|
||||
if (calamityFireDrawer is null || calamityFireDrawer.Size != size)
|
||||
{
|
||||
calamityFireDrawer?.Dispose();
|
||||
calamityFireDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f);
|
||||
}
|
||||
|
||||
// Update the fire draw position.
|
||||
firePosition = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f;
|
||||
|
||||
@@ -394,8 +394,9 @@ namespace CalamityMod.Items
|
||||
|
||||
if (showTheTip)
|
||||
{
|
||||
var str = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"].First().ToString();
|
||||
tooltips.Insert(++lastTooltipIndex, (new TooltipLine(Mod, "CalamityMod:AltExpandTooltip", CalamityUtils.GetTextValue("Misc.AltExpand").Replace("{0}", str))));
|
||||
var bind = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"];
|
||||
string str = bind.Count == 0 ? GetTextValue("Misc.HotkeyNotBound") : bind.First().ToString();
|
||||
tooltips.Insert(++lastTooltipIndex, (new TooltipLine(Mod, "CalamityMod:AltExpandTooltip", GetTextValue("Misc.AltExpand").Replace("{0}", str))));
|
||||
tooltips[lastTooltipIndex].OverrideColor = new Color(170, 170, 170);
|
||||
}
|
||||
else if (foundDebuff)
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
Item.width = 66;
|
||||
Item.height = 82;
|
||||
Item.damage = 290;
|
||||
Item.damage = 333;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.noUseGraphic = true;
|
||||
Item.channel = true;
|
||||
|
||||
@@ -731,11 +731,7 @@ SquirrelSquireStaff: {
|
||||
|
||||
StaffOfNecrosteocytes: {
|
||||
DisplayName: Staff of Necrosteocytes
|
||||
Tooltip:
|
||||
'''
|
||||
Summons small skeletons to fight for you
|
||||
The skeletons leave behind bone cells as they move
|
||||
'''
|
||||
Tooltip: Summons small skeletons to fight for you
|
||||
}
|
||||
|
||||
StarspawnHelixStaff: {
|
||||
|
||||
@@ -184,7 +184,6 @@ PrinceFlameSmall.DisplayName: Holy Fire
|
||||
RainbowComet.DisplayName: Comet
|
||||
RainbowRocket.DisplayName: Rainbow Rocket
|
||||
RancorArm.DisplayName: Vengeful Arm
|
||||
RancorFog.DisplayName: The Fog Is Coming
|
||||
RancorLargeCinder.DisplayName: Lava Cinder
|
||||
RancorLaserbeam.DisplayName: The Angy Beam
|
||||
RancorMagicCircle.DisplayName: Magic Circle
|
||||
|
||||
@@ -7,6 +7,7 @@ using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -208,7 +209,8 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
NPC.Calamity().newAI[0]++;
|
||||
if (NPC.Calamity().newAI[0] % 5 == 0 && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType<RancorFog>(), 0, 0f, Main.myPlayer);
|
||||
RancorFog fog = new(NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
RancorLavaMetaball.SpawnParticle(NPC.Bottom + Main.rand.NextVector2Circular(10f, 10f), 135f);
|
||||
}
|
||||
if (NPC.Calamity().newAI[0] % 30 == 0 && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
|
||||
@@ -4510,8 +4510,10 @@ namespace CalamityMod.NPCs
|
||||
if (ashesOnDeath > 0)
|
||||
{
|
||||
if (Main.rand.NextBool(4))
|
||||
Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), ProjectileType<RancorFog>(), 0, 0f, Main.myPlayer, 0f, 0.475f);
|
||||
|
||||
{
|
||||
RancorFog fog = new(npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), 180, Main.rand.NextFloat(0.45f, 0.75f), Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
if (Main.rand.NextBool(6))
|
||||
{
|
||||
Vector2 randomPosition = new(npc.position.X + Main.rand.NextFloat(-10f, npc.width + 10f), npc.position.Y + Main.rand.NextFloat(-10f, npc.height + 10f));
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class RancorFog : Particle
|
||||
{
|
||||
private float Opacity = 0f;
|
||||
public override bool UseAdditiveBlend => true;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
public RancorFog(Vector2 position, Vector2 velocity, int lifetime, float scale, float rotation)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
Lifetime = lifetime;
|
||||
Scale = scale;
|
||||
Rotation = rotation;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Rotation += Velocity.X * 0.004f;
|
||||
Velocity *= 0.985f;
|
||||
Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 90f, Time, true);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D texture = GeneralParticleHandler.GetTexture(Type);
|
||||
float opacity = Opacity * 0.5f;
|
||||
Color drawColor = new Color(236, 0, 68) * opacity;
|
||||
Main.EntitySpriteDraw(texture, Position - Main.screenPosition, null, drawColor, Rotation, texture.Size() * 0.5f, Scale, SpriteEffects.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class RancorFog : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public ref float LightPower => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 184;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.timeLeft = 210;
|
||||
Projectile.hide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Decide scale and initial rotation on the first frame this projectile exists.
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
Projectile.scale = Main.rand.NextFloat(1f, 1.7f) * Projectile.ai[1];
|
||||
Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
|
||||
Projectile.rotation += Projectile.velocity.X * 0.004f;
|
||||
Projectile.velocity *= 0.985f;
|
||||
|
||||
// 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information.
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
// Calculate light power. This checks below the position of the fog to check if this fog is underground.
|
||||
// Without this, it may render over the fullblack that the game renders for obscured tiles.
|
||||
float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D);
|
||||
LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f);
|
||||
Projectile.Opacity = Utils.GetLerpValue(210f, 195f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true);
|
||||
}
|
||||
|
||||
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
|
||||
{
|
||||
behindNPCsAndTiles.Add(index);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Main.spriteBatch.SetBlendState(BlendState.Additive);
|
||||
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Vector2 origin = texture.Size() * 0.5f;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f;
|
||||
Color drawColor = new Color(236, 0, 68) * opacity;
|
||||
Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale;
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0);
|
||||
|
||||
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
// Cast the magic circle on the first frame.
|
||||
if (Main.myPlayer == Projectile.owner && Time == 1f)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<RancorMagicCircle>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<RancorMagicCircle>(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner);
|
||||
|
||||
// Handle frames.
|
||||
Projectile.frameCounter++;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -128,7 +129,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public void CreateTileHitEffects()
|
||||
{
|
||||
Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f));
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType<RancorFog>(), 0, 0f, Projectile.owner, 0f, 1f);
|
||||
RancorFog fog = new(endOfLaser, Main.rand.NextVector2Circular(4f, 8f), 180, Main.rand.NextFloat(1f, 1.7f), Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
GeneralParticleHandler.SpawnParticle(fog, false, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
SoundEngine.PlaySound(SoundID.Zombie104, Projectile.Center);
|
||||
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType<RancorLaserbeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.identity);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType<RancorLaserbeam>(), Projectile.originalDamage, Projectile.knockBack, Projectile.owner, Projectile.identity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public class AuroraFire : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog";
|
||||
public override string Texture => "CalamityMod/Particles/RancorFog";
|
||||
|
||||
public static int Lifetime => 480;
|
||||
public static int Fadetime => 450;
|
||||
|
||||
@@ -96,8 +96,14 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
// If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout.
|
||||
if (Owner.CantUseHoldout() && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f))
|
||||
// If there's no player, or the player isn't holding fire, or the player's stunned, there'll be no holdout.
|
||||
// The holdout will persist if on cooldown, but it is absolutely imperative that it can disappear if dead, CCed, etc.
|
||||
if (Owner == null || !Owner.active || Owner.dead || Owner.CCed || Owner.noItems)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
if (!Owner.channel && PostFireCooldown <= 0 && shootingTimer < (int)(Owner.itemAnimationMax * 0.8f))
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public class PristineSecondary : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog";
|
||||
public override string Texture => "CalamityMod/Particles/RancorFog";
|
||||
|
||||
public ref float ScaleFactor => ref Projectile.ai[0];
|
||||
public float LightPower = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public class AntlionSkewerSandCloud : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/RancorFog";
|
||||
public override string Texture => "CalamityMod/Particles/RancorFog";
|
||||
public ref float CloudHue => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -21,10 +21,11 @@ namespace CalamityMod.Systems
|
||||
if (ProvidenceSpawnState() == 180f)
|
||||
Main.musicFade[ProvidenceTrack] = 1f;
|
||||
}
|
||||
|
||||
public static float ProvidenceSpawnState()
|
||||
{
|
||||
int provIndex = CalamityGlobalNPC.holyBoss;
|
||||
if (provIndex < 0 || provIndex >= Main.maxNPCs || !Main.npc[provIndex].active)
|
||||
if (!Main.npc.IndexInRange(provIndex))
|
||||
return -1f;
|
||||
|
||||
var prov = Main.npc[provIndex];
|
||||
|
||||
@@ -93,18 +93,18 @@ namespace CalamityMod.Tiles.Furniture.Paintings
|
||||
var t = Main.tile[i, j];
|
||||
var texture = TextureAssets.Tile[Type].Value;
|
||||
var cube = CalamityUtils.FindTileEntity<TECanvasPainting>(i, j, 1, 1);
|
||||
|
||||
var pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset;
|
||||
if (cube != null && t.TileFrameX == 0)
|
||||
{
|
||||
var fPX = (int)cube.framePosition.X;
|
||||
var fPY = (int)cube.framePosition.Y;
|
||||
var scale = (int)(texture.Width * 0.1f * cube.scale);
|
||||
var rasterizer = Main.LocalPlayer.gravDir == -1f ? RasterizerState.CullNone : Main.Rasterizer;
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, rasterizer, null);
|
||||
spriteBatch.Draw(texture, pos - Main.screenPosition, new Rectangle(fPX, fPY, scale, scale), Lighting.GetColor(i, j), 0, new Vector2(0, 0), 1 / cube.scale * Scale, 0, 0);
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, null);
|
||||
spriteBatch.Begin();
|
||||
}
|
||||
// Calculate and draw the borders
|
||||
if (t.TileFrameX == 0 && t.TileFrameY == 0)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CalamityMod.World
|
||||
|
||||
public class SolidOrPlatform : GenCondition
|
||||
{
|
||||
protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(x, y);
|
||||
protected override bool CheckValidity(int x, int y) => TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(x, y).TileType] || WorldGen.SolidTile(Framing.GetTileSafely(x, y));
|
||||
}
|
||||
|
||||
public class IsNotTouchingAir : GenCondition
|
||||
|
||||
Reference in new issue
Block a user