Merge branch '1.4.4' of https://github.com/CalamityTeam/CalamityMod into 1.4.4
This commit is contained in:
commit
636a2c6b00
5 files changed
+122
-172
No files matched your search
@@ -72,8 +72,8 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
|
||||
"CosmaticMango",
|
||||
"CrabBar",
|
||||
"Dia",
|
||||
"DylanDoe21",
|
||||
"enamoured",
|
||||
"ENNWAY",
|
||||
"Fluffi",
|
||||
"HaguriHat",
|
||||
"Heart Plus Up!",
|
||||
@@ -94,7 +94,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
|
||||
"Shayy",
|
||||
"Spider Prov",
|
||||
"StipulateVenus",
|
||||
"Tomat",
|
||||
"Triangle",
|
||||
"Uncle Danny",
|
||||
"Xyk",
|
||||
@@ -126,10 +125,10 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
|
||||
"Doog",
|
||||
"drh",
|
||||
"dwshin",
|
||||
"DylanDoe21",
|
||||
"Earth",
|
||||
"EchoDuck",
|
||||
"Ein",
|
||||
"ENNWAY",
|
||||
"Enreden",
|
||||
"Epsilon",
|
||||
"Fargowilta",
|
||||
@@ -191,6 +190,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
|
||||
"ThousandFields",
|
||||
"TikiWiki",
|
||||
"Tinymanx",
|
||||
"Tomat",
|
||||
"Trivaxy",
|
||||
"Uberransy",
|
||||
"Vaikyia",
|
||||
|
||||
@@ -44,10 +44,15 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
if (Main.myPlayer == player.whoAmI)
|
||||
player.Calamity().rightClickListener = true;
|
||||
var calPlayer = player.Calamity();
|
||||
|
||||
if (player.Calamity().mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType<CondemnationHoldout>()] <= 0)
|
||||
if (Main.myPlayer == player.whoAmI)
|
||||
{
|
||||
calPlayer.rightClickListener = true;
|
||||
calPlayer.mouseRotationListener = true;
|
||||
}
|
||||
|
||||
if (calPlayer.mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType<CondemnationHoldout>()] <= 0)
|
||||
{
|
||||
Item.noUseGraphic = false;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
writer.Write(Projectile.rotation);
|
||||
writer.Write(KeepRefreshingLifetime);
|
||||
writer.Write(OffsetLengthFromArm);
|
||||
writer.Write(Projectile.spriteDirection);
|
||||
writer.Write7BitEncodedInt(Projectile.spriteDirection);
|
||||
SendExtraAIHoldout(writer);
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
Projectile.rotation = reader.ReadSingle();
|
||||
KeepRefreshingLifetime = reader.ReadBoolean();
|
||||
OffsetLengthFromArm = reader.ReadSingle();
|
||||
Projectile.spriteDirection = reader.ReadInt32();
|
||||
Projectile.spriteDirection = reader.Read7BitEncodedInt();
|
||||
ReceiveExtraAIHoldout(reader);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class AdamantiteAcceleratorHoldout : ModProjectile
|
||||
public class AdamantiteAcceleratorHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName<AdamantiteParticleAccelerator>();
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Ranged/AdamantiteParticleAccelerator";
|
||||
const float maxTimeAnim = 35;
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public float Timer => maxTimeAnim - Projectile.timeLeft;
|
||||
public override int AssociatedItemID => ItemType<AdamantiteParticleAccelerator>();
|
||||
public override Vector2 GunTipPosition => Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 70f + (Vector2.UnitY * -12f * Owner.direction).RotatedBy(Projectile.rotation);
|
||||
public override float MaxOffsetLengthFromArm => base.MaxOffsetLengthFromArm;
|
||||
public override float OffsetXUpwards => base.OffsetXUpwards;
|
||||
public override float OffsetXDownwards => base.OffsetXDownwards;
|
||||
public override float BaseOffsetY => base.BaseOffsetY;
|
||||
public override float OffsetYUpwards => base.OffsetYUpwards;
|
||||
public override float OffsetYDownwards => base.OffsetYDownwards;
|
||||
|
||||
public ref float ChargeTimer => ref Projectile.ai[0];
|
||||
public ref float DelayTimer => ref Projectile.ai[1];
|
||||
public ref float ChargeRate => ref Projectile.localAI[0];
|
||||
public ref float BounceBackPower => ref Projectile.localAI[1];
|
||||
public Vector2 NuzzlePosition => Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 70f + (Vector2.UnitY * -12f * Owner.direction).RotatedBy(Projectile.rotation);
|
||||
|
||||
private SlotId ChargeupSoundSlot;
|
||||
|
||||
public override void SetDefaults()
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
Projectile.width = 54;
|
||||
Projectile.height = 52;
|
||||
// This projectile has no hitboxes and no damage type.
|
||||
Projectile.friendly = false;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 900;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
int maxTime = AdamantiteParticleAccelerator.ChargeFrames + AdamantiteParticleAccelerator.CooldownFrames;
|
||||
if (ChargeTimer > maxTime)
|
||||
{
|
||||
if (!Owner.CantUseHoldout())
|
||||
ResetToStart();
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ChargeTimer is a time-dilated frame counter. DelayTimer is the frame counter for when the beams are fired.
|
||||
// ChargeRate is the rate at which the "frame" counter increases. BounceBackPower is there for the visuals of the gun recoiling in the players hands.
|
||||
public override void AI()
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
|
||||
Projectile.rotation = Owner.MountedCenter.AngleTo(Owner.Calamity().mouseWorld);
|
||||
|
||||
// Calculate how quickly the gun should charge. Charge increases by some number close to 1 every frame.
|
||||
// Speed increasing reforges make this number greater than 1. Slowing reforges make it smaller than 1.
|
||||
if (ChargeRate == 0f)
|
||||
ChargeRate = 44f / player.ActiveItem().useTime;
|
||||
ChargeRate = 44f / HeldItem.useTime;
|
||||
|
||||
if (ChargeTimer == 0f)
|
||||
ChargeupSoundSlot = SoundEngine.PlaySound(SoundID.DD2_WitherBeastAuraPulse with { Volume = SoundID.DD2_WitherBeastAuraPulse.Volume * 1.6f }, Projectile.Center);
|
||||
@@ -69,24 +69,10 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
// Increment the timer for the gun. If the timer has passed 44, destroy it.
|
||||
ChargeTimer += ChargeRate;
|
||||
int maxTime = AdamantiteParticleAccelerator.ChargeFrames + AdamantiteParticleAccelerator.CooldownFrames;
|
||||
if (ChargeTimer > maxTime)
|
||||
{
|
||||
if (Owner.channel)
|
||||
ResetToStart();
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the weapon's charge.
|
||||
float chargeLevel = MathHelper.Clamp(Projectile.ai[0] / AdamantiteParticleAccelerator.ChargeFrames, 0f, 1f);
|
||||
|
||||
// Common code among holdouts to keep the holdout projectile directly in the player's hand
|
||||
UpdatePlayerVisuals(player, rrp);
|
||||
|
||||
// Firing or charging?
|
||||
if (chargeLevel >= 1f)
|
||||
{
|
||||
@@ -96,8 +82,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
FiringEffects(new Color(235, 40, 121));
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile redLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), NuzzlePosition, Projectile.rotation.ToRotationVector2(), ProjectileType<AdamAcceleratorBeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 120);
|
||||
redLaser.Center = NuzzlePosition;
|
||||
Projectile redLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.rotation.ToRotationVector2(), ProjectileType<AdamAcceleratorBeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 120);
|
||||
redLaser.Center = GunTipPosition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,8 +93,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
FiringEffects(new Color(49, 161, 246));
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile blueLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), NuzzlePosition, Projectile.rotation.ToRotationVector2(), ProjectileType<AdamAcceleratorBeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, -120);
|
||||
blueLaser.Center = NuzzlePosition;
|
||||
Projectile blueLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.rotation.ToRotationVector2(), ProjectileType<AdamAcceleratorBeam>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, -120);
|
||||
blueLaser.Center = GunTipPosition;
|
||||
}
|
||||
}
|
||||
DelayTimer += 1f;
|
||||
@@ -124,27 +110,12 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public CurveSegment oversquish = new CurveSegment(SineBumpEasing, 0.7f, 0f, -0.6f);
|
||||
internal float RecoilSquish => PiecewiseAnimation(1 - MathHelper.Clamp(BounceBackPower * 2f, 0f, 1f), new CurveSegment[] { unsquish, oversquish });
|
||||
|
||||
private void UpdatePlayerVisuals(Player player, Vector2 rrp)
|
||||
{
|
||||
// Place the projectile directly into the player's hand at all times
|
||||
Projectile.Center = rrp;
|
||||
|
||||
// The gun is a holdout projectile, so change the player's variables to reflect that
|
||||
player.ChangeDir(Math.Sign(Projectile.rotation.ToRotationVector2().X));
|
||||
player.heldProj = Projectile.whoAmI;
|
||||
player.itemTime = 2;
|
||||
player.itemAnimation = 2;
|
||||
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2);
|
||||
|
||||
}
|
||||
|
||||
private void FiringEffects(Color color)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item92, NuzzlePosition);
|
||||
SoundEngine.PlaySound(SoundID.Item60, NuzzlePosition);
|
||||
SoundEngine.PlaySound(SoundID.Item92, GunTipPosition);
|
||||
SoundEngine.PlaySound(SoundID.Item60, GunTipPosition);
|
||||
|
||||
Particle pulse = new DirectionalPulseRing(NuzzlePosition + Projectile.rotation.ToRotationVector2() * 5f, Vector2.Zero, color, new Vector2(0.5f, 1f), Projectile.rotation, 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30);
|
||||
Particle pulse = new DirectionalPulseRing(GunTipPosition + Projectile.rotation.ToRotationVector2() * 5f, Vector2.Zero, color, new Vector2(0.5f, 1f), Projectile.rotation, 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
|
||||
if (Owner == Main.LocalPlayer && Owner.Calamity().GeneralScreenShakePower < 5)
|
||||
@@ -174,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreKill(int timeLeft)
|
||||
{
|
||||
if (Owner.channel)
|
||||
if (!Owner.CantUseHoldout())
|
||||
{
|
||||
ResetToStart();
|
||||
return false;
|
||||
@@ -185,9 +156,20 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public void ResetToStart()
|
||||
{
|
||||
Projectile.timeLeft = 900;
|
||||
ChargeTimer = 0f;
|
||||
DelayTimer = 0f;
|
||||
}
|
||||
|
||||
public override void SendExtraAIHoldout(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(ChargeRate);
|
||||
writer.Write(BounceBackPower);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAIHoldout(BinaryReader reader)
|
||||
{
|
||||
ChargeRate = reader.ReadSingle();
|
||||
BounceBackPower = reader.ReadSingle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Sounds;
|
||||
using System.IO;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class CondemnationHoldout : ModProjectile
|
||||
public class CondemnationHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Condemnation>();
|
||||
private Player Owner => Main.player[Projectile.owner];
|
||||
public override int AssociatedItemID => ModContent.ItemType<Condemnation>();
|
||||
public override float MaxOffsetLengthFromArm => 25f;
|
||||
public override float OffsetXUpwards => -5f;
|
||||
public override float BaseOffsetY => -5f;
|
||||
|
||||
private ref float CurrentChargingFrames => ref Projectile.ai[0];
|
||||
private ref float ArrowsLoaded => ref Projectile.ai[1];
|
||||
@@ -22,24 +24,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public const float velocityMultiplier = 1.2f;
|
||||
public bool homing = false;
|
||||
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Ranged/Condemnation";
|
||||
|
||||
public override void SetDefaults()
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
Projectile.width = 130;
|
||||
Projectile.height = 42;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
|
||||
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f;
|
||||
|
||||
// Fire arrows if the owner stops channeling or otherwise cannot use the weapon.
|
||||
if (Owner.CantUseHoldout())
|
||||
{
|
||||
@@ -51,65 +37,61 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
|
||||
// Fire one charged arrow every frame until you're out of arrows.
|
||||
ShootProjectiles(tipPosition, homing);
|
||||
ShootProjectiles(homing);
|
||||
--ArrowsLoaded;
|
||||
if (ArrowsLoaded == 0 && homing == true)
|
||||
homing = false;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
// Frame 1 effects: Record how fast the Condemnation item being used is, to determine how fast to load arrows.
|
||||
if (FramesToLoadNextArrow == 0f)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
||||
FramesToLoadNextArrow = HeldItem.useAnimation;
|
||||
}
|
||||
|
||||
// Frame 1 effects: Record how fast the Condemnation item being used is, to determine how fast to load arrows.
|
||||
if (FramesToLoadNextArrow == 0f)
|
||||
// If no arrows are loaded, spawn a bit of dust to indicate it's not ready yet.
|
||||
// Spawn the same dust if the max number of arrows have been loaded or the player ran out of ammos to load.
|
||||
if (ArrowsLoaded <= 0f || ArrowsLoaded >= Condemnation.MaxLoadedArrows || !Owner.HasAmmo(Owner.ActiveItem()))
|
||||
SpawnCannotLoadArrowsDust(GunTipPosition);
|
||||
|
||||
if (Owner.HasAmmo(HeldItem))
|
||||
{
|
||||
// Actually make progress towards loading more arrows.
|
||||
++CurrentChargingFrames;
|
||||
|
||||
// If it is time to load an arrow, produce a pulse of dust and add an arrow.
|
||||
// Also accelerate charging, because it's fucking awesome.
|
||||
// Take the ammo here as well
|
||||
if (CurrentChargingFrames >= FramesToLoadNextArrow && ArrowsLoaded < Condemnation.MaxLoadedArrows)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
||||
FramesToLoadNextArrow = Owner.ActiveItem().useAnimation;
|
||||
}
|
||||
// Save the stats here for later
|
||||
Owner.PickAmmo(HeldItem, out _, out float shootSpeed, out int damage, out float knockback, out _);
|
||||
Projectile.damage = damage;
|
||||
Projectile.knockBack = knockback;
|
||||
storedVelocity = shootSpeed * velocityMultiplier;
|
||||
|
||||
// If no arrows are loaded, spawn a bit of dust to indicate it's not ready yet.
|
||||
// Spawn the same dust if the max number of arrows have been loaded or the player ran out of ammos to load.
|
||||
if (ArrowsLoaded <= 0f || ArrowsLoaded >= Condemnation.MaxLoadedArrows || !Owner.HasAmmo(Owner.ActiveItem()))
|
||||
SpawnCannotLoadArrowsDust(tipPosition);
|
||||
SpawnArrowLoadedDust();
|
||||
CurrentChargingFrames = 0f;
|
||||
++ArrowsLoaded;
|
||||
--FramesToLoadNextArrow;
|
||||
|
||||
if (Owner.HasAmmo(Owner.ActiveItem()))
|
||||
{
|
||||
// Actually make progress towards loading more arrows.
|
||||
++CurrentChargingFrames;
|
||||
// Play a sound for additional notification that an arrow has been loaded.
|
||||
var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.3f });
|
||||
|
||||
// If it is time to load an arrow, produce a pulse of dust and add an arrow.
|
||||
// Also accelerate charging, because it's fucking awesome.
|
||||
// Take the ammo here as well
|
||||
if (CurrentChargingFrames >= FramesToLoadNextArrow && ArrowsLoaded < Condemnation.MaxLoadedArrows)
|
||||
if (ArrowsLoaded >= Condemnation.MaxLoadedArrows)
|
||||
{
|
||||
// Save the stats here for later
|
||||
Item heldItem = Owner.ActiveItem();
|
||||
Owner.PickAmmo(heldItem, out _, out float shootSpeed, out int damage, out float knockback, out _);
|
||||
Projectile.damage = damage;
|
||||
Projectile.knockBack = knockback;
|
||||
storedVelocity = shootSpeed * velocityMultiplier;
|
||||
|
||||
SpawnArrowLoadedDust(tipPosition);
|
||||
CurrentChargingFrames = 0f;
|
||||
++ArrowsLoaded;
|
||||
--FramesToLoadNextArrow;
|
||||
|
||||
// Play a sound for additional notification that an arrow has been loaded.
|
||||
var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.3f });
|
||||
|
||||
if (ArrowsLoaded >= Condemnation.MaxLoadedArrows)
|
||||
{
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/AbilitySounds/BrimflameRecharge"));
|
||||
homing = true;
|
||||
}
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/AbilitySounds/BrimflameRecharge"));
|
||||
homing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateProjectileHeldVariables(armPosition);
|
||||
ManipulatePlayerVariables();
|
||||
}
|
||||
|
||||
public void SpawnArrowLoadedDust(Vector2 tipPosition)
|
||||
public void SpawnArrowLoadedDust()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
@@ -126,7 +108,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Vector2 end = nextAngle.ToRotationVector2();
|
||||
for (int j = 0; j < 40; j++)
|
||||
{
|
||||
Dust starDust = Dust.NewDustPerfect(tipPosition, 267);
|
||||
Dust starDust = Dust.NewDustPerfect(GunTipPosition, 267);
|
||||
starDust.scale = 2.5f;
|
||||
starDust.velocity = Vector2.Lerp(start, end, j / 40f) * 16f;
|
||||
starDust.color = Color.Crimson;
|
||||
@@ -138,7 +120,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
Dust chargeMagic = Dust.NewDustPerfect(tipPosition, 267);
|
||||
Dust chargeMagic = Dust.NewDustPerfect(GunTipPosition, 267);
|
||||
chargeMagic.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 5f + Owner.velocity;
|
||||
chargeMagic.scale = Main.rand.NextFloat(1f, 1.5f);
|
||||
chargeMagic.color = Color.Violet;
|
||||
@@ -146,62 +128,43 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnCannotLoadArrowsDust(Vector2 tipPosition)
|
||||
public void SpawnCannotLoadArrowsDust(Vector2 GunTipPosition)
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Dust chargeMagic = Dust.NewDustPerfect(tipPosition + Main.rand.NextVector2Circular(20f, 20f), 267);
|
||||
chargeMagic.velocity = (tipPosition - chargeMagic.position) * 0.1f + Owner.velocity;
|
||||
Dust chargeMagic = Dust.NewDustPerfect(GunTipPosition + Main.rand.NextVector2Circular(20f, 20f), 267);
|
||||
chargeMagic.velocity = (GunTipPosition - chargeMagic.position) * 0.1f + Owner.velocity;
|
||||
chargeMagic.scale = Main.rand.NextFloat(1f, 1.5f);
|
||||
chargeMagic.color = Projectile.GetAlpha(Color.White);
|
||||
chargeMagic.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShootProjectiles(Vector2 tipPosition, bool homing)
|
||||
public void ShootProjectiles(bool homing)
|
||||
{
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * storedVelocity;
|
||||
int ArrowType = homing ? ModContent.ProjectileType<CondemnationArrowHoming>() : ModContent.ProjectileType<CondemnationArrow>();
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, shootVelocity, ArrowType, Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ArrowType, Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
|
||||
private void UpdateProjectileHeldVariables(Vector2 armPosition)
|
||||
public override void SendExtraAIHoldout(BinaryWriter writer)
|
||||
{
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
float interpolant = Utils.GetLerpValue(5f, 25f, Projectile.Distance(Main.MouseWorld), true);
|
||||
Vector2 oldVelocity = Projectile.velocity;
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), interpolant);
|
||||
if (Projectile.velocity != oldVelocity)
|
||||
{
|
||||
Projectile.netSpam = 0;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.position = armPosition - Projectile.Size * 0.5f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
if (Projectile.spriteDirection == -1)
|
||||
Projectile.rotation += MathHelper.Pi;
|
||||
Projectile.spriteDirection = Projectile.direction;
|
||||
Projectile.timeLeft = 2;
|
||||
writer.Write(FramesToLoadNextArrow);
|
||||
writer.Write(storedVelocity);
|
||||
writer.Write(homing);
|
||||
}
|
||||
|
||||
private void ManipulatePlayerVariables()
|
||||
public override void ReceiveExtraAIHoldout(BinaryReader reader)
|
||||
{
|
||||
Owner.ChangeDir(Projectile.direction);
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
|
||||
FramesToLoadNextArrow = reader.ReadSingle();
|
||||
storedVelocity = reader.ReadSingle();
|
||||
homing = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user