private void ProjectileController_OnTriggerEnter(On.RoR2.Projectile.ProjectileController.orig_OnTriggerEnter orig, RoR2.Projectile.ProjectileController self, Collider collider)
        {
            orig(self, collider);
            if (!collider.gameObject)
            {
                return;
            }
            var hb = collider.gameObject.GetComponent <HurtBox>();

            if (hb && hb.healthComponent)
            {
                self.gameObject.AddComponent <ProjectileHasValidHitFlag>();
            }
        }
Exemple #2
0
        private void ProjectileController_OnTriggerEnter(On.RoR2.Projectile.ProjectileController.orig_OnTriggerEnter orig, RoR2.Projectile.ProjectileController self, Collider collider)
        {
            orig(self, collider);
            if (collider == null || !collider.gameObject || !self || !self.owner)
            {
                return;
            }
            var hb    = collider.gameObject.GetComponent <HurtBox>();
            var ob    = self.owner.GetComponent <CharacterBody>();
            var count = GetCount(ob);

            if (hb && hb.healthComponent && count > 0 && hb.healthComponent != self.owner.GetComponent <HealthComponent>() && hb.teamIndex == TeamComponent.GetObjectTeam(self.owner))
            {
                new MsgHealTargetAndSelf(hb.healthComponent, ob.healthComponent, count * self.procCoefficient, self.procChainMask)
                .Send(R2API.Networking.NetworkDestination.Server);
            }
        }