private void ResetShield()
        {
            if (Shield != null)
            {
                player.ReferenceHub.playerStats.GetModule <AhpStat>().ServerKillProcess(Shield.KillCode);
            }

            Shield = null;
        }
Esempio n. 2
0
        public static bool Prefix(Hypothermia __instance)
        {
            IShielded shielded = __instance.Hub.scpsController.CurrentScp as PlayableScps.Interfaces.IShielded;

            if (!__instance.IsSCP || !__instance.IsEnabled)
            {
                return(false);
            }

            AhpStat.AhpProcess Shield = null;
            if (__instance.Hub.TryGetComponent <SanyaPluginComponent>(out var sanya) && sanya.Shield != null)
            {
                Shield = sanya.Shield;
            }

            if (shielded != null)
            {
                Shield = shielded.Shield;
            }

            if (Shield == null)
            {
                return(false);
            }

            if (Shield.CurrentAmount <= 0f || Shield.CurrentAmount >= Shield.Limit || Shield.SustainTime > __instance._hsSustainTime)
            {
                __instance._humeBlocked = false;
                return(false);
            }

            Shield.SustainTime = __instance._hsSustainTime;

            if (!__instance._humeBlocked)
            {
                __instance._humeBlocked = true;
                __instance.Hub.networkIdentity.connectionToClient.Send(default(Hypothermia.HumeBlockMsg), 0);
            }

            return(false);
        }
        private void SetupShield(RoleType roleType)
        {
            if (Shield != null)
            {
                ResetShield();
            }

            Shield = player.ReferenceHub.playerStats.GetModule <AhpStat>().ServerAddProcess(0f, 0f, 0f, 1f, 0f, true);

            if (roleType == RoleType.Scp049)
            {
                Shield.CurrentAmount = SanyaPlugin.Instance.Config.Scp049MaxAhp;
                Shield.DecayRate     = -SanyaPlugin.Instance.Config.Scp049RegenRate;
                Shield.Limit         = SanyaPlugin.Instance.Config.Scp049MaxAhp;
            }
            else if (roleType == RoleType.Scp106)
            {
                Shield.CurrentAmount = SanyaPlugin.Instance.Config.Scp106MaxAhp;
                Shield.DecayRate     = -SanyaPlugin.Instance.Config.Scp106RegenRate;
                Shield.Limit         = SanyaPlugin.Instance.Config.Scp106MaxAhp;
            }
        }
Esempio n. 4
0
 private static bool ServerAddProcess(AhpStat __instance, float amount, out AhpStat.AhpProcess __result)
 {
     __result = __instance.ServerAddProcess(amount, __instance.GetPlayer().MaxArtificialHealth, 1.2f, 0.7f, 0f, false);
     return(false);
 }