Esempio n. 1
0
        private void FixedUpdate_On(HooksCore.RoR2.CharacterBody.FixedUpdate.Orig orig, CharacterBody self)
        {
            try { orig(self); } catch (Exception e) { Log.Error($"Caught exception in CharacterBody.FixedUpdate orig, {e}"); }
            var data = self.GetOrCreateDField(BodyData.handle);

            foreach (var def in TempOverlaysCatalog.EnumerateEntries())
            {
                if (def.entry !.index is not Index ind)
                {
                    continue;
                }
                ref var curOverlay = ref data[ind];
                if (def.ShouldHaveOverlay(self))
                {
                    if (curOverlay is null)
                    {
                        curOverlay = self.AddComponent <TemporaryOverlay>();
                        def.CreateOverlay(curOverlay, self);
                        curOverlay.AddToCharacerModel(self.modelLocator.modelTransform.GetComponent <CharacterModel>());
                    }
                }
                else
                {
                    if (curOverlay is not null)
                    {
                        curOverlay.RemoveFromCharacterModel();
                        curOverlay.Destroy();
                        curOverlay = null;
                    }
                }
            }
Esempio n. 2
0
 private void FixedUpdate_On(HooksCore.RoR2.CharacterBody.FixedUpdate.Orig orig, CharacterBody self)
 {
     orig(self);
     if (NetworkServer.active)
     {
         Int32 count = self.GetBuffCount(RW_flameChargeBuff);
         if (count > 0)
         {
             self.healthComponent.AddBarrier(Time.fixedDeltaTime * shieldRegenFrac * Mathf.Pow(count, 1f / rootNumber) * self.healthComponent.fullCombinedHealth);
         }
     }
 }
Esempio n. 3
0
        private static void FixedUpdate_On(HooksCore.RoR2.CharacterBody.FixedUpdate.Orig orig, CharacterBody self)
        {
            var dt = Time.fixedDeltaTime;

            try { orig(self); } catch { }
            if (self.hasEffectiveAuthority)
            {
                var maxHp  = self.maxHealth;
                var bcount = self.GetBuffCount(CatalogModule.sporeHealBuff);
                if (bcount > 0)
                {
                    self.healthComponent.Heal(bcount * maxHp * dt * SporeContext.healPercentBase, default);
                }
                var cbcount = self.GetBuffCount(CatalogModule.critSporeHealBuff);
                if (cbcount > 0)
                {
                    var ogch = self.critHeal;
                    self.critHeal = 100f;
                    self.healthComponent.Heal(cbcount * maxHp * dt * SporeContext.healPercentBase, default);
                    self.critHeal = ogch;
                }
            }
        }