Skip to content

Commit

Permalink
[fix] Few refactors #1
Browse files Browse the repository at this point in the history
  • Loading branch information
MaelVB committed Nov 25, 2020
1 parent 138d26f commit 15acc77
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Items/Gloves/FasterSnowballGlove.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public override void AddRecipes()
recipe.AddRecipe();
}

public override void OnConsumeAmmo(Player player) {
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
const int NUM_DUSTS = 10;
float posX = player.position.X;
float posY = player.position.Y;
Expand All @@ -59,6 +60,7 @@ public override void OnConsumeAmmo(Player player) {
posX--;
posY--;
}
return true;
}
}
}
6 changes: 4 additions & 2 deletions Items/Gloves/SnowballGlove.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public override void AddRecipes()
/**
* My item has the noUseGraphic property because I don't want it to be displayed.
* But because of this property I can't call the method MeleeEffects.
* So, in order to have an effect when I use my item, I call the OnConsummeAmmo method.
* So, in order to have an effect when I use my item, I call the Shoot method.
*/
public override void OnConsumeAmmo(Player player) {
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
const int NUM_DUSTS = 5;
float posX = player.position.X;
float posY = player.position.Y;
Expand All @@ -64,6 +65,7 @@ public override void OnConsumeAmmo(Player player) {
posX--;
posY--;
}
return true;
}
}
}
3 changes: 1 addition & 2 deletions Items/Snowballs/SnowballWithGrenade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ public override void SetDefaults()
item.noMelee = true;
item.noUseGraphic = true;

item.ammo = AmmoID.Snowball;
item.ammo = item.type; //No integration with gloves for the moment
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
Expand Down

0 comments on commit 15acc77

Please sign in to comment.