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 GoldenStinger : ModItem
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 68;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 32;
|
||||
Item.height = 38;
|
||||
Item.useTime = 3;
|
||||
@@ -28,14 +28,14 @@ public class GoldenStinger : ModItem
|
||||
Item.value = Item.sellPrice(0, 30, 35, 0);
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<GoldenLightBlast>();
|
||||
Item.shoot = ModContent.ProjectileType<Projectiles.LightBlasts.GoldenLightBlast>();
|
||||
Item.shootSpeed = 10f;
|
||||
Item.rare = 12;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
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;
|
||||
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 32f;
|
||||
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
|
||||
{
|
||||
position += muzzleOffset;
|
||||
@@ -45,10 +45,10 @@ public class GoldenStinger : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe val = CreateRecipe();
|
||||
val.AddRecipeGroup("FabusMod:TheStinger", 1);
|
||||
val.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.GoddessGold>(), 6);
|
||||
val.AddTile(TileID.LunarCraftingStation);
|
||||
val.Register();
|
||||
CreateRecipe()
|
||||
.AddRecipeGroup("FabusMod:TheStinger")
|
||||
.AddIngredient(ModContent.ItemType<Items.CraftingIngredients.GoddessGold>(), 6)
|
||||
.AddTile(TileID.LunarCraftingStation)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using FabusMod.Projectiles.LightBlasts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -18,6 +17,7 @@ public class LightGun : ModItem
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 14;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 32;
|
||||
Item.height = 38;
|
||||
Item.useTime = 7;
|
||||
@@ -28,14 +28,14 @@ public class LightGun : ModItem
|
||||
Item.value = Item.sellPrice(0, 5, 0, 0);
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<LightBlast>();
|
||||
Item.shoot = ModContent.ProjectileType<Projectiles.LightBlasts.LightBlast>();
|
||||
Item.shootSpeed = 7f;
|
||||
Item.rare = ItemRarityID.Green;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
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;
|
||||
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 32f;
|
||||
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
|
||||
{
|
||||
position += muzzleOffset;
|
||||
@@ -45,11 +45,11 @@ public class LightGun : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe val = CreateRecipe();
|
||||
val.AddRecipeGroup("FabusMod:GoldBar", 20);
|
||||
val.AddIngredient(ItemID.Diamond, 4);
|
||||
val.AddIngredient(ItemID.Amethyst, 6);
|
||||
val.AddTile(TileID.Anvils);
|
||||
val.Register();
|
||||
CreateRecipe()
|
||||
.AddRecipeGroup("FabusMod:GoldBar", 20)
|
||||
.AddIngredient(ItemID.Diamond, 4)
|
||||
.AddIngredient(ItemID.Amethyst, 6)
|
||||
.AddTile(TileID.Anvils)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using FabusMod.Projectiles.LightBlasts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -18,6 +17,7 @@ public class SpectralBlaster : ModItem
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 100;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 32;
|
||||
Item.height = 38;
|
||||
Item.useTime = 2;
|
||||
@@ -28,14 +28,14 @@ public class SpectralBlaster : ModItem
|
||||
Item.value = Item.sellPrice(1, 55, 0, 0);
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<RainbowLightBlast>();
|
||||
Item.shoot = ModContent.ProjectileType<Projectiles.LightBlasts.RainbowLightBlast>();
|
||||
Item.shootSpeed = 10f;
|
||||
Item.expert = true;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
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;
|
||||
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 32f;
|
||||
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
|
||||
{
|
||||
position += muzzleOffset;
|
||||
@@ -45,10 +45,10 @@ public class SpectralBlaster : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe val = CreateRecipe();
|
||||
val.AddIngredient(ModContent.ItemType<GoldenStinger>());
|
||||
val.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 6);
|
||||
val.AddTile(ModContent.TileType<global::FabusMod.Tiles.RainbowStation>());
|
||||
val.Register();
|
||||
Recipe recipe = CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<GoldenStinger>())
|
||||
.AddIngredient(ModContent.ItemType<Bars.RainbowChunk>(), 6)
|
||||
.AddTile(ModContent.TileType<global::FabusMod.Tiles.RainbowStation>())
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using FabusMod.Projectiles.LightBlasts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -18,6 +17,7 @@ public class Taegeukgi : ModItem
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 40;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 32;
|
||||
Item.height = 38;
|
||||
Item.useTime = 5;
|
||||
@@ -28,14 +28,14 @@ public class Taegeukgi : ModItem
|
||||
Item.value = Item.sellPrice(0, 8, 25, 0);
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<LightBlast>();
|
||||
Item.shoot = ModContent.ProjectileType<Projectiles.LightBlasts.LightBlast>();
|
||||
Item.shootSpeed = 6f;
|
||||
Item.rare = ItemRarityID.LightRed;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
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;
|
||||
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 32f;
|
||||
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
|
||||
{
|
||||
position += muzzleOffset;
|
||||
@@ -45,11 +45,11 @@ public class Taegeukgi : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe val = CreateRecipe();
|
||||
val.AddIngredient(ModContent.ItemType<LightGun>());
|
||||
val.AddRecipeGroup("FabusMod:OrichalcumBar", 6);
|
||||
val.AddIngredient(ItemID.Sapphire, 6);
|
||||
val.AddTile(TileID.MythrilAnvil);
|
||||
val.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<LightGun>())
|
||||
.AddRecipeGroup("FabusMod:OrichalcumBar", 6)
|
||||
.AddIngredient(ItemID.Sapphire, 6)
|
||||
.AddTile(TileID.MythrilAnvil)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using FabusMod.Projectiles.LightBlasts;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -18,6 +17,7 @@ public class TheStinger : 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 TheStinger : 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,16 +45,16 @@ public class TheStinger : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe val = CreateRecipe();
|
||||
val.AddIngredient(ModContent.ItemType<Taegeukgi>());
|
||||
val.AddIngredient(ItemID.HallowedBar, 14);
|
||||
val.AddTile(TileID.AdamantiteForge);
|
||||
val.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<Taegeukgi>())
|
||||
.AddIngredient(ItemID.HallowedBar, 14)
|
||||
.AddTile(TileID.AdamantiteForge)
|
||||
.Register();
|
||||
|
||||
Recipe val2 = CreateRecipe();
|
||||
val2.AddIngredient(ModContent.ItemType<TheStingerBlackCat>());
|
||||
val2.AddIngredient(ItemID.BlueDye, 1);
|
||||
val2.AddTile(TileID.DyeVat);
|
||||
val2.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<TheStingerBlackCat>())
|
||||
.AddIngredient(ItemID.BlueDye)
|
||||
.AddTile(TileID.DyeVat)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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