示例#1
0
 public void RecieveNetwork(float calories, float water, float rad, float anti, float temp, float poison)
 {
     this.caloricLevel    = calories;
     this.waterLevelLitre = water;
     this.radiationLevel  = rad;
     this.antiRads        = anti;
     this.coreTemperature = temp;
     this.poisonLevel     = poison;
     if (temp >= 1f)
     {
         this._lastWarmTime = Time.time;
     }
     else if (temp < 0f)
     {
         this._lastWarmTime = -1000f;
     }
     RPOS.MetabolismUpdate();
 }
示例#2
0
        public static void RecieveNetwork(Metabolism m, float cal, float water, float rad, float anti, float temp, float poison)
        {
            bool h = false;

            Fougerite.Player p = null;
            if (m.playerClient != null)
            {
                p = Fougerite.Server.Cache[m.playerClient.userID];
            }
            if (float.IsNaN(cal) || cal > 3000)
            {
                m.caloricLevel = 600;
                if (p != null)
                {
                    Logger.LogDebug("[CalorieHack] " + p.Name + " | " + p.SteamID + " is using calorie hacks! =)");
                    Fougerite.Server.GetServer().Broadcast("CalorieHack Detected: " + p.Name);
                    Fougerite.Server.GetServer().BanPlayer(p, "Console", "CalorieHack");
                    h = true;
                }
            }
            else
            {
                m.caloricLevel = cal;
            }
            if (rad > 5000)
            {
                m.radiationLevel = 0;
                h = true;
                if (p != null)
                {
                    Logger.LogDebug("[RadiationHack] Someone tried to kill " + p.Name + " with radiation hacks.");
                }
            }
            else if (float.IsNaN(rad))
            {
                m.radiationLevel = 0;
                h = true;
                if (p != null)
                {
                    Logger.LogDebug("[RadiationHack] " + p.Name + " using radiation hacks.");
                    Fougerite.Server.GetServer().Broadcast("RadiationHack Detected: " + p.Name);
                    Fougerite.Server.GetServer().BanPlayer(p, "Console", "RadiationHack");
                }
            }
            else
            {
                m.radiationLevel = rad;
            }
            if (float.IsNaN(poison) || poison > 5000)
            {
                m.poisonLevel = 0;
                h             = true;
            }
            else
            {
                m.poisonLevel = poison;
            }
            if (float.IsNaN(water) || water > 5000)
            {
                m.waterLevelLitre = 0;
                h = true;
            }
            else
            {
                m.waterLevelLitre = water;
            }
            if (float.IsNaN(anti) || anti > 5000)
            {
                m.antiRads = 0;
                h          = true;
            }
            else
            {
                m.antiRads = anti;
            }
            if (float.IsNaN(temp) || temp > 5000)
            {
                m.coreTemperature = 0;
                h = true;
            }
            else
            {
                m.coreTemperature = temp;
            }
            if ((double)m.coreTemperature >= 1.0)
            {
                m._lastWarmTime = Time.time;
            }
            else if ((double)m.coreTemperature < 0.0)
            {
                m._lastWarmTime = -1000f;
            }

            if (OnRecieveNetwork != null)
            {
                OnRecieveNetwork(p, m, cal, water, rad, anti, temp, poison);
            }
            if (!h)
            {
                RPOS.MetabolismUpdate();
            }
        }