Fixed crashes for ranged weapons.
Optimized code.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using FabusMod.Projectiles.LightBlasts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -18,6 +17,7 @@ public class TheStingerBlackCat : ModItem
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 66;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 32;
|
||||
Item.height = 38;
|
||||
Item.useTime = 4;
|
||||
@@ -28,14 +28,14 @@ public class TheStingerBlackCat : ModItem
|
||||
Item.value = Item.sellPrice(0, 13, 85, 0);
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<LightBlast>();
|
||||
Item.shoot = ModContent.ProjectileType<Projectiles.LightBlasts.LightBlast>();
|
||||
Item.shootSpeed = 5f;
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Vector2 muzzleOffset = Vector2.Normalize(new Vector2(velocity.X, velocity.Y)) * 32f;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 32f;
|
||||
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
|
||||
{
|
||||
position += muzzleOffset;
|
||||
@@ -45,10 +45,10 @@ public class TheStingerBlackCat : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe val = CreateRecipe();
|
||||
val.AddIngredient(null, "TheStinger", 1);
|
||||
val.AddIngredient(ItemID.BlackDye, 1);
|
||||
val.AddTile(TileID.DyeVat);
|
||||
val.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(null, "TheStinger")
|
||||
.AddIngredient(ItemID.BlackDye)
|
||||
.AddTile(TileID.DyeVat)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user