Fixed crashes for ranged weapons.
Optimized code.
This commit is contained in:
@@ -18,6 +18,7 @@ public class PulseSprayer : ModItem
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 54;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 40;
|
||||
Item.height = 28;
|
||||
Item.useTime = 2;
|
||||
@@ -34,7 +35,7 @@ public class PulseSprayer : ModItem
|
||||
Item.rare = ItemRarityID.Red;
|
||||
}
|
||||
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
{
|
||||
return Utils.NextFloat(Main.rand) >= 0.8f;
|
||||
}
|
||||
@@ -44,11 +45,9 @@ public class PulseSprayer : ModItem
|
||||
return new Vector2(1f, -2f);
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Vector2 perturbedSpeed = Utils.RotatedByRandom(new Vector2(velocity.X, velocity.Y), (double)MathHelper.ToRadians(8f));
|
||||
velocity.X = perturbedSpeed.X;
|
||||
velocity.Y = perturbedSpeed.Y;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
velocity = Utils.RotatedByRandom(velocity, (double)MathHelper.ToRadians(8f));
|
||||
if (type == 14)
|
||||
{
|
||||
type = ModContent.ProjectileType<PulseBulletBlue>();
|
||||
@@ -58,16 +57,16 @@ public class PulseSprayer : ModItem
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Recipe val = CreateRecipe();
|
||||
val.AddRecipeGroup("FabusMod:PunksPulse", 1);
|
||||
val.AddIngredient(ItemID.FragmentVortex, 8);
|
||||
val.AddTile(TileID.LunarCraftingStation);
|
||||
val.Register();
|
||||
CreateRecipe()
|
||||
.AddRecipeGroup("FabusMod:PunksPulse")
|
||||
.AddIngredient(ItemID.FragmentVortex, 8)
|
||||
.AddTile(TileID.LunarCraftingStation)
|
||||
.Register();
|
||||
|
||||
Recipe val2 = CreateRecipe();
|
||||
val2.AddIngredient(ModContent.ItemType<PulseSprayerCadet>());
|
||||
val2.AddIngredient(ItemID.BlueDye, 1);
|
||||
val2.AddTile(TileID.DyeVat);
|
||||
val2.Register();
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<PulseSprayerCadet>())
|
||||
.AddIngredient(ItemID.BlueDye)
|
||||
.AddTile(TileID.DyeVat)
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user