Selection panel
No files matched your search
@@ -1,7 +1,4 @@
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
|
||||
|
After Width: | Height: | Size: 165 B |
@@ -11,17 +11,35 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public abstract class ExoskeletonCannon : ModProjectile
|
||||
{
|
||||
public int HoverOffsetIndex => (int)Projectile.ai[0];
|
||||
|
||||
public bool TargetingSomething => Projectile.ai[1] == 1f;
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public LimbCollection Limbs = new(new CyclicCoordinateDescentUpdateRule(0.27f, MathHelper.PiOver2), 70f, 82f);
|
||||
|
||||
public static readonly Vector2[] HoverOffsetTable = new Vector2[]
|
||||
{
|
||||
new(300f, 96f),
|
||||
new(-300f, 96f),
|
||||
new(190f, -102f),
|
||||
new(-190f, -102f)
|
||||
};
|
||||
|
||||
public static readonly float[] RotationalClampTable = new float[]
|
||||
{
|
||||
0.23f,
|
||||
MathHelper.Pi - 0.23f,
|
||||
0.2f,
|
||||
MathHelper.Pi - 0.2f
|
||||
};
|
||||
|
||||
public virtual bool UsesSuperpredictiveness => false;
|
||||
|
||||
public virtual Vector2 DrawOffset => new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 6f, -6f);
|
||||
|
||||
public virtual Vector2 ConnectOffset => Vector2.Zero;
|
||||
public virtual Vector2 ConnectOffset => HoverOffsetIndex >= 2 ? new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 14f, -30f) : Vector2.Zero;
|
||||
|
||||
public abstract int ShootRate { get; }
|
||||
|
||||
|
||||
@@ -15,19 +15,14 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
|
||||
public ref float RebuildTimer => ref Projectile.localAI[0];
|
||||
|
||||
public override Vector2 ConnectOffset => new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 14f, -30f);
|
||||
|
||||
public override int ShootRate => AresExoskeleton.GaussNukeShootRate;
|
||||
|
||||
public override float ShootSpeed => 16f;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => new(-190f, -102f);
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation)
|
||||
{
|
||||
limbRotation = MathHelper.Pi - 0.2f;
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gauss Nuke");
|
||||
|
||||
@@ -5,28 +5,24 @@ using Terraria.Audio;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Sounds;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using System.IO;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonLaserCannon : ExoskeletonCannon
|
||||
{
|
||||
public ref float ShootCounter => ref Projectile.ai[0];
|
||||
public ref float ShootCounter => ref Projectile.localAI[0];
|
||||
|
||||
// This is how many small, regular lasers will happen before the laser will charge up and prepare a laserbeam.
|
||||
public const int NormalLasersBeforeBeam = 6;
|
||||
|
||||
public override Vector2 ConnectOffset => new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 14f, -30f);
|
||||
|
||||
|
||||
public override int ShootRate => ShootCounter % NormalLasersBeforeBeam == 0f ? 150 : AresExoskeleton.LaserCannonNormalShootRate;
|
||||
|
||||
public override float ShootSpeed => 13.5f;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => new(190f, -102f);
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation)
|
||||
{
|
||||
limbRotation = -0.2f;
|
||||
}
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -34,6 +30,10 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
Main.projFrames[Type] = 6;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer) => writer.Write(ShootCounter);
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader) => ShootCounter = reader.ReadSingle();
|
||||
|
||||
public override void ShootAtTarget(NPC target, Vector2 shootDirection)
|
||||
{
|
||||
// Play the laser cannon fire sound.
|
||||
|
||||
@@ -6,23 +6,118 @@ using Terraria.ID;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Audio;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonPanel : ModProjectile
|
||||
{
|
||||
public int ArmIDToDelete = -1;
|
||||
public enum IconType
|
||||
{
|
||||
Inactive,
|
||||
Plasma,
|
||||
Tesla,
|
||||
Laser,
|
||||
Gauss
|
||||
}
|
||||
|
||||
public class IconState
|
||||
{
|
||||
public int PanelFlashTimer;
|
||||
|
||||
public int MousePressFrameCountdown;
|
||||
|
||||
public bool BeingHoveredOver;
|
||||
|
||||
public bool PlacedInPanel;
|
||||
|
||||
public IconType CurrentState;
|
||||
|
||||
public Texture2D IconTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
Texture2D plasmaTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma").Value;
|
||||
Texture2D teslaTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelTesla").Value;
|
||||
Texture2D laserTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelLaser").Value;
|
||||
Texture2D gaussTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelGauss").Value;
|
||||
return CurrentState switch
|
||||
{
|
||||
IconType.Plasma => plasmaTexture,
|
||||
IconType.Tesla => teslaTexture,
|
||||
IconType.Laser => laserTexture,
|
||||
IconType.Gauss => gaussTexture,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle Frame
|
||||
{
|
||||
get
|
||||
{
|
||||
int frame = 0;
|
||||
if (BeingHoveredOver)
|
||||
frame = PlacedInPanel ? 3 : 1;
|
||||
if (MousePressFrameCountdown >= 1)
|
||||
frame = 2;
|
||||
if (PanelFlashTimer >= 1)
|
||||
frame = (int)Math.Round(MathHelper.Lerp(4f, 6f, PanelFlashTimer / 24f));
|
||||
|
||||
return IconTexture?.Frame(1, 7, 0, frame) ?? default;
|
||||
}
|
||||
}
|
||||
|
||||
public IconState(bool hover, bool panel, IconType state)
|
||||
{
|
||||
BeingHoveredOver = hover;
|
||||
PlacedInPanel = panel;
|
||||
CurrentState = state;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (PanelFlashTimer >= 1)
|
||||
PanelFlashTimer++;
|
||||
if (PanelFlashTimer >= 18)
|
||||
PanelFlashTimer = 0;
|
||||
|
||||
if (MousePressFrameCountdown > 0)
|
||||
MousePressFrameCountdown--;
|
||||
}
|
||||
}
|
||||
|
||||
public IconType ClickedIcon = IconType.Inactive;
|
||||
|
||||
public IconState[] SelectionIcons = new IconState[]
|
||||
{
|
||||
new(false, false, IconType.Plasma),
|
||||
new(false, false, IconType.Tesla),
|
||||
new(false, false, IconType.Laser),
|
||||
new(false, false, IconType.Gauss),
|
||||
};
|
||||
|
||||
public IconState[] PanelIcons = new IconState[]
|
||||
{
|
||||
new(false, true, IconType.Inactive),
|
||||
new(false, true, IconType.Inactive),
|
||||
new(false, true, IconType.Inactive),
|
||||
new(false, true, IconType.Inactive),
|
||||
};
|
||||
|
||||
public bool ShouldDeleteArmIndex = false;
|
||||
|
||||
public int ArmIDToSpawn = -1;
|
||||
|
||||
public int ArmIndex = -1;
|
||||
|
||||
public bool FadeOut => Projectile.ai[0] == 1f;
|
||||
|
||||
public Vector2 PlayerOffset;
|
||||
|
||||
public static Rectangle MouseRectangle => new((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2);
|
||||
|
||||
public static readonly Color HoverColor = Color.Cyan;
|
||||
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("UI");
|
||||
@@ -42,9 +137,42 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
int plasmaCannonID = ModContent.ProjectileType<ExoskeletonPlasmaCannon>();
|
||||
int teslaCannonID = ModContent.ProjectileType<ExoskeletonTeslaCannon>();
|
||||
int laserCannonID = ModContent.ProjectileType<ExoskeletonLaserCannon>();
|
||||
int gaussNukeID = ModContent.ProjectileType<ExoskeletonGaussNukeCannon>();
|
||||
int[] arms = new int[]
|
||||
{
|
||||
plasmaCannonID,
|
||||
teslaCannonID,
|
||||
laserCannonID,
|
||||
gaussNukeID,
|
||||
};
|
||||
|
||||
// Initialize things.
|
||||
if (PlayerOffset == Vector2.Zero)
|
||||
PlayerOffset = Main.MouseWorld - Main.LocalPlayer.Center;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
PanelIcons[i].CurrentState = IconType.Inactive;
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active)
|
||||
continue;
|
||||
|
||||
IconType stateFromID = IconType.Inactive;
|
||||
if (Main.projectile[i].type == plasmaCannonID)
|
||||
stateFromID = IconType.Plasma;
|
||||
if (Main.projectile[i].type == teslaCannonID)
|
||||
stateFromID = IconType.Tesla;
|
||||
if (Main.projectile[i].type == laserCannonID)
|
||||
stateFromID = IconType.Laser;
|
||||
if (Main.projectile[i].type == gaussNukeID)
|
||||
stateFromID = IconType.Gauss;
|
||||
|
||||
PanelIcons[(int)Main.projectile[i].ai[0]].CurrentState = stateFromID;
|
||||
}
|
||||
|
||||
// Handle fade effects.
|
||||
Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity - FadeOut.ToDirectionInt() * 0.0225f, 0f, 1f);
|
||||
if (FadeOut && Projectile.Opacity <= 0f)
|
||||
@@ -57,24 +185,25 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
if (ArmIDToSpawn >= 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Zombie66, Projectile.Center);
|
||||
int cannon = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, Vector2.Zero, ArmIDToSpawn, Projectile.damage, 0f, Projectile.owner);
|
||||
int cannon = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, Vector2.Zero, ArmIDToSpawn, Projectile.damage, 0f, Projectile.owner, ArmIndex);
|
||||
if (Main.projectile.IndexInRange(cannon))
|
||||
Main.projectile[cannon].originalDamage = Projectile.originalDamage;
|
||||
}
|
||||
if (ArmIDToDelete >= 0)
|
||||
if (ShouldDeleteArmIndex)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (Main.projectile[i].type != ArmIDToDelete || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active)
|
||||
if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active || Main.projectile[i].ai[0] != ArmIndex)
|
||||
continue;
|
||||
|
||||
|
||||
Main.projectile[i].Kill();
|
||||
}
|
||||
}
|
||||
|
||||
ArmIDToDelete = -1;
|
||||
ShouldDeleteArmIndex = false;
|
||||
ArmIDToSpawn = -1;
|
||||
ArmIndex = -1;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
@@ -83,108 +212,126 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return false;
|
||||
|
||||
int plasmaCannonID = ModContent.ProjectileType<ExoskeletonPlasmaCannon>();
|
||||
int teslaCannonID = ModContent.ProjectileType<ExoskeletonTeslaCannon>();
|
||||
int laserCannonID = ModContent.ProjectileType<ExoskeletonLaserCannon>();
|
||||
int gaussNukeID = ModContent.ProjectileType<ExoskeletonGaussNukeCannon>();
|
||||
Texture2D panelTexture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Texture2D cancelTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelCancel").Value;
|
||||
Texture2D plasmaTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma").Value;
|
||||
Texture2D teslaTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelTesla").Value;
|
||||
Texture2D laserTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelLaser").Value;
|
||||
Texture2D gaussTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelGauss").Value;
|
||||
Texture2D arrowTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/Arrow").Value;
|
||||
Vector2 area = plasmaTexture.Frame(1, 7, 0, 0).Size();
|
||||
Vector2 drawPosition = (Main.LocalPlayer.Center + PlayerOffset - Main.screenPosition).Floor();
|
||||
if (Main.LocalPlayer.ownedProjectileCounts[plasmaCannonID] >= 1)
|
||||
plasmaTexture = cancelTexture;
|
||||
if (Main.LocalPlayer.ownedProjectileCounts[teslaCannonID] >= 1)
|
||||
teslaTexture = cancelTexture;
|
||||
if (Main.LocalPlayer.ownedProjectileCounts[laserCannonID] >= 1)
|
||||
laserTexture = cancelTexture;
|
||||
if (Main.LocalPlayer.ownedProjectileCounts[gaussNukeID] >= 1)
|
||||
gaussTexture = cancelTexture;
|
||||
|
||||
Color plasmaColor = Color.White;
|
||||
Color teslaColor = Color.White;
|
||||
Color laserColor = Color.White;
|
||||
Color gaussColor = Color.White;
|
||||
Rectangle plasmaIconArea = Utils.CenteredRectangle(drawPosition + new Vector2(-66f, 10f) * Projectile.scale, plasmaTexture.Size() * Projectile.scale);
|
||||
Rectangle teslaIconArea = Utils.CenteredRectangle(drawPosition + new Vector2(-26f, 10f) * Projectile.scale, plasmaTexture.Size() * Projectile.scale);
|
||||
Rectangle laserIconArea = Utils.CenteredRectangle(drawPosition + new Vector2(26f, 10f) * Projectile.scale, plasmaTexture.Size() * Projectile.scale);
|
||||
Rectangle gaussIconArea = Utils.CenteredRectangle(drawPosition + new Vector2(66f, 10f) * Projectile.scale, plasmaTexture.Size() * Projectile.scale);
|
||||
Rectangle[] selectionIconAreas = new Rectangle[4]
|
||||
{
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(-62f, -70f) * Projectile.scale, area * Projectile.scale),
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(-22f, -70f) * Projectile.scale, area * Projectile.scale),
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(22f, -70f) * Projectile.scale, area * Projectile.scale),
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(62f, -70f) * Projectile.scale, area * Projectile.scale)
|
||||
};
|
||||
|
||||
// Handle hover behaviors. If an arm needs to be destroyed or spawned, it will happen on the next frame.
|
||||
bool hoveringOverAnySlot = false;
|
||||
bool clickedAnIconOnPanel = false;
|
||||
bool sufficientSlots = Main.LocalPlayer.maxMinions >= AresExoskeleton.MinionSlotsPerCannon;
|
||||
if (MouseRectangle.Intersects(plasmaIconArea))
|
||||
{
|
||||
Main.blockMouse = true;
|
||||
hoveringOverAnySlot = true;
|
||||
plasmaColor = HoverColor;
|
||||
if (Main.mouseLeftRelease && Main.mouseLeft)
|
||||
{
|
||||
if (plasmaTexture == cancelTexture)
|
||||
ArmIDToDelete = plasmaCannonID;
|
||||
else if (sufficientSlots)
|
||||
ArmIDToSpawn = plasmaCannonID;
|
||||
}
|
||||
}
|
||||
if (MouseRectangle.Intersects(teslaIconArea))
|
||||
{
|
||||
Main.blockMouse = true;
|
||||
hoveringOverAnySlot = true;
|
||||
teslaColor = HoverColor;
|
||||
if (Main.mouseLeftRelease && Main.mouseLeft)
|
||||
{
|
||||
if (teslaTexture == cancelTexture)
|
||||
ArmIDToDelete = teslaCannonID;
|
||||
else if (sufficientSlots)
|
||||
ArmIDToSpawn = teslaCannonID;
|
||||
}
|
||||
}
|
||||
if (MouseRectangle.Intersects(laserIconArea))
|
||||
{
|
||||
Main.blockMouse = true;
|
||||
hoveringOverAnySlot = true;
|
||||
laserColor = HoverColor;
|
||||
if (Main.mouseLeftRelease && Main.mouseLeft)
|
||||
{
|
||||
if (laserTexture == cancelTexture)
|
||||
ArmIDToDelete = laserCannonID;
|
||||
else if (sufficientSlots)
|
||||
ArmIDToSpawn = laserCannonID;
|
||||
}
|
||||
}
|
||||
if (MouseRectangle.Intersects(gaussIconArea))
|
||||
{
|
||||
Main.blockMouse = true;
|
||||
hoveringOverAnySlot = true;
|
||||
gaussColor = HoverColor;
|
||||
if (Main.mouseLeftRelease && Main.mouseLeft)
|
||||
{
|
||||
if (gaussTexture == cancelTexture)
|
||||
ArmIDToDelete = gaussNukeID;
|
||||
else if (sufficientSlots)
|
||||
ArmIDToSpawn = gaussNukeID;
|
||||
}
|
||||
}
|
||||
|
||||
plasmaColor = Projectile.GetAlpha(plasmaColor);
|
||||
teslaColor = Projectile.GetAlpha(teslaColor);
|
||||
laserColor = Projectile.GetAlpha(laserColor);
|
||||
gaussColor = Projectile.GetAlpha(gaussColor);
|
||||
// Draw icon and handle hover behaviors.
|
||||
// If an arm needs to be destroyed or spawned, it will happen on the next frame in the AI update loop.
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Texture2D selectionIconTexture = SelectionIcons[i].IconTexture;
|
||||
|
||||
// Handle selection icon click stuff.
|
||||
SelectionIcons[i].BeingHoveredOver = false;
|
||||
PanelIcons[i].BeingHoveredOver = false;
|
||||
if (selectionIconAreas[i].Intersects(MouseRectangle))
|
||||
{
|
||||
hoveringOverAnySlot = true;
|
||||
SelectionIcons[i].BeingHoveredOver = true;
|
||||
if (Main.mouseLeft && Main.mouseLeftRelease)
|
||||
{
|
||||
ClickedIcon = SelectionIcons[i].CurrentState;
|
||||
SelectionIcons[i].MousePressFrameCountdown = 15;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle panel icon click stuff.
|
||||
Rectangle panelArea = selectionIconAreas[i];
|
||||
panelArea.Y += (int)(Projectile.scale * 78f);
|
||||
if (panelArea.Intersects(MouseRectangle))
|
||||
{
|
||||
hoveringOverAnySlot = true;
|
||||
PanelIcons[i].BeingHoveredOver = true;
|
||||
if (Main.mouseLeft && Main.mouseLeftRelease && sufficientSlots)
|
||||
{
|
||||
clickedAnIconOnPanel = true;
|
||||
PanelIcons[i].CurrentState = ClickedIcon;
|
||||
PanelIcons[i].PanelFlashTimer = 1;
|
||||
|
||||
switch (ClickedIcon)
|
||||
{
|
||||
case IconType.Plasma:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonPlasmaCannon>();
|
||||
break;
|
||||
case IconType.Tesla:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonTeslaCannon>();
|
||||
break;
|
||||
case IconType.Laser:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonLaserCannon>();
|
||||
break;
|
||||
case IconType.Gauss:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonGaussNukeCannon>();
|
||||
break;
|
||||
case IconType.Inactive:
|
||||
ShouldDeleteArmIndex = true;
|
||||
PanelIcons[i].PanelFlashTimer = 0;
|
||||
break;
|
||||
}
|
||||
ArmIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(selectionIconTexture, selectionIconAreas[i].Center.ToVector2(), SelectionIcons[i].Frame, Projectile.GetAlpha(Color.White), 0f, area * 0.5f, Projectile.scale, 0, 0);
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(panelTexture, drawPosition, null, Projectile.GetAlpha(Color.White), 0f, panelTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
Main.EntitySpriteDraw(plasmaTexture, plasmaIconArea.Center.ToVector2(), null, plasmaColor, 0f, plasmaTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
Main.EntitySpriteDraw(teslaTexture, teslaIconArea.Center.ToVector2(), null, teslaColor, 0f, teslaTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
Main.EntitySpriteDraw(laserTexture, laserIconArea.Center.ToVector2(), null, laserColor, 0f, laserTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
Main.EntitySpriteDraw(gaussTexture, gaussIconArea.Center.ToVector2(), null, gaussColor, 0f, gaussTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
|
||||
// Draw panel icons.
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Rectangle panelArea = selectionIconAreas[i];
|
||||
panelArea.Y += (int)(Projectile.scale * 78f);
|
||||
Texture2D panelIconTexture = PanelIcons[i].IconTexture;
|
||||
if (panelIconTexture is not null)
|
||||
Main.EntitySpriteDraw(panelIconTexture, panelArea.Center.ToVector2(), PanelIcons[i].Frame, Projectile.GetAlpha(Color.White), 0f, area * 0.5f, Projectile.scale, 0, 0);
|
||||
|
||||
SelectionIcons[i].Update();
|
||||
PanelIcons[i].Update();
|
||||
}
|
||||
|
||||
// Draw an arrow at the mouse from the selected icon if one has been selected.
|
||||
if (ClickedIcon != IconType.Inactive)
|
||||
{
|
||||
Vector2 arrowDrawPosition = selectionIconAreas[(int)ClickedIcon - 1].Center.ToVector2();
|
||||
Vector2 arrowDirection = (Main.MouseScreen - arrowDrawPosition).SafeNormalize(Vector2.UnitY);
|
||||
arrowDrawPosition += arrowDirection * Projectile.scale * 24f;
|
||||
|
||||
Main.EntitySpriteDraw(arrowTexture, arrowDrawPosition, null, Projectile.GetAlpha(Color.White), arrowDirection.ToRotation(), arrowTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
}
|
||||
|
||||
// Tell the player if they don't have enough summon slots.
|
||||
if (hoveringOverAnySlot && !sufficientSlots)
|
||||
{
|
||||
Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, "Insufficient minion slots!", Main.MouseScreen.X + 20f, Main.MouseScreen.Y + 12f, Color.Cyan, Color.Black, new Vector2(0f, 0.5f));
|
||||
|
||||
// Reset the clicked icon if a click is made but not to a specific icon.
|
||||
if (!hoveringOverAnySlot && Main.mouseLeft && Main.mouseLeftRelease)
|
||||
ClickedIcon = IconType.Inactive;
|
||||
|
||||
if (hoveringOverAnySlot)
|
||||
{
|
||||
Main.blockMouse = true;
|
||||
Main.LocalPlayer.mouseInterface = true;
|
||||
}
|
||||
|
||||
// Reset the clicked icon and handle the arm creation/deletion if an icon was clicked on the panel.
|
||||
if (clickedAnIconOnPanel)
|
||||
ClickedIcon = IconType.Inactive;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 812 B After Width: | Height: | Size: 801 B |
|
Before Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 401 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 1.3 KiB |
@@ -14,13 +14,10 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
|
||||
public override float ShootSpeed => 13.5f;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => new(300f, 96f);
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation)
|
||||
{
|
||||
limbRotation = 0.23f;
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Plasma Cannon");
|
||||
|
||||
@@ -5,12 +5,13 @@ using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using System.IO;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonTeslaCannon : ExoskeletonCannon
|
||||
{
|
||||
public ref float TeslaOrbIndex => ref Projectile.ai[0];
|
||||
public ref float TeslaOrbIndex => ref Projectile.localAI[0];
|
||||
|
||||
public override int ShootRate => AresExoskeleton.TeslaCannonShootRate;
|
||||
|
||||
@@ -18,12 +19,9 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
|
||||
public override bool UsesSuperpredictiveness => true;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => new(-300f, 96f);
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation)
|
||||
{
|
||||
limbRotation = MathHelper.Pi - 0.23f;
|
||||
}
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -31,6 +29,10 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
Main.projFrames[Type] = 6;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer) => writer.Write(TeslaOrbIndex);
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader) => TeslaOrbIndex = reader.ReadSingle();
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
|
||||