From da33c1e3b8e3eef207790e7f3a886b97c8d4f61d Mon Sep 17 00:00:00 2001 From: Dominic Date: Thu, 21 Jul 2022 17:57:01 -0500 Subject: [PATCH] Loot crate particle and item resprites --- CalPlayer/CalamityPlayer.cs | 4 ++ ILEditing/VanillaBugfixingILChanges.cs | 25 ++++++-- Items/Armor/Wulfrum/WulfrumSet.cs | 19 +----- Items/Weapons/Summon/AresExoskeleton.cs | 58 +++++++++++++++++- Items/Weapons/Summon/AresExoskeleton.png | Bin 596 -> 507 bytes .../Weapons/Summon/AresExoskeletonRemote.png | Bin 0 -> 414 bytes Items/Weapons/Summon/AresExoskeleton_Body.png | Bin 0 -> 5688 bytes Particles/AresSummonCrate.png | Bin 0 -> 912 bytes Particles/AresSummonCrateParticle.cs | 52 ++++++++++++++++ Particles/WulfrumHatParticle.cs | 5 +- .../Summon/SmallAresArms/CannonLaserbeam.cs | 27 +++++--- .../SmallAresArms/ExoskeletonLaserCannon.cs | 2 +- .../Summon/SmallAresArms/ExoskeletonPanel.cs | 12 ++-- 13 files changed, 161 insertions(+), 43 deletions(-) create mode 100644 Items/Weapons/Summon/AresExoskeletonRemote.png create mode 100644 Items/Weapons/Summon/AresExoskeleton_Body.png create mode 100644 Particles/AresSummonCrate.png create mode 100644 Particles/AresSummonCrateParticle.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d85edc3c44..8e17f3c0de 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -36,6 +36,7 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.ExoMechs.Apollo; @@ -5601,6 +5602,9 @@ namespace CalamityMod.CalPlayer Player.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head); Player.face = -1; } + else if (AresExoskeleton.ArmExists(Player)) + Player.body = EquipLoader.GetEquipSlot(Mod, "AresExoskeleton", EquipType.Body); + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) { Player.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs); diff --git a/ILEditing/VanillaBugfixingILChanges.cs b/ILEditing/VanillaBugfixingILChanges.cs index 0cd1d964cd..e7ed8c81fd 100644 --- a/ILEditing/VanillaBugfixingILChanges.cs +++ b/ILEditing/VanillaBugfixingILChanges.cs @@ -174,7 +174,7 @@ namespace CalamityMod.ILEditing { cache.Add(new OrderedProjectileEntry() { - Proj = Main.projectile[i] ?? new Projectile(), + Proj = Main.projectile[i] ?? new(), OriginalIndex = i }); } @@ -182,12 +182,18 @@ namespace CalamityMod.ILEditing }); cursor.Emit(OpCodes.Stsfld, typeof(ILChanges).GetField("OrderedProjectiles", BindingFlags.Static | BindingFlags.Public)); + // Find the update loop update local index. + int updateLoopLocalIndex = -1; + cursor.GotoNext(i => i.MatchStloc(out updateLoopLocalIndex)); + // Go before the declaration of the projectile loop index and declare the ordered projectile. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStsfld
("ProjectileUpdateLoopIndex"))) + cursor.Goto(0); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStsfld
("ProjectileUpdateLoopIndex"))) { LogFailure("Projectile Update Priority fix", "Could not locate the ProjectileUpdateLoopIndex field."); return; } + int updateIndexPosition = cursor.Index; // Replace the projectile reference on the Projectile.Update call. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdelemRef())) @@ -199,14 +205,21 @@ namespace CalamityMod.ILEditing // Pop the Main.projectile[i] reference and replace it with OrderedProjectiles[i].Proj. cursor.Emit(OpCodes.Pop); cursor.Emit(OpCodes.Ldsfld, typeof(ILChanges).GetField("OrderedProjectiles", BindingFlags.Static | BindingFlags.Public)); - cursor.Emit(OpCodes.Ldloc, 29); + cursor.Emit(OpCodes.Ldloc, updateLoopLocalIndex); cursor.Emit(OpCodes.Callvirt, typeof(List).GetMethod("get_Item")); cursor.Emit(OpCodes.Ldfld, typeof(OrderedProjectileEntry).GetField("Proj")); - // Remove the direct i reference in the Update call and replace it with the original index in the cache, to prevent update ID + // Pop the direct i reference in the Update call and replace it with the original index in the cache, to prevent update ID // mismatches. - cursor.Remove(); - cursor.Emit(OpCodes.Ldloc, 29); + cursor.Goto(updateIndexPosition); + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCall("Call"))) + { + LogFailure("Projectile Update Priority fix", "Could not locate the projectile Update call."); + return; + } + cursor.Emit(OpCodes.Pop); + cursor.Emit(OpCodes.Ldloc, updateLoopLocalIndex); cursor.EmitDelegate>(i => OrderedProjectiles[i].OriginalIndex); } #endregion Fix Projectile Update Priority Problems diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 28169091ec..840f546825 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -6,27 +6,12 @@ using Microsoft.Xna.Framework; using Terraria.DataStructures; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Cooldowns; -using CalamityMod.Projectiles.Magic; using Terraria.Audio; -using ReLogic.Content; -using Microsoft.Xna.Framework.Graphics; -using System.Linq; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; -using static Microsoft.Xna.Framework.Input.Keys; using System; -using CalamityMod.Items.BaseItems; using System.Collections.Generic; using CalamityMod.Particles; +using static Terraria.ModLoader.ModContent; +using static Microsoft.Xna.Framework.Input.Keys; namespace CalamityMod.Items.Armor.Wulfrum { diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index cc92820930..04d40c5a45 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -4,11 +4,19 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Projectiles.Summon.SmallAresArms; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Particles; namespace CalamityMod.Items.Weapons.Summon { public class AresExoskeleton : ModItem { + public int FrameCounter = 0; + + public int Frame = 0; + + public const int BoxParticleLifetime = 95; + public const int PlasmaCannonShootRate = 30; public const int TeslaCannonShootRate = 30; @@ -23,6 +31,27 @@ namespace CalamityMod.Items.Weapons.Summon public const float NukeDamageFactor = 1.5f; + public static bool ArmExists(Player player) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] >= 1) + return true; + + return false; + } + + public override void Load() + { + // Add the body equip texture. + if (Main.netMode != NetmodeID.Server) + EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this); + } + public override void SetStaticDefaults() { DisplayName.SetDefault("Ares' Exoskeleton"); @@ -39,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 672; Item.useStyle = ItemUseStyleID.HoldUp; Item.noUseGraphic = true; - Item.width = Item.height = 56; + Item.width = Item.height = 36; Item.useTime = Item.useAnimation = 9; Item.noMelee = true; Item.knockBack = 1f; @@ -53,7 +82,27 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.Calamity().CannotBeEnchanted = true; } - + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value; + if (ArmExists(Main.LocalPlayer)) + { + texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeletonRemote").Value; + position.X += scale * 6f; + } + + spriteBatch.Draw(texture, position, new(0, 0, texture.Width, texture.Height), Color.White, 0f, origin, scale, 0, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref Frame, ref FrameCounter, 1, 1), lightColor, 0f, Vector2.Zero, 1f, 0, 0); + return false; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int panelID = ModContent.ProjectileType(); @@ -77,6 +126,11 @@ namespace CalamityMod.Items.Weapons.Summon int panel = Projectile.NewProjectile(source, position, Vector2.Zero, panelID, damage, 0f, player.whoAmI); if (Main.projectile.IndexInRange(panel)) Main.projectile[panel].originalDamage = Item.damage; + + // Also throw a mechanical box cool particle out. + Vector2 boxVelocity = -Vector2.UnitY.RotatedByRandom(0.7f) * 6f + Vector2.UnitX * player.direction * 4f; + Particle box = new AresSummonCrateParticle(player, boxVelocity, BoxParticleLifetime); + GeneralParticleHandler.SpawnParticle(box); } return false; diff --git a/Items/Weapons/Summon/AresExoskeleton.png b/Items/Weapons/Summon/AresExoskeleton.png index 5cb49c6e27467e1df8626f48de96f56ebb81dcf5..fa76b67f3348684def55bb9ff1a994a1a1026c33 100644 GIT binary patch delta 487 zcmcb@@|#()Gr-TCmrII^fq{Y7)59eQNUH#`8V56woGo^8;Y3A+dXE5~5LX~yPC?O6 zNj)Gk-Ppo@i??I5mU(ea_pBxB4xYKFAZy?n(a^3PcHGXcZ_fVz|37@%rkVNSPTyk3 z)jR4hzs~vfzrcKA7SIqIUaLJoN}?plFZe%pz;ISr?-fuDXMsm#F#|(A-vI^&z5|R| z*E%^F7#JlyT^vI!{HIR7SkbQ&juKL-ELrO9nA|&aLTQhH|$oPij5n-TOU9-e!`?QipuoQYR~}BNk>iScK+G zoMIw<{C$^-$=0K1^e>vJOqqXbcm0tUQ$u>@r?$Cy>drZT`;6ws5GR#T28%em?u*)n zxy~nkYP8QV-l+V1>Wy`gnwG*XnX}R_-D>cE6fq%4>uHtl(=z9XX_aALD$DpfzpcKr zD{t!W+Lb=StzXhVc3^wWul@&y=8z;h^w4}VsTCP ztR?FLBGZ9##uoOHc1{Yi2Idp9JX3dl+NNnY_2vKnA0{SD{8Zq1+|I6DJM7?@i$InA zz5&fZO1LD*FZe$OVAxc9hXW|hS>O>_%)r2R7=#&*=dVa%U|?+Zba4#vsP{fQ^EtQUEfpYyqsQQ5i(cx_)p#;qNOIEKOBQWB{C3_}zr5Bi zYB`X#Iwh*rttUw91@mncGwm-{vyDB7!}lSeYX-b!12q*Zr8O8Y95F3pyPmPtW9pXXfqdTL>I zsB~ui^cxDPTMrm|G-kK4tj(R|d+D3uB$M;cH&2n+ZxkxTfBv5Lq`NWk^0zj5M2g9Z zWdFJ$m%099k~g!+^KV}LQ`$wh9z4%+c4Owcl`jJ~+kckh{}K1;qdW diff --git a/Items/Weapons/Summon/AresExoskeletonRemote.png b/Items/Weapons/Summon/AresExoskeletonRemote.png new file mode 100644 index 0000000000000000000000000000000000000000..afa780177268c3af1c4c9616f277547b982ef602 GIT binary patch literal 414 zcmeAS@N?(olHy`uVBq!ia0vp^Qb4T2!3-o9Jh`O^q!^2X+?^QKos)S9+XwiBxB_Wo3wt>Q#e-)q&RViAATqtUrdvVQz%`K*?lVT%=~cY*Z%^b-mLTdmw=RLNswRge=LAO`)2JcpaRYUkH}&M z2EKzJ%(!D>_FJIfaZeY=5DWjgliu<*EAY5xv;Lg3;M2eJyW%eVHJCkNuFHYyNp6`d zIYO>m*P8k+HMsu7IbQLf`@@4#mrreWVtE#+xmNMxw>2}i#)+jZ6?5cvxv})e;#n+d z$!i|WG2FqRV(Xf+_PgSdA3}4QWddK%3hL2(`X=Vw;#0q;IAvtr{>62B=?6(mbJZk= zwc2$OPmhTh9Qs@GDRklA1Gj3oZ;KUP5u0~>J(tljE9R+>8(yq7)5x%ss_)H;7c_0W nw!KK1OI2{OX!?ifsh`;TN)%H~6*lGry~N<@>gTe~DWM4fV%W7W literal 0 HcmV?d00001 diff --git a/Items/Weapons/Summon/AresExoskeleton_Body.png b/Items/Weapons/Summon/AresExoskeleton_Body.png new file mode 100644 index 0000000000000000000000000000000000000000..5cd9d002d9f718149bbcd6c5fea8223fca10096e GIT binary patch literal 5688 zcmd5=X*ksV*PlVdl(CJNY;oIK#7rfOWlYJIP$UsEA%ra1hruM3j6sWi8Id(g-DS;E z7}a3xNp@Mr-k6vP^Nj!XJlFNSd9LgK>VH3Pe%E<%&i8k|=X;&c=W|ZHwWSGUztnyJ z001#FHM$G{06n?(gaC;9RS($i2LKLo%#6^sVZh~_6G_UHgZJkiv<^z$w@3c=P+z^A7ZA>`|J0t9<;V*ae{bq{1YK1ukz+Ce@wkE-8B-;Tvrmnz!=D{#eck zrg)5DI}qW$@CM}?y_7D3J!uyMGA+2dHRE{V5YgM8=bXkYYo^sgsNpAeyy*&+6c5mz=ZGkcTHD1y|!52ipS5w*wh8j(v8P#`m3Ir>w;bvTt6;Lvf=Q z=8xfrdGf4#Upms+I=RmZnVrPLAQL^>gzvNT8ieJ%@||779iq3a-@v;erh_CUf{EEY z$8oJ{X(CgtY30dgnM@ zC&*|(w?w#-SFg6|V4h?6{Hk5UvtlOG5mz%-H(tTWk5Ka+jHX-1=2Am_Vzf~@J;qup zvaop2hxC)v*VgWpgY>_=n~;dMNp}5>ADv{Jt17*EXp$tdLcUSDrI;;AL zdgC)lwXC$Uyp3i;SPba}o05B6+k@#JwNyJWXTvYG;YR9Fm50vSWnW)2)*9=jFca&V zGE#SKTDKm;gfGQLO=X0&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Un{1o zP=h9ItiNG44$6KM@VUKUg}bWK)F5@+J-}(4CEI%f6Wy&b?gAznQph*+RJw{UysKny rdFJ$N^y|^C=55;lbCRc6aSf&St}pSD2D^c~5eAr@w=}9ei@p0_M=>F| literal 0 HcmV?d00001 diff --git a/Particles/AresSummonCrate.png b/Particles/AresSummonCrate.png new file mode 100644 index 0000000000000000000000000000000000000000..18e45a66724e902b4bb6f947115622ed4d9cbcda GIT binary patch literal 912 zcmeAS@N?(olHy`uVBq!ia0vp^DnMMv!3-p;Pdi%!DaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheegQrqu0UE&LD5f1Js>jO*us8`w_~%Gd2vnmtR?FXp1G(XYv3Bu(5@YJ z+|I6V&i?=ZKYZGznfc*P-(ttrJL)gL&iVDfzc-$VVicDi*-4*oX ze|?Ev-O`q&oF~M0-}wAyZ-?wlmYb98Z#~P)nl+`)Mq_E(r%36>S<7;F=WVX6zMb;% z&8}^wYxuk(&o+O_i_2D;V6bz-y)&VVl?~hOiWzb$gfO3+d8usoX(5(nTb78ldq@kM zIKRfd!;DK)!rq&|XM&W){ONH5Nh@X)XfZ6>Q*&)wU`Jl&tbN}L8fyE`)&_RGTxP;k z+b{U`dpmQUuL4`3*n)M^ZI25j?%ikfTYlK_+Qu@*jxXAGe%74)^}{0d?RS<-X&ufy zQ=dOAvipDP*PkmJQv02v1XSdC51V!ec+8umUYc6R^wDeK+8LHSev#P}i$xy@J;D63S@s{OJG&w3c_i_949{C`#ta6h{L2QQUgk?Tnv0Ch1 z&K_;+E>C?SzBPx{fw5zqkMl*l*RQ?BQ)G`6B{&vLmF>U2TF-bLU*)3-YHJI2o%-W7 zMV%{h)iI|X%akIIUF1HIx-Bs6+^W`VU*&&U3oK1IxZvuhJq-qo1#=X0eSx00{JTM% zWm$8|N4JO;n-hOFJns;j!_2NIubI<|JdmiFl)gBEqJ%nGC0>n}K+$}03SzO*P#`lfERnN_i~HGSEqg=-c&Rxt)9 z%-bEiG2PN=njK5#M5fK60?~}>W!~uwRWVwcck^Ppzh!ByKJY8je}SjMAMeW3M!|u$ gTb41D?ElYJT{QQh_KL3gz*NlO>FVdQ&MBb@0GV!#r2qf` literal 0 HcmV?d00001 diff --git a/Particles/AresSummonCrateParticle.cs b/Particles/AresSummonCrateParticle.cs new file mode 100644 index 0000000000..d79e48fd8f --- /dev/null +++ b/Particles/AresSummonCrateParticle.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework; +using Terraria; +using System; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Particles +{ + public class AresSummonCrateParticle : Particle + { + public override bool SetLifetime => true; + public override string Texture => "CalamityMod/Particles/AresSummonCrate"; + public override bool UseCustomDraw => true; + + public AresSummonCrateParticle(Player owner, Vector2 velocity, int lifetime) + { + Position = owner.Center - Vector2.UnitY * 4f; + Scale = 1f; + Color = Color.White; + Velocity = velocity; + Rotation = 0f; + Lifetime = lifetime; + } + + public override void Update() + { + Rotation += Math.Sign(Velocity.X) * 0.05f; + Velocity.X *= 0.95f; + Velocity.Y += 0.24f; + if (Collision.SolidCollision(Position - Vector2.One * Scale * 19f, (int)(Scale * 38f), (int)(Scale * 38f), true)) + { + Velocity.X *= 0.8f; + Rotation = 0f; + Velocity.Y = 0f; + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = GeneralParticleHandler.GetTexture(Type); + Color lightColor = Lighting.GetColor(Position.ToTileCoordinates()); + + int frameY = (int)Math.Round(MathHelper.Lerp(0f, 2f, (float)Math.Pow(LifetimeCompletion, 0.16f))); + Rectangle frame = texture.Frame(1, 3, 0, frameY); + float opacity = MathHelper.Clamp(1f - (float)Math.Pow(LifetimeCompletion, 7f), 0f, 1f); + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, lightColor * opacity, Rotation, frame.Size() * 0.5f, Scale, 0, 0); + } + } +} + + + + diff --git a/Particles/WulfrumHatParticle.cs b/Particles/WulfrumHatParticle.cs index 8c18326e97..e41b619957 100644 --- a/Particles/WulfrumHatParticle.cs +++ b/Particles/WulfrumHatParticle.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using System; using Microsoft.Xna.Framework.Graphics; @@ -12,11 +11,11 @@ namespace CalamityMod.Particles public override string Texture => "CalamityMod/Particles/WulfrumHat"; public override bool UseCustomDraw => true; - public int Direction ; + public int Direction; public WulfrumHatParticle(Player owner, Vector2 velocity, int lifetime) { - Position = owner.Center - Vector2.UnitY * 20f;; + Position = owner.Center - Vector2.UnitY * 20f; Direction = owner.direction; Scale = 1f; Color = Color.White; diff --git a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs index 4543793648..ad4642c3cf 100644 --- a/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs +++ b/Projectiles/Summon/SmallAresArms/CannonLaserbeam.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using System; +using System.Collections.Generic; using System.Linq; using Terraria; using Terraria.ID; @@ -14,11 +15,9 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public int OwnerIndex - { - get => Projectile.GetByUUID(Projectile.owner, Projectile.ai[1]); - set => Projectile.ai[1] = value; - } + public Player Owner => Main.player[Projectile.owner]; + + public Projectile OwnerProjectile => CalamityUtils.FindProjectileByIdentity((int)Projectile.ai[1], Projectile.owner); public const int LifetimeConst = 75; public override float MaxScale => 0.5f + (float)Math.Cos(Main.GlobalTimeWrappedHourly * 10f) * 0.07f; @@ -47,6 +46,8 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Projectile.localNPCHitCooldown = 14; Projectile.scale = 0.5f; Projectile.usesLocalNPCImmunity = true; + Projectile.hide = true; + Projectile.Calamity().UpdatePriority = 1f; } public override float DetermineLaserLength() @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override void UpdateLaserMotion() { - if (OwnerIndex == -1) + if (OwnerProjectile is null) { Projectile.Kill(); return; @@ -68,15 +69,16 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override void AttachToSomething() { - if (OwnerIndex == -1 || !Main.projectile[OwnerIndex].active) + Projectile ownerProjectile = OwnerProjectile; + if (ownerProjectile is null) { Projectile.Kill(); return; } - float attachmentOffset = Main.projectile[OwnerIndex].width * Main.projectile[OwnerIndex].scale * 0.75f; - Projectile.Center = Main.projectile[OwnerIndex].Center + Main.projectile[OwnerIndex].rotation.ToRotationVector2() * attachmentOffset; - Projectile.rotation = Main.projectile[OwnerIndex].rotation; + float attachmentOffset = ownerProjectile.width * ownerProjectile.scale * 0.75f; + Projectile.Center = ownerProjectile.Center + ownerProjectile.rotation.ToRotationVector2() * attachmentOffset - Owner.velocity; + Projectile.rotation = ownerProjectile.rotation; Projectile.velocity = Projectile.rotation.ToRotationVector2(); // Update frames. @@ -85,6 +87,11 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public override bool ShouldUpdatePosition() => false; + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overPlayers.Add(index); + } + public override bool PreDraw(ref Color lightColor) { // This should never happen, but just in case. diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs index ab8550bc4e..f621713c30 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannon.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { Main.projectile[laser].originalDamage = Projectile.originalDamage; if (fireLaser) - Main.projectile[laser].ai[1] = Projectile.whoAmI; + Main.projectile[laser].ai[1] = Projectile.identity; } // Increment the shoot counter. This decides if the cannon fires a simple laser or a beam. diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs index 0b6f093962..b1dcf65401 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonPanel.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms if (MousePressFrameCountdown >= 1) frame = 2; if (PanelFlashTimer >= 1) - frame = (int)Math.Round(MathHelper.Lerp(4f, 6f, PanelFlashTimer / 24f)); + frame = (int)Math.Round(MathHelper.Lerp(4f, 6f, PanelFlashTimer / 16f)); return IconTexture?.Frame(1, 7, 0, frame) ?? default; } @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { if (PanelFlashTimer >= 1) PanelFlashTimer++; - if (PanelFlashTimer >= 18) + if (PanelFlashTimer >= 16) PanelFlashTimer = 0; if (MousePressFrameCountdown > 0) @@ -116,7 +116,9 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms public bool FadeOut => Projectile.ai[0] == 1f; public Vector2 PlayerOffset; - + + public ref float Time => ref Projectile.ai[1]; + public static Rectangle MouseRectangle => new((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2); public override void SetStaticDefaults() @@ -177,12 +179,14 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms } // Handle fade effects. - Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity - FadeOut.ToDirectionInt() * 0.0225f, 0f, 1f); + if (Time >= AresExoskeleton.BoxParticleLifetime) + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity - FadeOut.ToDirectionInt() * 0.0225f, 0f, 1f); if (FadeOut && Projectile.Opacity <= 0f) Projectile.Kill(); if (Main.player[Projectile.owner].dead || !Main.player[Projectile.owner].active) Projectile.Kill(); + Time++; // Create and destroy arms as necessary. if (Main.myPlayer != Projectile.owner)