private void ProjectileController_OnCollisionEnter(On.RoR2.Projectile.ProjectileController.orig_OnCollisionEnter orig, RoR2.Projectile.ProjectileController self, Collision collision) { orig(self, collision); if (!collision.gameObject) { return; } var hb = collision.gameObject.GetComponent <HurtBox>(); if (hb && hb.healthComponent) { self.gameObject.AddComponent <ProjectileHasValidHitFlag>(); } }
private void ProjectileController_OnCollisionEnter(On.RoR2.Projectile.ProjectileController.orig_OnCollisionEnter orig, RoR2.Projectile.ProjectileController self, Collision collision) { orig(self, collision); if (collision == null || !collision.gameObject || !self || !self.owner) { return; } var hb = collision.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); } }