tModLoader The problem with writing a check for Hive Pack

Gluttony

Terrarian
Hello everyone. I want to make it compatible with Hive Pack, but I don't quite understand how. I now about Player.strongBees = true;, but I do not know where to write it down so that it works. Can I put it in OnKill, or do I need to create a separate class and put it there? Thanks for your attention.
I am attaching the code below

C#:
using Microsoft.Xna.Framework;
using System;
using System.Net.Http.Headers;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.Drawing;
using Terraria.ID;
using Terraria.ModLoader;
using static Humanizer.In;

namespace NoAmmoNoGuns.Content.Projectiles
{

    public class BeeBullet : ModProjectile
    {

        public override void SetDefaults()
        {
            Projectile.CloneDefaults(ProjectileID.Bullet);
            // Projectile.aiStyle = 1; This line is not needed since CloneDefaults sets it already,
            // but you need to if you want to use your AI()
            Projectile.aiStyle = 0;
            AIType = ProjectileID.Bullet;

            Projectile.alpha = 255; // How transparent to draw this projectile. 0 to 255. 255 is completely transparent
            Projectile.light = 0.35f; // Like Musket Ball
            Projectile.scale = 1.2f; // Like Musket Ball
        }
        
        public class HivePack : ModPlayer
        {
            public bool strongBees;
            Player.strongBees = true;
        }
        
        public override void OnKill(int timeLeft)
        {
            // This code spawn dust from the tiles collided with. SoundID.Item10 is the bounce sound you hear
            Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height);
            SoundEngine.PlaySound(SoundID.Item10, Projectile.position);

            // TODO Compatibility with Hive Pack!!!
            if (Main.myPlayer == Projectile.owner)
            {
                Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.125f, Player.beeType(), Player.beeDamage, Player.beeKB, Projectile.owner, 0f, 0f);
            }

        }

    }

}
 
In general, I found a solution to the problem myself. It turned out not to be as difficult as I thought
I am attaching the code below (When your project dies, that is, hits an enemy or a title, summons a Bee, but if a Hive Pack is worn, it can summon a Large bee)
C#:
        public override void OnKill(int timeLeft)
        {
            // This code spawn dust from the tiles collided with. SoundID.Item10 is the bounce sound you hear
            Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height);
            SoundEngine.PlaySound(SoundID.Item10, Projectile.position);

            if (Main.myPlayer == Projectile.owner)
            {
                Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * .125f, Main.player[Projectile.owner].beeType(),
                                                                                                                          Main.player[Projectile.owner].beeDamage(Projectile.damage),
                                                                                                                          Main.player[Projectile.owner].beeKB(0f), Projectile.owner, 0f, 0f);
            }

        }

    }

}
 
Back
Top Bottom