Init Commit because im an Init Twat

This commit is contained in:
2025-10-30 23:50:31 +00:00
commit 7a9b03d1d0
59 changed files with 1978 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace ForgottenWawiTech.Content.Items
{
public class BoulderCannon: ModItem
{
public override void SetDefaults()
{
Item.damage = 10000;
Item.DamageType = DamageClass.Ranged;
Item.width = 40;
Item.height = 40;
Item.useTime = 100;
Item.useAnimation = 100;
Item.useStyle = ItemUseStyleID.Shoot;
Item.knockBack = 6;
Item.value = Item.buyPrice(gold: 20);
Item.rare = ItemRarityID.Red;
Item.UseSound = SoundID.Dig;
Item.autoReuse = true;
Item.noMelee = true;
Item.shoot = ProjectileID.PurificationPowder;
Item.shootSpeed = 50f;
Item.useAmmo = AmmoID.None;
}
// On shoot, fire Projectile ID 502 (the rainbow projectile) instead of the default ammo projectile
public override bool Shoot(Player player, Terraria.DataStructures.EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack)
{
// If the player's name contains "Neptune" or "Otter", instakill the player.
if (player.name.Contains("Neptune") || player.name.Contains("Otter"))
{
player.KillMe(Terraria.DataStructures.PlayerDeathReason.ByCustomReason(player.name + " was punished accordingly."), 10000, 0);
return false;
}
// Block the weapon if there is a boss alive
/* for (int i = 0; i < Main.maxNPCs; i++)
{
NPC npc = Main.npc[i];
if (npc.active && npc.boss)
{
if (Main.myPlayer == player.whoAmI)
{
Main.NewText("The Boulder Cannon refuses to fire while a boss is alive!", 255, 0, 0);
}
return false;
}
} */
Terraria.Projectile.NewProjectile(source, position, velocity, 1013, damage, knockBack, player.whoAmI);
return false; // return false to prevent tModLoader from shooting the default projectile
}
public override Vector2? HoldoutOffset() {
return new Vector2(2f, -2f);
}
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) {
Vector2 muzzleOffset = Vector2.Normalize(velocity) * 25f;
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) {
position += muzzleOffset;
}
}
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.BouncyBoulder, 100);
recipe.AddIngredient(ItemID.LunarBar, 20);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.Register();
}
}
}