// Token: 0x06003186 RID: 12678 RVA: 0x000D5564 File Offset: 0x000D3764
 public override void OnEnter()
 {
     base.OnEnter();
     this.duration = this.baseDuration / this.attackSpeedStat;
     if (base.isAuthority)
     {
         Ray aimRay = base.GetAimRay();
         this.targetHurtBox = this.FindTarget(aimRay);
     }
     if (NetworkServer.active)
     {
         if (HealBeamController.GetHealBeamCountForOwner(base.gameObject) >= this.maxSimultaneousBeams)
         {
             return;
         }
         if (this.targetHurtBox)
         {
             Transform transform = base.FindModelChild(this.muzzleName);
             if (transform)
             {
                 GameObject         gameObject = UnityEngine.Object.Instantiate <GameObject>(this.healBeamPrefab, transform);
                 HealBeamController component  = gameObject.GetComponent <HealBeamController>();
                 component.healRate = this.healRateCoefficient * this.damageStat * this.attackSpeedStat;
                 component.target   = this.targetHurtBox;
                 component.ownership.ownerObject = base.gameObject;
                 gameObject.AddComponent <DestroyOnTimer>().duration = this.duration;
                 NetworkServer.Spawn(gameObject);
             }
         }
     }
 }
Esempio n. 2
0
        private bool HealBeamController_HealBeamAlreadyExists_GO_HC(
            On.RoR2.HealBeamController.orig_HealBeamAlreadyExists_GameObject_HealthComponent orig,
            GameObject owner, HealthComponent targetHealthComponent
            )
        {
            // Note that this is incompatible with other mods. This applies a fix on Emergency Drone.
            // Configs are applied on hook assignment so no need to check here.
            List <HealBeamController> instancesList = InstanceTracker.GetInstancesList <HealBeamController>();

            for (int i = 0; i < instancesList.Count; i++)
            {
                HealBeamController hbc = instancesList[i];
                if (!hbc || !hbc.target || !hbc.target.healthComponent || !targetHealthComponent || !hbc.ownership || !hbc.ownership.ownerObject)
                {
                    continue;
                }
                if (hbc.target.healthComponent == targetHealthComponent && hbc.ownership.ownerObject == owner)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 3
0
 // Token: 0x06002148 RID: 8520 RVA: 0x000901EE File Offset: 0x0008E3EE
 private bool TargetPassesFilters(HurtBox hurtBox)
 {
     return(EmergencyDroneCustomTarget.IsHurt(hurtBox) && !HealBeamController.HealBeamAlreadyExists(this.ai.body.gameObject, hurtBox.healthComponent));
 }
Esempio n. 4
0
        private void HealBeamController_OnTickServer(On.RoR2.HealBeamController.orig_OnTickServer orig, HealBeamController self)
        {
            bool          hasBody = self && self.ownership && self.ownership.ownerObject;
            CharacterBody body    = null;

            if (hasBody)
            {
                body    = self.ownership.ownerObject.GetComponent <CharacterBody>();
                hasBody = body;
            }
            if (hasBody)
            {
                healingSourceStack.Push(body);
            }
            orig(self);
            if (hasBody)
            {
                healingSourceStack.Pop();
            }
        }
 // Token: 0x06003189 RID: 12681 RVA: 0x000D571F File Offset: 0x000D391F
 private bool NotAlreadyHealingTarget(HurtBox hurtBox)
 {
     return(!HealBeamController.HealBeamAlreadyExists(base.gameObject, hurtBox));
 }