Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 139.70 KB | None | 0 0
  1. using ConVar;
  2. using Facepunch;
  3. using Facepunch.Rust;
  4. using Facepunch.Steamworks;
  5. using GameMenu;
  6. using Network;
  7. using ProtoBuf;
  8. using Rust;
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Generic;
  12. using System.Diagnostics;
  13. using System.Runtime.CompilerServices;
  14. using System.Runtime.InteropServices;
  15. using System.Text;
  16. using UnityEngine;
  17. using UnityEngine.Assertions;
  18.  
  19. public class BasePlayer : BaseCombatEntity
  20. {
  21.     private GameMenu.Option __menuOption_Climb;
  22.     private GameMenu.Option __menuOption_Drink;
  23.     private GameMenu.Option __menuOption_InviteToTeam;
  24.     private GameMenu.Option __menuOption_Menu_AssistPlayer;
  25.     private GameMenu.Option __menuOption_Menu_LootPlayer;
  26.     private GameMenu.Option __menuOption_Promote;
  27.     private GameMenu.Option __menuOption_SaltWater;
  28.     protected string _displayName;
  29.     [CompilerGenerated]
  30.     private static Comparison<TraceInfo> <>f__am$cache0;
  31.     public PlayerBelt Belt;
  32.     [NonSerialized]
  33.     public PlayerBlueprints blueprints;
  34.     private BuildingPrivlidge cachedBuildingPrivilege;
  35.     private float cachedBuildingPrivilegeTime;
  36.     private ProtectionProperties cachedProtection;
  37.     private float cachedThreatLevel;
  38.     private uint clActiveItem;
  39.     public PlayerTeam clientTeam;
  40.     public float clothingAccuracyBonus;
  41.     public bool clothingBlocksAiming;
  42.     public float clothingMoveSpeedReduction;
  43.     public float clothingWaterSpeedBonus;
  44.     [NonSerialized]
  45.     public BaseCollision collision;
  46.     public static int craftMode = 0;
  47.     public ulong currentTeam;
  48.     [NonSerialized]
  49.     public CameraMode currentViewMode;
  50.     private bool debugPrevVisible;
  51.     private const int displayNameMaxLength = 0x20;
  52.     private const float drinkMovementSpeed = 0.1f;
  53.     private const float drinkRange = 1.5f;
  54.     public GameObjectRef drownEffect;
  55.     public bool equippingBlocked;
  56.     [NonSerialized]
  57.     public PlayerEyes eyes;
  58.     [Header("BasePlayer")]
  59.     public GameObjectRef fallDamageEffect;
  60.     [NonSerialized]
  61.     public bool Frozen;
  62.     [NonSerialized]
  63.     public PlayerInput input;
  64.     [NonSerialized]
  65.     public PlayerInventory inventory;
  66.     private uint lastClothesHash = uint.MaxValue;
  67.     public static float lastDeathTimeClient = -1f;
  68.     private float lastHeadshotSoundTime;
  69.     private Vector3 lastReviveDirection;
  70.     private Vector3 lastRevivePoint;
  71.     private PlayerTick lastSentTick;
  72.     private float lastSentTickTime;
  73.     private float lastTimeSeen;
  74.     private float lastUpdateTime;
  75.     [NonSerialized]
  76.     public GameObject lookingAt;
  77.     [NonSerialized]
  78.     public Collider lookingAtCollider;
  79.     [NonSerialized]
  80.     public BaseEntity lookingAtEntity;
  81.     [NonSerialized]
  82.     public Vector3 lookingAtPoint;
  83.     private HitTest lookingAtTest;
  84.     [ClientVar(ClientAdmin=true)]
  85.     public static string lootPanelOverride = string.Empty;
  86.     private int maxProjectileID;
  87.     [NonSerialized]
  88.     public PlayerMetabolism metabolism;
  89.     [NonSerialized]
  90.     public ModelState modelState;
  91.     [NonSerialized]
  92.     private EntityRef mounted;
  93.     [NonSerialized]
  94.     public BaseMovement movement;
  95.     private bool needsClothesRebuild;
  96.     private float nextSeatSwapTime;
  97.     private float nextTopologyTestTime;
  98.     private float nextVisThink;
  99.     public static bool oldCameraFix = false;
  100.     [NonSerialized]
  101.     private Rigidbody physicsRigidbody;
  102.     private const string playerCollisionPrefab = "assets/prefabs/player/player_collision.prefab";
  103.     [InspectorFlags]
  104.     public PlayerFlags playerFlags;
  105.     [NonSerialized]
  106.     public PlayerModel playerModel;
  107.     private const string playerModelPrefab = "assets/prefabs/player/player_model.prefab";
  108.     [NonSerialized]
  109.     public CameraMode selectedViewMode;
  110.     [NonSerialized]
  111.     private Collider triggerCollider;
  112.     private float useHeldTime;
  113.     private float usePressTime;
  114.     [NonSerialized]
  115.     public ulong userID;
  116.     [NonSerialized]
  117.     public string UserIDString;
  118.     private static ListDictionary<ulong, BasePlayer> visiblePlayerList = new ListDictionary<ulong, BasePlayer>(8);
  119.     [NonSerialized]
  120.     public PlayerVoiceRecorder voiceRecorder;
  121.     [NonSerialized]
  122.     public PlayerVoiceSpeaker voiceSpeaker;
  123.     private float wakeTime;
  124.     private bool wasSleeping;
  125.  
  126.     public BasePlayer()
  127.     {
  128.         ModelState state = new ModelState {
  129.             onground = true
  130.         };
  131.         this.modelState = state;
  132.         this.lastUpdateTime = float.NegativeInfinity;
  133.         this.lastSentTickTime = float.NegativeInfinity;
  134.         this.debugPrevVisible = true;
  135.     }
  136.  
  137.     private bool AnyPartVisible()
  138.     {
  139.         Vector3 position = LocalPlayer.Entity.eyes.position;
  140.         Vector3 vector2 = LocalPlayer.Entity.eyes.HeadRight();
  141.         Vector3 b = base.CenterPoint();
  142.         if (this.IsSleeping())
  143.         {
  144.             b += new Vector3(0f, 1f, 0f);
  145.         }
  146.         float dist = Vector3.Distance(position, b);
  147.         bool flag = false;
  148.         flag = this.PointSeePoint(position, b, dist, true);
  149.         if (!this.IsSleeping())
  150.         {
  151.             if (!flag && (PlayerCull.visQuality > 0))
  152.             {
  153.                 Vector3 origin = this.eyes.position;
  154.                 flag = this.PointSeePoint(position, origin, dist, false);
  155.             }
  156.             if (!flag && (PlayerCull.visQuality > 1))
  157.             {
  158.                 Vector3 vector5 = b + ((Vector3) (vector2 * 0.25f));
  159.                 flag = this.PointSeePoint(position, vector5, dist, false);
  160.                 if (!flag)
  161.                 {
  162.                     Vector3 vector6 = b + ((Vector3) (vector2 * -0.25f));
  163.                     flag = this.PointSeePoint(position, vector6, dist, false);
  164.                 }
  165.             }
  166.             if (!flag && (PlayerCull.visQuality > 2))
  167.             {
  168.                 flag = this.PointSeePoint(position, base.transform.position + new Vector3(0f, 0.1f, 0f), dist, false);
  169.             }
  170.         }
  171.         return flag;
  172.     }
  173.  
  174.     public static bool AnyPlayersVisibleToEntity(Vector3 pos, float radius, BaseEntity source, Vector3 entityEyePos, bool ignorePlayersWithPriv = false)
  175.     {
  176.         List<RaycastHit> hits = Facepunch.Pool.GetList<RaycastHit>();
  177.         List<BasePlayer> list = Facepunch.Pool.GetList<BasePlayer>();
  178.         Vis.Entities<BasePlayer>(pos, radius, list, 0x20000, QueryTriggerInteraction.Collide);
  179.         bool flag = false;
  180.         foreach (BasePlayer player in list)
  181.         {
  182.             if ((player.IsSleeping() || !player.IsAlive()) || (player.IsBuildingAuthed() && ignorePlayersWithPriv))
  183.             {
  184.                 continue;
  185.             }
  186.             hits.Clear();
  187.             Vector3 vector = entityEyePos - player.eyes.position;
  188.             GamePhysics.TraceAll(new Ray(player.eyes.position, vector.normalized), 0f, hits, 9f, 0x48a12101, QueryTriggerInteraction.UseGlobal);
  189.             for (int i = 0; i < hits.Count; i++)
  190.             {
  191.                 BaseEntity entity = hits[i].GetEntity();
  192.                 if ((entity != null) && ((entity == source) || entity.EqualNetID(source)))
  193.                 {
  194.                     flag = true;
  195.                     break;
  196.                 }
  197.                 if ((entity == null) || entity.ShouldBlockProjectiles())
  198.                 {
  199.                     break;
  200.                 }
  201.             }
  202.             if (flag)
  203.             {
  204.                 break;
  205.             }
  206.         }
  207.         Facepunch.Pool.FreeList<RaycastHit>(ref hits);
  208.         Facepunch.Pool.FreeList<BasePlayer>(ref list);
  209.         return flag;
  210.     }
  211.  
  212.     public virtual void BlockJump(float duration = 0.5f)
  213.     {
  214.         if (this.movement != null)
  215.         {
  216.             this.movement.BlockJump(duration);
  217.         }
  218.     }
  219.  
  220.     public virtual void BlockSprint(float duration = 0.2f)
  221.     {
  222.         if (this.movement != null)
  223.         {
  224.             this.movement.BlockSprint(duration);
  225.         }
  226.     }
  227.  
  228.     private float CalcVisUpdateRate(float dist)
  229.     {
  230.         if (this.IsSleeping() && (dist > PlayerCull.maxSleeperDist))
  231.         {
  232.             if (dist > 80f)
  233.             {
  234.                 return 10f;
  235.             }
  236.             if (dist > 30f)
  237.             {
  238.                 return 3f;
  239.             }
  240.             if (dist > 15f)
  241.             {
  242.                 return 1f;
  243.             }
  244.         }
  245.         return (1f / Mathf.Clamp(PlayerCull.updateRate, 0.015f, float.PositiveInfinity));
  246.     }
  247.  
  248.     public bool CanAttack()
  249.     {
  250.         HeldEntity heldEntity = this.GetHeldEntity();
  251.         if (heldEntity == null)
  252.         {
  253.             return false;
  254.         }
  255.         bool flag = this.IsSwimming();
  256.         bool flag2 = heldEntity.CanBeUsedInWater();
  257.         if (this.movement != null)
  258.         {
  259.             if (this.movement.adminCheat)
  260.             {
  261.                 return true;
  262.             }
  263.             if (!flag && !this.movement.IsGrounded)
  264.             {
  265.                 return false;
  266.             }
  267.         }
  268.         if (this.modelState.onLadder)
  269.         {
  270.             return false;
  271.         }
  272.         if (!flag && !this.modelState.onground)
  273.         {
  274.             return false;
  275.         }
  276.         if (flag && !flag2)
  277.         {
  278.             return false;
  279.         }
  280.         return true;
  281.     }
  282.  
  283.     public override bool CanBeLooted(BasePlayer player)
  284.     {
  285.         if (player == this)
  286.         {
  287.             return false;
  288.         }
  289.         return (this.IsWounded() || this.IsSleeping());
  290.     }
  291.  
  292.     public bool CanBuild()
  293.     {
  294.         BuildingPrivlidge buildingPrivilege = this.GetBuildingPrivilege();
  295.         return ((buildingPrivilege == null) || buildingPrivilege.IsAuthed(this));
  296.     }
  297.  
  298.     public bool CanBuild(OBB obb)
  299.     {
  300.         BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(obb);
  301.         return ((buildingPrivilege == null) || buildingPrivilege.IsAuthed(this));
  302.     }
  303.  
  304.     public bool CanBuild(Vector3 position, Quaternion rotation, Bounds bounds)
  305.     {
  306.         BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(new OBB(position, rotation, bounds));
  307.         return ((buildingPrivilege == null) || buildingPrivilege.IsAuthed(this));
  308.     }
  309.  
  310.     public bool CanInteract()
  311.     {
  312.         return ((!this.IsDead() && !this.IsSleeping()) && !this.IsWounded());
  313.     }
  314.  
  315.     public bool CanMove()
  316.     {
  317.         if (!this.HasLocalControls())
  318.         {
  319.             return false;
  320.         }
  321.         return true;
  322.     }
  323.  
  324.     public bool CanPlaceBuildingPrivilege()
  325.     {
  326.         return (this.GetBuildingPrivilege() == null);
  327.     }
  328.  
  329.     public bool CanPlaceBuildingPrivilege(OBB obb)
  330.     {
  331.         return (base.GetBuildingPrivilege(obb) == null);
  332.     }
  333.  
  334.     public bool CanPlaceBuildingPrivilege(Vector3 position, Quaternion rotation, Bounds bounds)
  335.     {
  336.         return (base.GetBuildingPrivilege(new OBB(position, rotation, bounds)) == null);
  337.     }
  338.  
  339.     public bool CanRotate()
  340.     {
  341.         if (!this.IsSpectating() && !this.HasLocalControls())
  342.         {
  343.             return false;
  344.         }
  345.         return true;
  346.     }
  347.  
  348.     public override string Categorize()
  349.     {
  350.         return "player";
  351.     }
  352.  
  353.     public void ChatMessage(string msg)
  354.     {
  355.         if (base.isClient)
  356.         {
  357.             object[] args = new object[] { 0, msg };
  358.             ConsoleSystem.Run(ConsoleSystem.Option.Client, "chat.add", args);
  359.         }
  360.     }
  361.  
  362.     private bool CheckLookingAtVisible(HitTest test, TraceInfo trace)
  363.     {
  364.         RaycastHit hit;
  365.         Vector3 origin = test.AttackRay.origin;
  366.         Vector3 vector3 = trace.point - origin;
  367.         float magnitude = vector3.magnitude;
  368.         if (magnitude < Mathf.Epsilon)
  369.         {
  370.             return true;
  371.         }
  372.         Vector3 direction = (Vector3) (vector3 / magnitude);
  373.         Ray ray = new Ray(origin, direction);
  374.         if (!UnityEngine.Physics.Raycast(ray, out hit, magnitude + 0.01f, 0x48a12001))
  375.         {
  376.             return true;
  377.         }
  378.         BaseEntity other = hit.GetEntity();
  379.         return ((other == trace.entity) || ((((other != null) && (trace.entity.GetParentEntity() != null)) && (trace.entity.GetParentEntity().EqualNetID(other) && (hit.collider != null))) && (hit.collider.gameObject.layer == 13)));
  380.     }
  381.  
  382.     public void CL_ClothingChanged()
  383.     {
  384.         if (this.playerModel != null)
  385.         {
  386.             uint num = this.inventory.containerWear.ContentsHash();
  387.             if (this.lastClothesHash != num)
  388.             {
  389.                 this.needsClothesRebuild = true;
  390.             }
  391.             this.lastClothesHash = num;
  392.             this.UpdateClothingItems(this.playerModel.multiMesh);
  393.             if (this == LocalPlayer.Entity)
  394.             {
  395.                 if ((BaseViewModel.ActiveModel != null) && this.needsClothesRebuild)
  396.                 {
  397.                     BaseViewModel.ActiveModel.OnClothingChanged();
  398.                 }
  399.                 if (this.inventory.containerWear.itemList.Count >= 3)
  400.                 {
  401.                     this.RecieveAchievement("EQUIP_CLOTHING");
  402.                 }
  403.             }
  404.         }
  405.     }
  406.  
  407.     public static void ClearVisibility()
  408.     {
  409.         BasePlayer[] buffer = VisiblePlayerList.Buffer;
  410.         int count = VisiblePlayerList.Count;
  411.         for (int i = 0; i < count; i++)
  412.         {
  413.             buffer[i].UnregisterFromCulling();
  414.         }
  415.         visiblePlayerList.Clear();
  416.     }
  417.  
  418.     [RPC_Client]
  419.     public void CLIENT_ClearTeam(BaseEntity.RPCMessage msg)
  420.     {
  421.         this.clientTeam = null;
  422.         TeamUI.dirty = true;
  423.         SingletonComponent<MapInterface>.Instance.ClientTeamUpdated();
  424.     }
  425.  
  426.     [RPC_Client]
  427.     public void CLIENT_PendingInvite(BaseEntity.RPCMessage msg)
  428.     {
  429.         string str = msg.read.String();
  430.         ulong num = msg.read.UInt64();
  431.         if (((TeamUI.pendingTeamID == 0L) && (this.clientTeam == null)) && (num != 0L))
  432.         {
  433.             LocalPlayer.Entity.ChatMessage("You have been invited to " + str + "'s team");
  434.             Vector3 normWorld = new Vector3();
  435.             Effect.client.Run("assets/bundled/prefabs/fx/invite_notice.prefab", LocalPlayer.Entity.eyes.position, normWorld, new Vector3());
  436.         }
  437.         TeamUI.pendingTeamLeaderName = str;
  438.         TeamUI.pendingTeamID = num;
  439.     }
  440.  
  441.     [RPC_Client]
  442.     public void CLIENT_ReceiveTeamInfo(BaseEntity.RPCMessage msg)
  443.     {
  444.         PlayerTeam team = PlayerTeam.Deserialize(msg.read);
  445.         team.ShouldPool = false;
  446.         this.clientTeam = team;
  447.         TeamUI.dirty = true;
  448.         SingletonComponent<MapInterface>.Instance.ClientTeamUpdated();
  449.     }
  450.  
  451.     public static void ClientCycle(float deltaTime)
  452.     {
  453.         UpdatePlayerVisibilities();
  454.         BasePlayer[] buffer = VisiblePlayerList.Buffer;
  455.         int count = VisiblePlayerList.Count;
  456.         for (int i = 0; i < count; i++)
  457.         {
  458.             BasePlayer player = buffer[i];
  459.             if (player.IsSleeping() && player.IsAlive())
  460.             {
  461.                 player.ClientUpdate_Sleeping();
  462.             }
  463.             else
  464.             {
  465.                 player.ClientUpdate();
  466.             }
  467.         }
  468.         if (LocalPlayer.Entity != null)
  469.         {
  470.             LocalPlayer.Entity.ClientUpdateLocalPlayer();
  471.         }
  472.     }
  473.  
  474.     protected override void ClientInit(ProtoBuf.Entity info)
  475.     {
  476.         this.voiceSpeaker = base.GetComponent<PlayerVoiceSpeaker>();
  477.         this.inventory.ClientInit(this);
  478.         base.ClientInit(info);
  479.         if (!this.IsNpc)
  480.         {
  481.             SteamFriendsList.JustSeen(this.userID);
  482.         }
  483.         UnregisterFromVisibility(this.userID);
  484.         RegisterForVisibility(this);
  485.         bool flag = this.userID == ((Client.Steam != null) ? Client.Steam.SteamId : 0L);
  486.         if (Client.IsPlayingDemo)
  487.         {
  488.             flag = false;
  489.         }
  490.         if (flag)
  491.         {
  492.             if ((LocalPlayer.Entity != null) && (LocalPlayer.Entity != this))
  493.             {
  494.                 UnityEngine.Debug.LogError("Local player is being set up multiple times!!");
  495.             }
  496.             else
  497.             {
  498.                 this.InitLocalPlayer();
  499.             }
  500.         }
  501.         else
  502.         {
  503.             this.InitRemotePlayer();
  504.         }
  505.     }
  506.  
  507.     internal virtual void ClientInput(InputState state)
  508.     {
  509.         this.input.FrameUpdate();
  510.         this.modelState.ducked = false;
  511.         this.modelState.sprinting = false;
  512.         this.modelState.aiming = false;
  513.         this.modelState.sleeping = this.IsSleeping();
  514.         this.modelState.waterLevel = this.WaterFactor();
  515.         this.voiceRecorder.ClientInput(state);
  516.         if (this.HasLocalControls() && !NeedsKeyboard.AnyActive())
  517.         {
  518.             this.Belt.ClientInput(state);
  519.         }
  520.         else
  521.         {
  522.             UIInventory.Close();
  523.             MapInterface.SetOpen(false);
  524.         }
  525.         if (!this.Frozen)
  526.         {
  527.             this.HeldEntityInput();
  528.             if (this.movement != null)
  529.             {
  530.                 using (TimeWarning.New("movement.ClientInput", (float) 0.1f))
  531.                 {
  532.                     this.movement.ClientInput(state, this.modelState);
  533.                 }
  534.             }
  535.             using (TimeWarning.New("UseAction", (float) 0.1f))
  536.             {
  537.                 this.UseAction(state);
  538.             }
  539.             if ((Buttons.Chat.JustPressed && this.input.hadInputBuffer) && (ConVar.Graphics.chat && Chat.enabled))
  540.             {
  541.                 Chat.open();
  542.             }
  543.             using (TimeWarning.New("MapInterface Update", (float) 0.1f))
  544.             {
  545.                 MapInterface.DoPlayerUpdate();
  546.                 MapInterface.SetOpen(Buttons.Map.IsDown);
  547.             }
  548.         }
  549.     }
  550.  
  551.     private void ClientTick()
  552.     {
  553.         if (((Network.Net.cl != null) && Network.Net.cl.IsConnected()) && !LoadingScreen.isOpen)
  554.         {
  555.             this.SendClientTick();
  556.         }
  557.     }
  558.  
  559.     protected void ClientUpdate()
  560.     {
  561.         this.UpdateClothesIfNeeded();
  562.         if (this.movement != null)
  563.         {
  564.             this.movement.gameObject.SetActive(this.IsAlive() && !this.IsSpectating());
  565.         }
  566.         if (this.isMounted)
  567.         {
  568.             this.GetMounted().UpdatePlayerPosition(this);
  569.         }
  570.         if (this.playerModel != null)
  571.         {
  572.             this.playerModel.UpdateLocalVelocity(base.GetLocalVelocity(), base.transform.parent);
  573.             this.playerModel.ApplyVisibility(base.isVisible, base.isAnimatorVisible, base.isShadowVisible);
  574.             if (!base.isVisible)
  575.             {
  576.                 this.playerModel.position = base.transform.position;
  577.                 this.playerModel.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
  578.                 this.playerModel.visible = false;
  579.                 this.playerModel.UpdatePosition();
  580.                 this.playerModel.UpdateRotation();
  581.             }
  582.             else
  583.             {
  584.                 bool flag = this.IsAlive() && !this.IsSpectating();
  585.                 if (this.playerModel.gameObject.activeSelf != flag)
  586.                 {
  587.                     if (!flag)
  588.                     {
  589.                         Effect.Strip(this.playerModel.gameObject);
  590.                     }
  591.                     this.playerModel.gameObject.SetActive(flag);
  592.                 }
  593.                 this.playerModel.position = base.transform.position;
  594.                 this.playerModel.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
  595.                 this.playerModel.visible = !this.IsDead();
  596.                 this.playerModel.isIncapacitated = this.IsWounded();
  597.                 HeldEntity heldEntity = this.GetHeldEntity();
  598.                 if (heldEntity != null)
  599.                 {
  600.                     heldEntity.UpdatePlayerModel(this.playerModel);
  601.                 }
  602.                 else
  603.                 {
  604.                     this.playerModel.SetHoldType(null);
  605.                     this.playerModel.SetAimSounds(null, null);
  606.                 }
  607.                 this.playerModel.LookAngles = Quaternion.LookRotation(this.eyes.BodyForward(), !this.isMounted ? Vector3.up : base.transform.up);
  608.                 this.playerModel.UpdateModelState(this.modelState);
  609.                 this.playerModel.FrameUpdate(this.IsWounded());
  610.                 if (this.isMounted)
  611.                 {
  612.                     BaseMountable mounted = this.GetMounted();
  613.                     mounted.UpdatePlayerRotation(this);
  614.                     mounted.UpdatePlayerModel(this);
  615.                 }
  616.             }
  617.         }
  618.         if (this.voiceSpeaker != null)
  619.         {
  620.             this.voiceSpeaker.ClientFrame(this);
  621.             if (this.playerModel != null)
  622.             {
  623.                 this.playerModel.voiceVolume = this.voiceSpeaker.currentVolume;
  624.             }
  625.         }
  626.     }
  627.  
  628.     protected void ClientUpdate_Sleeping()
  629.     {
  630.         if (((UnityEngine.Time.frameCount % 5) == (base.net.ID % 5)) || base.HasParent())
  631.         {
  632.             this.UpdateClothesIfNeeded();
  633.             if (this.playerModel != null)
  634.             {
  635.                 this.playerModel.ApplyVisibility(base.isVisible, base.isAnimatorVisible, base.isShadowVisible);
  636.                 if (!base.isVisible)
  637.                 {
  638.                     this.playerModel.position = base.transform.position;
  639.                     this.playerModel.rotation = base.transform.rotation;
  640.                     this.playerModel.visible = false;
  641.                     this.playerModel.UpdatePosition();
  642.                     this.playerModel.UpdateRotation();
  643.                 }
  644.                 else
  645.                 {
  646.                     this.playerModel.gameObject.SetActive(base.ragdoll == null);
  647.                     this.playerModel.position = base.transform.position;
  648.                     this.playerModel.rotation = base.transform.rotation;
  649.                     this.playerModel.visible = true;
  650.                     this.playerModel.isIncapacitated = false;
  651.                     this.modelState.lookDir = base.transform.forward;
  652.                     this.playerModel.UpdateModelState(this.modelState);
  653.                     this.playerModel.FrameUpdate(this.IsWounded());
  654.                 }
  655.             }
  656.         }
  657.     }
  658.  
  659.     public void ClientUpdateLocalPlayer()
  660.     {
  661.         this.ClientInput(this.input.state);
  662.         float num = 1f / ConVar.Client.tickrate;
  663.         bool flag = this.input.state.current.buttons != this.input.state.previous.buttons;
  664.         bool flag2 = (UnityEngine.Time.realtimeSinceStartup - this.lastSentTickTime) > num;
  665.         if (flag || flag2)
  666.         {
  667.             this.ClientTick();
  668.         }
  669.         this.UpdateViewMode();
  670.         BaseViewModel.HideViewmodel = this.currentViewMode != CameraMode.FirstPerson;
  671.         LODComponent.UpdateDynamicOccludees();
  672.         this.voiceRecorder.ClientFrame(this);
  673.         if (this.IsSleeping())
  674.         {
  675.             this.BlockJump(0.5f);
  676.         }
  677.         if (!this.Frozen)
  678.         {
  679.             ContextMenuUI.FrameUpdate(this);
  680.             ProgressBarUI.FrameUpdate(this);
  681.             if (this.movement != null)
  682.             {
  683.                 this.movement.FrameUpdate(this, this.modelState);
  684.             }
  685.             this.HeldEntityViewAngles();
  686.             this.MountableOverrideViewAngles();
  687.             this.input.ApplyViewAngles();
  688.             this.eyes.FrameUpdate(MainCamera.mainCamera);
  689.             this.modelState.lookDir = this.eyes.HeadForward();
  690.             this.Belt.FrameUpdate();
  691.             if (this.playerModel != null)
  692.             {
  693.                 this.playerModel.UpdateLocalVelocity(base.GetLocalVelocity(), base.transform.parent);
  694.                 this.playerModel.position = base.transform.position;
  695.                 this.playerModel.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
  696.                 this.playerModel.UpdatePosition();
  697.             }
  698.             if (!this.UpdateLookingAt(0f, false))
  699.             {
  700.                 this.UpdateLookingAt(Mathf.Clamp(ConVar.Client.lookatradius, 0f, 0.4f), true);
  701.             }
  702.             this.HeldEntityFrame();
  703.             if (this.CanRotate())
  704.             {
  705.                 if (this.isMounted)
  706.                 {
  707.                     base.transform.localRotation = this.GetMounted().GetMountedRotation();
  708.                 }
  709.                 else
  710.                 {
  711.                     base.transform.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
  712.                 }
  713.             }
  714.             if (this.IsAdmin || this.IsDeveloper)
  715.             {
  716.                 if (UnityEngine.Input.GetKeyDown(KeyCode.F3))
  717.                 {
  718.                     this.selectedViewMode += 1;
  719.                     if (this.selectedViewMode > CameraMode.Eyes)
  720.                     {
  721.                         this.selectedViewMode = CameraMode.FirstPerson;
  722.                     }
  723.                 }
  724.             }
  725.             else
  726.             {
  727.                 this.selectedViewMode = CameraMode.FirstPerson;
  728.             }
  729.             if (this.HasPlayerFlag(PlayerFlags.ThirdPersonViewmode))
  730.             {
  731.                 this.selectedViewMode = CameraMode.ThirdPerson;
  732.             }
  733.             if (this.HasPlayerFlag(PlayerFlags.EyesViewmode))
  734.             {
  735.                 this.selectedViewMode = CameraMode.Eyes;
  736.             }
  737.             this.UpdateTopologyStats();
  738.         }
  739.     }
  740.  
  741.     public void ClientUpdateMounted(uint id)
  742.     {
  743.         if (this.mounted.uid != id)
  744.         {
  745.             BaseMountable mounted = this.GetMounted();
  746.             this.mounted.uid = id;
  747.             BaseMountable mountable2 = this.GetMounted();
  748.             if (mounted != null)
  749.             {
  750.                 mounted.PlayerDismounted(this);
  751.             }
  752.             if (mountable2 != null)
  753.             {
  754.                 mountable2.PlayerMounted(this);
  755.             }
  756.         }
  757.     }
  758.  
  759.     public void ClientUpdatePersistantData(PersistantPlayer data)
  760.     {
  761.         this.blueprints.ClientUpdate(data);
  762.     }
  763.  
  764.     [ShowIf("Climb_ShowIf"), Menu("climb", "Climb"), Description("climb_desc", "Climb"), Icon("upgrade")]
  765.     public void Climb(BasePlayer player)
  766.     {
  767.         if (player.isMounted)
  768.         {
  769.             bool flag = false;
  770.             RaycastHit hit = new RaycastHit();
  771.             foreach (RaycastHit hit2 in UnityEngine.Physics.SphereCastAll(this.eyes.BodyRay(), 0.5f, 3f, 0x40000, QueryTriggerInteraction.Collide))
  772.             {
  773.                 if ((hit2.collider.GetComponent<TriggerLadder>() != null) && !UnityEngine.Physics.Raycast(this.eyes.BodyRay(), hit2.distance, 0x48a12001))
  774.                 {
  775.                     flag = true;
  776.                     hit = hit2;
  777.                     break;
  778.                 }
  779.             }
  780.             if (flag)
  781.             {
  782.                 bool flag2 = false;
  783.                 BaseEntity entity = hit.GetEntity();
  784.                 Vector3 position = hit.collider.transform.position;
  785.                 position.y = hit.point.y;
  786.                 LadderMinMountHeight componentInChildren = hit.collider.gameObject.GetComponentInChildren<LadderMinMountHeight>();
  787.                 if ((componentInChildren != null) && (position.y < componentInChildren.transform.position.y))
  788.                 {
  789.                     position.y = componentInChildren.transform.position.y;
  790.                 }
  791.                 position += (Vector3) (hit.collider.transform.forward * (player.GetRadius() + 0.1f));
  792.                 if (entity != null)
  793.                 {
  794.                     flag2 = true;
  795.                     position = entity.transform.InverseTransformPoint(position);
  796.                 }
  797.                 base.ServerRPC<bool, Vector3, uint>("RPC_StartClimb", flag2, position, entity.net.ID);
  798.             }
  799.         }
  800.     }
  801.  
  802.     public bool Climb_ShowIf(BasePlayer player)
  803.     {
  804.         if (player.isMounted)
  805.         {
  806.             foreach (RaycastHit hit in UnityEngine.Physics.RaycastAll(this.eyes.BodyRay(), 3f, 0x40000, QueryTriggerInteraction.Collide))
  807.             {
  808.                 if ((hit.collider.GetComponent<TriggerLadder>() != null) && !UnityEngine.Physics.Raycast(this.eyes.BodyRay(), hit.distance, 0x48a12001))
  809.                 {
  810.                     return true;
  811.                 }
  812.             }
  813.         }
  814.         return false;
  815.     }
  816.  
  817.     public void ConsoleMessage(string msg)
  818.     {
  819.         if (base.isClient)
  820.         {
  821.             ConsoleSystem.Run(ConsoleSystem.Option.Client, "echo " + msg, Array.Empty<object>());
  822.         }
  823.     }
  824.  
  825.     [RPC_Client]
  826.     public void CraftMode(BaseEntity.RPCMessage msg)
  827.     {
  828.         if ((LocalPlayer.Entity != null) && (this == LocalPlayer.Entity))
  829.         {
  830.             int num = msg.read.Int32();
  831.             if (craftMode != num)
  832.             {
  833.                 craftMode = num;
  834.                 LocalPlayer.OnInventoryChanged();
  835.                 UIBlueprints.Refresh();
  836.             }
  837.         }
  838.     }
  839.  
  840.     private void CreatePlayerCollision()
  841.     {
  842.         GameObject obj2 = base.gameManager.CreatePrefab("assets/prefabs/player/player_collision.prefab", base.transform.position, Quaternion.identity, false);
  843.         BaseEntityChild.Setup(obj2, this);
  844.         obj2.AwakeFromInstantiate();
  845.         this.collision = obj2.GetComponent<BaseCollision>();
  846.         this.collision.Owner = this;
  847.         this.collision.model = base.model;
  848.         this.collision.transform.parent = this.playerModel.transform;
  849.     }
  850.  
  851.     private void CreatePlayerModel()
  852.     {
  853.         if (this.playerModel != null)
  854.         {
  855.             UnityEngine.Debug.LogWarning("playerModel isn't null - but we're creating a new one!");
  856.         }
  857.         GameObject obj2 = base.gameManager.CreatePrefab("assets/prefabs/player/player_model.prefab", base.transform.position, Quaternion.identity, false);
  858.         BaseEntityChild.Setup(obj2, this);
  859.         obj2.AwakeFromInstantiate();
  860.         base.SetModel(obj2.GetComponent<Model>());
  861.         this.playerModel = obj2.GetComponent<PlayerModel>();
  862.         this.playerModel.skinType = (GetRandomFloatBasedOnUserID(this.userID, 0x10ecL) <= 0.5f) ? 0 : 1;
  863.         this.playerModel.skinColor = GetRandomFloatBasedOnUserID(this.userID, 0x1759L);
  864.         this.playerModel.skinNumber = GetRandomFloatBasedOnUserID(this.userID, 0xf87L);
  865.         this.playerModel.meshNumber = GetRandomFloatBasedOnUserID(this.userID, 0xa57L);
  866.         this.playerModel.hairNumber = GetRandomFloatBasedOnUserID(this.userID, 0x18c2L);
  867.         this.playerModel.showSash = this.HasPlayerFlag(PlayerFlags.DisplaySash);
  868.         this.playerModel.isLocalPlayer = this.IsLocalPlayer();
  869.         this.playerModel.drawShadowOnly = !this.shouldDrawBody;
  870.         this.playerModel.UpdateModelState(this.modelState);
  871.         this.playerModel.AlwaysAnimate(this.IsLocalPlayer());
  872.         this.playerModel.UpdateSkeleton((int) this.userID);
  873.         this.playerModel.IsNpc = this.IsNpc;
  874.         this.CL_ClothingChanged();
  875.     }
  876.  
  877.     private void CreatePlayerMovement()
  878.     {
  879.         if (!Client.IsPlayingDemo)
  880.         {
  881.             GameObject obj2 = base.gameManager.CreatePrefab("assets/prefabs/player/player_movement.prefab", base.transform.position, Quaternion.identity, true);
  882.             UnityEngine.Assertions.Assert.IsTrue(this.movement == null, "movement setup! InitLocalPlayer called multiple times!");
  883.             this.movement = obj2.GetComponent<BaseMovement>();
  884.             this.movement.SetParent(base.transform.parent);
  885.             this.movement.Init(this);
  886.         }
  887.     }
  888.  
  889.     public override void DestroyShared()
  890.     {
  891.         UnityEngine.Object.Destroy(this.cachedProtection);
  892.         UnityEngine.Object.Destroy(base.baseProtection);
  893.         base.DestroyShared();
  894.     }
  895.  
  896.     [RPC_Client]
  897.     private void DirectionalDamage(Vector3 position, int damageType)
  898.     {
  899.         if (SingletonComponent<UIUnderlay>.Instance != null)
  900.         {
  901.             SingletonComponent<UIUnderlay>.Instance.DirectionalDamage(position);
  902.         }
  903.     }
  904.  
  905.     public override bool DisplayHealthInfo(BasePlayer player)
  906.     {
  907.         return false;
  908.     }
  909.  
  910.     protected override void DoClientDestroy()
  911.     {
  912.         UnregisterFromVisibility(this.userID);
  913.         if (this.inventory != null)
  914.         {
  915.             this.inventory.DoDestroy();
  916.         }
  917.         base.DoClientDestroy();
  918.         if (this.movement != null)
  919.         {
  920.             GameObject gameObject = this.movement.gameObject;
  921.             this.movement = null;
  922.             gameObject.BroadcastOnParentDestroying();
  923.             GameManager.Destroy(gameObject, 0f);
  924.         }
  925.         if (this.collision != null)
  926.         {
  927.             GameObject go = this.collision.gameObject;
  928.             this.collision = null;
  929.             go.BroadcastOnParentDestroying();
  930.             GameManager.client.Retire(go);
  931.         }
  932.         if (this.playerModel != null)
  933.         {
  934.             GameObject obj4 = this.playerModel.gameObject;
  935.             this.playerModel = null;
  936.             base.SetModel(null);
  937.             obj4.BroadcastOnParentDestroying();
  938.             GameManager.client.Retire(obj4);
  939.         }
  940.     }
  941.  
  942.     public void DoMovement()
  943.     {
  944.         if ((this.IsLocalPlayer() && this.HasLocalControls()) && ((this.movement != null) && !this.Frozen))
  945.         {
  946.             this.movement.DoFixedUpdate(this.modelState);
  947.         }
  948.     }
  949.  
  950.     [Description("drink_desc", "Drink water"), Menu("drink", "Drink"), Icon("cup_water"), ShowIf("Drink_ShowIf")]
  951.     public void Drink(BasePlayer player)
  952.     {
  953.         if (player.metabolism.CanConsume())
  954.         {
  955.             Vector3 waterDrinkingPoint = player.GetWaterDrinkingPoint();
  956.             if ((waterDrinkingPoint != Vector3.zero) && WaterResource.IsFreshWater(waterDrinkingPoint))
  957.             {
  958.                 player.metabolism.MarkConsumption();
  959.                 base.ServerRPC<Vector3>("SV_Drink", waterDrinkingPoint);
  960.             }
  961.         }
  962.     }
  963.  
  964.     public bool Drink_ShowIf(BasePlayer player)
  965.     {
  966.         if (this.movement == null)
  967.         {
  968.             return false;
  969.         }
  970.         if (this.movement.CurrentMoveSpeed() > 0.1f)
  971.         {
  972.             return false;
  973.         }
  974.         Vector3 waterDrinkingPoint = player.GetWaterDrinkingPoint();
  975.         if (waterDrinkingPoint == Vector3.zero)
  976.         {
  977.             return false;
  978.         }
  979.         if (!WaterResource.IsFreshWater(waterDrinkingPoint))
  980.         {
  981.             return false;
  982.         }
  983.         WaterLevel.WaterInfo waterInfo = WaterLevel.GetWaterInfo(waterDrinkingPoint);
  984.         if (!waterInfo.isValid)
  985.         {
  986.             return false;
  987.         }
  988.         if (waterInfo.overallDepth < 0.01f)
  989.         {
  990.             return false;
  991.         }
  992.         return true;
  993.     }
  994.  
  995.     public void EnsureUpdated()
  996.     {
  997.         if ((UnityEngine.Time.realtimeSinceStartup - this.lastUpdateTime) >= 30f)
  998.         {
  999.             this.lastUpdateTime = UnityEngine.Time.realtimeSinceStartup;
  1000.             this.cachedThreatLevel = 0f;
  1001.             if (!this.IsSleeping())
  1002.             {
  1003.                 if (this.inventory.containerWear.itemList.Count > 2)
  1004.                 {
  1005.                     this.cachedThreatLevel++;
  1006.                 }
  1007.                 foreach (Item item in this.inventory.containerBelt.itemList)
  1008.                 {
  1009.                     BaseEntity heldEntity = item.GetHeldEntity();
  1010.                     if (((heldEntity != null) && (heldEntity is BaseProjectile)) && !(heldEntity is BowWeapon))
  1011.                     {
  1012.                         this.cachedThreatLevel += 2f;
  1013.                         break;
  1014.                     }
  1015.                 }
  1016.             }
  1017.         }
  1018.     }
  1019.  
  1020.     public static BasePlayer Find_Clientside(string strNameOrIDOrIP)
  1021.     {
  1022.         BasePlayer[] buffer = VisiblePlayerList.Buffer;
  1023.         int count = VisiblePlayerList.Count;
  1024.         for (int i = 0; i < count; i++)
  1025.         {
  1026.             BasePlayer player = buffer[i];
  1027.             if (player.UserIDString == strNameOrIDOrIP)
  1028.             {
  1029.                 return player;
  1030.             }
  1031.         }
  1032.         for (int j = 0; j < count; j++)
  1033.         {
  1034.             BasePlayer player2 = buffer[j];
  1035.             if (player2.displayName.StartsWith(strNameOrIDOrIP, StringComparison.CurrentCultureIgnoreCase))
  1036.             {
  1037.                 return player2;
  1038.             }
  1039.         }
  1040.         for (int k = 0; k < count; k++)
  1041.         {
  1042.             BasePlayer player3 = buffer[k];
  1043.             if (((player3.net != null) && (player3.net.connection != null)) && (player3.net.connection.ipaddress == strNameOrIDOrIP))
  1044.             {
  1045.                 return player3;
  1046.             }
  1047.         }
  1048.         return null;
  1049.     }
  1050.  
  1051.     public override Transform FindBone(string strName)
  1052.     {
  1053.         if ((this.playerModel != null) && (strName != string.Empty))
  1054.         {
  1055.             Transform transform = this.playerModel.FindBone(strName);
  1056.             if (transform != null)
  1057.             {
  1058.                 return transform;
  1059.             }
  1060.         }
  1061.         return base.FindBone(strName);
  1062.     }
  1063.  
  1064.     public static BasePlayer FindByID_Clientside(ulong userID)
  1065.     {
  1066.         BasePlayer player;
  1067.         visiblePlayerList.TryGetValue(userID, out player);
  1068.         return player;
  1069.     }
  1070.  
  1071.     [DebuggerHidden]
  1072.     private IEnumerator FinishedLoadingRoutine()
  1073.     {
  1074.         return new <FinishedLoadingRoutine>c__Iterator0 { $this = this };
  1075.     }
  1076.  
  1077.     [RPC_Client]
  1078.     private void FinishLoading()
  1079.     {
  1080.         base.StartCoroutine(this.FinishedLoadingRoutine());
  1081.     }
  1082.  
  1083.     [RPC_Client]
  1084.     private void ForcePositionTo(Vector3 position)
  1085.     {
  1086.         this.SetNetworkPosition((base.transform.parent == null) ? position : base.transform.parent.InverseTransformPoint(position));
  1087.         if (this.movement != null)
  1088.         {
  1089.             this.movement.TeleportTo(position, this);
  1090.         }
  1091.     }
  1092.  
  1093.     [RPC_Client]
  1094.     private void ForcePositionToParentOffset(Vector3 position, uint entID)
  1095.     {
  1096.         if (entID != 0)
  1097.         {
  1098.             BaseNetworkable networkable = BaseNetworkable.clientEntities.Find(entID);
  1099.             if (networkable != null)
  1100.             {
  1101.                 this.ForcePositionTo(networkable.transform.TransformPoint(position));
  1102.             }
  1103.         }
  1104.         else
  1105.         {
  1106.             this.ForcePositionTo(position);
  1107.         }
  1108.     }
  1109.  
  1110.     public void ForceUpdateTriggers(bool enter = true, bool exit = true, bool invoke = true)
  1111.     {
  1112.         List<TriggerBase> list = Facepunch.Pool.GetList<TriggerBase>();
  1113.         List<TriggerBase> list2 = Facepunch.Pool.GetList<TriggerBase>();
  1114.         if (base.triggers != null)
  1115.         {
  1116.             list.AddRange(base.triggers);
  1117.         }
  1118.         CapsuleCollider component = base.GetComponent<CapsuleCollider>();
  1119.         Vector3 vector = base.transform.position + new Vector3(0f, this.GetRadius(), 0f);
  1120.         Vector3 vector2 = base.transform.position + new Vector3(0f, this.GetHeight() - this.GetRadius(), 0f);
  1121.         GamePhysics.OverlapCapsule<TriggerBase>(vector, vector2, this.GetRadius(), list2, 0x40000, QueryTriggerInteraction.Collide);
  1122.         if (exit)
  1123.         {
  1124.             foreach (TriggerBase base2 in list)
  1125.             {
  1126.                 if (!list2.Contains(base2))
  1127.                 {
  1128.                     base2.OnTriggerExit(component);
  1129.                 }
  1130.             }
  1131.         }
  1132.         if (enter)
  1133.         {
  1134.             foreach (TriggerBase base3 in list2)
  1135.             {
  1136.                 if (!list.Contains(base3))
  1137.                 {
  1138.                     base3.OnTriggerEnter(component);
  1139.                 }
  1140.             }
  1141.         }
  1142.         Facepunch.Pool.FreeList<TriggerBase>(ref list);
  1143.         Facepunch.Pool.FreeList<TriggerBase>(ref list2);
  1144.         if (invoke)
  1145.         {
  1146.             base.Invoke(new Action(this.ForceUpdateTriggersAction), UnityEngine.Time.fixedDeltaTime * 1.5f);
  1147.         }
  1148.     }
  1149.  
  1150.     private void ForceUpdateTriggersAction()
  1151.     {
  1152.         if (!base.IsDestroyed)
  1153.         {
  1154.             this.ForceUpdateTriggers(false, true, false);
  1155.         }
  1156.     }
  1157.  
  1158.     public Bounds GetBounds()
  1159.     {
  1160.         return this.GetBounds(this.modelState.ducked);
  1161.     }
  1162.  
  1163.     public Bounds GetBounds(bool ducked)
  1164.     {
  1165.         return new Bounds(base.transform.position + this.GetOffset(ducked), this.GetSize(ducked));
  1166.     }
  1167.  
  1168.     public override BuildingPrivlidge GetBuildingPrivilege()
  1169.     {
  1170.         if (!base.isClient)
  1171.         {
  1172.             return base.GetBuildingPrivilege();
  1173.         }
  1174.         if ((UnityEngine.Time.time - this.cachedBuildingPrivilegeTime) > 1f)
  1175.         {
  1176.             this.cachedBuildingPrivilegeTime = UnityEngine.Time.time;
  1177.             this.cachedBuildingPrivilege = base.GetBuildingPrivilege(base.WorldSpaceBounds());
  1178.         }
  1179.         return this.cachedBuildingPrivilege;
  1180.     }
  1181.  
  1182.     public Vector3 GetCenter()
  1183.     {
  1184.         return this.GetCenter(this.modelState.ducked);
  1185.     }
  1186.  
  1187.     public Vector3 GetCenter(bool ducked)
  1188.     {
  1189.         return (base.transform.position + this.GetOffset(ducked));
  1190.     }
  1191.  
  1192.     public string GetDebugStatus()
  1193.     {
  1194.         StringBuilder builder = new StringBuilder();
  1195.         builder.AppendFormat("Entity: {0}\n", this.ToString());
  1196.         builder.AppendFormat("Name: {0}\n", this.displayName);
  1197.         builder.AppendFormat("SteamID: {0}\n", this.userID);
  1198.         IEnumerator enumerator = System.Enum.GetValues(typeof(PlayerFlags)).GetEnumerator();
  1199.         try
  1200.         {
  1201.             while (enumerator.MoveNext())
  1202.             {
  1203.                 PlayerFlags current = (PlayerFlags) enumerator.Current;
  1204.                 builder.AppendFormat("{1}: {0}\n", this.HasPlayerFlag(current), current);
  1205.             }
  1206.         }
  1207.         finally
  1208.         {
  1209.             IDisposable disposable = enumerator as IDisposable;
  1210.             if (disposable != null)
  1211.             {
  1212.                 disposable.Dispose();
  1213.             }
  1214.         }
  1215.         return builder.ToString();
  1216.     }
  1217.  
  1218.     public override float GetExtrapolationTime()
  1219.     {
  1220.         return Mathf.Clamp(Lerp.extrapolation, 0f, 0.1f);
  1221.     }
  1222.  
  1223.     public float GetHeight()
  1224.     {
  1225.         return this.GetHeight(this.modelState.ducked);
  1226.     }
  1227.  
  1228.     public float GetHeight(bool ducked)
  1229.     {
  1230.         if (ducked)
  1231.         {
  1232.             return 1.1f;
  1233.         }
  1234.         return 1.8f;
  1235.     }
  1236.  
  1237.     public HeldEntity GetHeldEntity()
  1238.     {
  1239.         if (!base.isClient)
  1240.         {
  1241.             return null;
  1242.         }
  1243.         if (this.IsLocalPlayer())
  1244.         {
  1245.             Item heldItem = this.GetHeldItem();
  1246.             if (heldItem == null)
  1247.             {
  1248.                 return null;
  1249.             }
  1250.             HeldEntity heldEntity = heldItem.GetHeldEntity() as HeldEntity;
  1251.             if (heldEntity == null)
  1252.             {
  1253.                 return null;
  1254.             }
  1255.             if (heldEntity.GetOwnerPlayer() != this)
  1256.             {
  1257.                 return null;
  1258.             }
  1259.             return heldEntity;
  1260.         }
  1261.         if (this.clActiveItem == 0)
  1262.         {
  1263.             return null;
  1264.         }
  1265.         Item item2 = this.inventory.containerBelt.FindItemByUID(this.clActiveItem);
  1266.         if (item2 == null)
  1267.         {
  1268.             return null;
  1269.         }
  1270.         return (item2.GetHeldEntity() as HeldEntity);
  1271.     }
  1272.  
  1273.     private Item GetHeldItem()
  1274.     {
  1275.         return this.Belt.GetActiveItem();
  1276.     }
  1277.  
  1278.     public uint GetHeldItemID()
  1279.     {
  1280.         if (this.IsLocalPlayer())
  1281.         {
  1282.             Item heldItem = this.GetHeldItem();
  1283.             return ((heldItem == null) ? 0 : heldItem.uid);
  1284.         }
  1285.         return this.clActiveItem;
  1286.     }
  1287.  
  1288.     internal BaseEntity GetInteractionEntity()
  1289.     {
  1290.         BaseEntity lookingAtEntity = null;
  1291.         if (!this.IsSpectating() && !this.IsDead())
  1292.         {
  1293.             lookingAtEntity = this.lookingAtEntity;
  1294.             if ((this.lookingAtCollider != null) && this.lookingAtCollider.gameObject.CompareTag("Not Player Usable"))
  1295.             {
  1296.                 lookingAtEntity = null;
  1297.             }
  1298.         }
  1299.         if ((lookingAtEntity != null) && !GameMenu.Util.GetInfo(lookingAtEntity.gameObject, this).IsValid)
  1300.         {
  1301.             lookingAtEntity = null;
  1302.         }
  1303.         if (lookingAtEntity == null)
  1304.         {
  1305.             lookingAtEntity = this;
  1306.             if ((lookingAtEntity != null) && !GameMenu.Util.GetInfo(lookingAtEntity.gameObject, this).IsValid)
  1307.             {
  1308.                 lookingAtEntity = null;
  1309.             }
  1310.         }
  1311.         return lookingAtEntity;
  1312.     }
  1313.  
  1314.     public override Item GetItem(uint itemId)
  1315.     {
  1316.         if (this.inventory == null)
  1317.         {
  1318.             return null;
  1319.         }
  1320.         return this.inventory.FindItemUID(itemId);
  1321.     }
  1322.  
  1323.     public float GetJumpHeight()
  1324.     {
  1325.         return 1.5f;
  1326.     }
  1327.  
  1328.     public override Vector3 GetLocalVelocityClient()
  1329.     {
  1330.         if (this.movement == null)
  1331.         {
  1332.             return base.GetLocalVelocityClient();
  1333.         }
  1334.         if (base.transform.parent != null)
  1335.         {
  1336.             return base.transform.parent.InverseTransformDirection(this.movement.CurrentVelocity());
  1337.         }
  1338.         return this.movement.CurrentVelocity();
  1339.     }
  1340.  
  1341.     public float GetMaxSpeed()
  1342.     {
  1343.         return this.GetSpeed(1f, 0f);
  1344.     }
  1345.  
  1346.     public override void GetMenuOptions(List<GameMenu.Option> list)
  1347.     {
  1348.         using (TimeWarning.New("BasePlayer.GetMenuOptions", (float) 0.1f))
  1349.         {
  1350.             using (TimeWarning.New("Climb", (float) 0.1f))
  1351.             {
  1352.                 if (this.Climb_ShowIf(LocalPlayer.Entity))
  1353.                 {
  1354.                     this.__menuOption_Climb.show = true;
  1355.                     this.__menuOption_Climb.showDisabled = false;
  1356.                     this.__menuOption_Climb.longUseOnly = false;
  1357.                     this.__menuOption_Climb.order = 0;
  1358.                     this.__menuOption_Climb.icon = "upgrade";
  1359.                     this.__menuOption_Climb.desc = "climb_desc";
  1360.                     this.__menuOption_Climb.title = "climb";
  1361.                     if (this.__menuOption_Climb.function == null)
  1362.                     {
  1363.                         this.__menuOption_Climb.function = new Action<BasePlayer>(this.Climb);
  1364.                     }
  1365.                     list.Add(this.__menuOption_Climb);
  1366.                 }
  1367.             }
  1368.             using (TimeWarning.New("Drink", (float) 0.1f))
  1369.             {
  1370.                 if (this.Drink_ShowIf(LocalPlayer.Entity))
  1371.                 {
  1372.                     this.__menuOption_Drink.show = true;
  1373.                     this.__menuOption_Drink.showDisabled = false;
  1374.                     this.__menuOption_Drink.longUseOnly = false;
  1375.                     this.__menuOption_Drink.order = 0;
  1376.                     this.__menuOption_Drink.icon = "cup_water";
  1377.                     this.__menuOption_Drink.desc = "drink_desc";
  1378.                     this.__menuOption_Drink.title = "drink";
  1379.                     if (this.__menuOption_Drink.function == null)
  1380.                     {
  1381.                         this.__menuOption_Drink.function = new Action<BasePlayer>(this.Drink);
  1382.                     }
  1383.                     list.Add(this.__menuOption_Drink);
  1384.                 }
  1385.             }
  1386.             using (TimeWarning.New("InviteToTeam", (float) 0.1f))
  1387.             {
  1388.                 if (this.Invite_ShowIf(LocalPlayer.Entity))
  1389.                 {
  1390.                     this.__menuOption_InviteToTeam.show = true;
  1391.                     this.__menuOption_InviteToTeam.showDisabled = false;
  1392.                     this.__menuOption_InviteToTeam.longUseOnly = false;
  1393.                     this.__menuOption_InviteToTeam.order = 100;
  1394.                     this.__menuOption_InviteToTeam.icon = "add";
  1395.                     this.__menuOption_InviteToTeam.desc = "invite_team_sesc";
  1396.                     this.__menuOption_InviteToTeam.title = "inviteToTeam";
  1397.                     if (this.__menuOption_InviteToTeam.function == null)
  1398.                     {
  1399.                         this.__menuOption_InviteToTeam.function = new Action<BasePlayer>(this.InviteToTeam);
  1400.                     }
  1401.                     list.Add(this.__menuOption_InviteToTeam);
  1402.                 }
  1403.             }
  1404.             using (TimeWarning.New("Menu_AssistPlayer", (float) 0.1f))
  1405.             {
  1406.                 if (this.Menu_AssistPlayer_ShowIf(LocalPlayer.Entity))
  1407.                 {
  1408.                     this.__menuOption_Menu_AssistPlayer.show = true;
  1409.                     this.__menuOption_Menu_AssistPlayer.showDisabled = false;
  1410.                     this.__menuOption_Menu_AssistPlayer.longUseOnly = false;
  1411.                     this.__menuOption_Menu_AssistPlayer.order = 10;
  1412.                     this.__menuOption_Menu_AssistPlayer.time = 6f;
  1413.                     this.__menuOption_Menu_AssistPlayer.icon = "player_assist";
  1414.                     this.__menuOption_Menu_AssistPlayer.desc = "help_player_desc";
  1415.                     this.__menuOption_Menu_AssistPlayer.title = "help_player";
  1416.                     if (this.__menuOption_Menu_AssistPlayer.function == null)
  1417.                     {
  1418.                         this.__menuOption_Menu_AssistPlayer.function = new Action<BasePlayer>(this.Menu_AssistPlayer);
  1419.                     }
  1420.                     if (this.__menuOption_Menu_AssistPlayer.timeStart == null)
  1421.                     {
  1422.                         this.__menuOption_Menu_AssistPlayer.timeStart = new Action(this.Menu_AssistPlayer_TimeStart);
  1423.                     }
  1424.                     list.Add(this.__menuOption_Menu_AssistPlayer);
  1425.                 }
  1426.             }
  1427.             using (TimeWarning.New("Menu_LootPlayer", (float) 0.1f))
  1428.             {
  1429.                 if (this.Menu_LootPlayer_ShowIf(LocalPlayer.Entity))
  1430.                 {
  1431.                     this.__menuOption_Menu_LootPlayer.show = true;
  1432.                     this.__menuOption_Menu_LootPlayer.showDisabled = false;
  1433.                     this.__menuOption_Menu_LootPlayer.longUseOnly = false;
  1434.                     this.__menuOption_Menu_LootPlayer.order = 0;
  1435.                     this.__menuOption_Menu_LootPlayer.icon = "player_loot";
  1436.                     this.__menuOption_Menu_LootPlayer.desc = "help_player_desc";
  1437.                     this.__menuOption_Menu_LootPlayer.title = "loot";
  1438.                     if (this.__menuOption_Menu_LootPlayer.function == null)
  1439.                     {
  1440.                         this.__menuOption_Menu_LootPlayer.function = new Action<BasePlayer>(this.Menu_LootPlayer);
  1441.                     }
  1442.                     list.Add(this.__menuOption_Menu_LootPlayer);
  1443.                 }
  1444.             }
  1445.             using (TimeWarning.New("Promote", (float) 0.1f))
  1446.             {
  1447.                 if (this.Promote_ShowIf(LocalPlayer.Entity))
  1448.                 {
  1449.                     this.__menuOption_Promote.show = true;
  1450.                     this.__menuOption_Promote.showDisabled = false;
  1451.                     this.__menuOption_Promote.longUseOnly = false;
  1452.                     this.__menuOption_Promote.order = 120;
  1453.                     this.__menuOption_Promote.time = 3f;
  1454.                     this.__menuOption_Promote.icon = "upgrade";
  1455.                     this.__menuOption_Promote.desc = "promote_desc";
  1456.                     this.__menuOption_Promote.title = "promote";
  1457.                     if (this.__menuOption_Promote.function == null)
  1458.                     {
  1459.                         this.__menuOption_Promote.function = new Action<BasePlayer>(this.Promote);
  1460.                     }
  1461.                     if (this.__menuOption_Promote.timeStart == null)
  1462.                     {
  1463.                         this.__menuOption_Promote.timeStart = new Action(this.Menu_Promote_Start);
  1464.                     }
  1465.                     list.Add(this.__menuOption_Promote);
  1466.                 }
  1467.             }
  1468.             using (TimeWarning.New("SaltWater", (float) 0.1f))
  1469.             {
  1470.                 if (this.SaltWater_ShowIf(LocalPlayer.Entity))
  1471.                 {
  1472.                     this.__menuOption_SaltWater.show = true;
  1473.                     this.__menuOption_SaltWater.showDisabled = false;
  1474.                     this.__menuOption_SaltWater.longUseOnly = false;
  1475.                     this.__menuOption_SaltWater.order = 0;
  1476.                     this.__menuOption_SaltWater.icon = "close";
  1477.                     this.__menuOption_SaltWater.desc = "saltwater_desc";
  1478.                     this.__menuOption_SaltWater.title = "saltwater";
  1479.                     if (this.__menuOption_SaltWater.function == null)
  1480.                     {
  1481.                         this.__menuOption_SaltWater.function = new Action<BasePlayer>(this.SaltWater);
  1482.                     }
  1483.                     list.Add(this.__menuOption_SaltWater);
  1484.                 }
  1485.             }
  1486.         }
  1487.         base.GetMenuOptions(list);
  1488.     }
  1489.  
  1490.     public float GetMinSpeed()
  1491.     {
  1492.         return this.GetSpeed(0f, 1f);
  1493.     }
  1494.  
  1495.     public BaseMountable GetMounted()
  1496.     {
  1497.         return (this.mounted.Get(base.isServer) as BaseMountable);
  1498.     }
  1499.  
  1500.     public override Quaternion GetNetworkRotation()
  1501.     {
  1502.         if (base.isClient)
  1503.         {
  1504.             return this.eyes.bodyRotation;
  1505.         }
  1506.         return Quaternion.identity;
  1507.     }
  1508.  
  1509.     public Vector3 GetOffset()
  1510.     {
  1511.         return this.GetOffset(this.modelState.ducked);
  1512.     }
  1513.  
  1514.     public Vector3 GetOffset(bool ducked)
  1515.     {
  1516.         if (ducked)
  1517.         {
  1518.             return new Vector3(0f, 0.55f, 0f);
  1519.         }
  1520.         return new Vector3(0f, 0.9f, 0f);
  1521.     }
  1522.  
  1523.     [RPC_Client]
  1524.     public void GetPerformanceReport(BaseEntity.RPCMessage msg)
  1525.     {
  1526.         base.ServerRPC<int, int, float, int>("PerformanceReport", (int) Performance.report.memoryAllocations, (int) Performance.report.memoryCollections, Performance.report.frameRateAverage, (int) UnityEngine.Time.realtimeSinceStartup);
  1527.     }
  1528.  
  1529.     public float GetRadius()
  1530.     {
  1531.         return 0.5f;
  1532.     }
  1533.  
  1534.     public static float GetRandomFloatBasedOnUserID(ulong steamid, ulong seed)
  1535.     {
  1536.         UnityEngine.Random.State state = UnityEngine.Random.state;
  1537.         UnityEngine.Random.InitState((int) (seed + steamid));
  1538.         float num = UnityEngine.Random.Range((float) 0f, (float) 1f);
  1539.         UnityEngine.Random.state = state;
  1540.         return num;
  1541.     }
  1542.  
  1543.     public Vector3 GetSize()
  1544.     {
  1545.         return this.GetSize(this.modelState.ducked);
  1546.     }
  1547.  
  1548.     public Vector3 GetSize(bool ducked)
  1549.     {
  1550.         if (ducked)
  1551.         {
  1552.             return new Vector3(1f, 1.1f, 1f);
  1553.         }
  1554.         return new Vector3(1f, 1.8f, 1f);
  1555.     }
  1556.  
  1557.     public float GetSpeed(float running, float ducking)
  1558.     {
  1559.         float num = 1f;
  1560.         num -= this.clothingMoveSpeedReduction;
  1561.         if (this.IsSwimming())
  1562.         {
  1563.             num += this.clothingWaterSpeedBonus;
  1564.         }
  1565.         return (Mathf.Lerp(Mathf.Lerp(2.8f, 5.5f, running), 1.7f, ducking) * num);
  1566.     }
  1567.  
  1568.     public string GetSubName(int maxlen = 0x20)
  1569.     {
  1570.         string displayName = this.displayName;
  1571.         if (displayName.Length > maxlen)
  1572.         {
  1573.             displayName = displayName.Substring(0, maxlen) + "..";
  1574.         }
  1575.         return displayName;
  1576.     }
  1577.  
  1578.     public override float GetThreatLevel()
  1579.     {
  1580.         this.EnsureUpdated();
  1581.         return this.cachedThreatLevel;
  1582.     }
  1583.  
  1584.     private Vector3 GetWaterDrinkingPoint()
  1585.     {
  1586.         using (TimeWarning.New("GetWaterDrinkingPoint", (float) 0.1f))
  1587.         {
  1588.             RaycastHit hit;
  1589.             if (!UnityEngine.Physics.Raycast(this.eyes.BodyRay(), out hit, 1.5f, 0x800010))
  1590.             {
  1591.                 return Vector3.zero;
  1592.             }
  1593.             return (hit.point - new Vector3(0f, 0.5f, 0f));
  1594.         }
  1595.     }
  1596.  
  1597.     public bool HasLocalControls()
  1598.     {
  1599.         if (!this.IsLocalPlayer())
  1600.         {
  1601.             return false;
  1602.         }
  1603.         if (this.IsSpectating())
  1604.         {
  1605.             return false;
  1606.         }
  1607.         if (this.IsDead())
  1608.         {
  1609.             return false;
  1610.         }
  1611.         if (this.IsSleeping())
  1612.         {
  1613.             return false;
  1614.         }
  1615.         if (this.IsWounded())
  1616.         {
  1617.             return false;
  1618.         }
  1619.         return true;
  1620.     }
  1621.  
  1622.     public bool HasPlayerFlag(PlayerFlags f)
  1623.     {
  1624.         return ((this.playerFlags & f) == f);
  1625.     }
  1626.  
  1627.     public void HeldEntityEnd()
  1628.     {
  1629.         UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
  1630.         HeldEntity heldEntity = this.GetHeldEntity();
  1631.         if (heldEntity != null)
  1632.         {
  1633.             heldEntity.OnHolster();
  1634.         }
  1635.     }
  1636.  
  1637.     private void HeldEntityFrame()
  1638.     {
  1639.         UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
  1640.         using (TimeWarning.New("HeldEntityFrame", (float) 0.1f))
  1641.         {
  1642.             HeldEntity heldEntity = this.GetHeldEntity();
  1643.             if ((heldEntity != null) && (heldEntity.GetOwnerPlayer() == this))
  1644.             {
  1645.                 heldEntity.OnFrame();
  1646.             }
  1647.         }
  1648.     }
  1649.  
  1650.     private void HeldEntityInput()
  1651.     {
  1652.         UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
  1653.         using (TimeWarning.New("HeldEntityInput", (float) 0.1f))
  1654.         {
  1655.             HeldEntity heldEntity = this.GetHeldEntity();
  1656.             if ((heldEntity != null) && (heldEntity.GetOwnerPlayer() == this))
  1657.             {
  1658.                 heldEntity.OnInput();
  1659.             }
  1660.         }
  1661.     }
  1662.  
  1663.     public void HeldEntityStart()
  1664.     {
  1665.         UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
  1666.         HeldEntity heldEntity = this.GetHeldEntity();
  1667.         if (heldEntity != null)
  1668.         {
  1669.             heldEntity.OnDeploy();
  1670.         }
  1671.     }
  1672.  
  1673.     private void HeldEntityViewAngles()
  1674.     {
  1675.         UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
  1676.         HeldEntity heldEntity = this.GetHeldEntity();
  1677.         if ((heldEntity != null) && (heldEntity.GetOwnerPlayer() == this))
  1678.         {
  1679.             heldEntity.EditViewAngles();
  1680.         }
  1681.     }
  1682.  
  1683.     private bool HeldItemUse()
  1684.     {
  1685.         UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
  1686.         HeldEntity heldEntity = this.GetHeldEntity();
  1687.         if (heldEntity == null)
  1688.         {
  1689.             return false;
  1690.         }
  1691.         return ((heldEntity.GetOwnerPlayer() != this) && false);
  1692.     }
  1693.  
  1694.     public bool InFirstPersonMode()
  1695.     {
  1696.         return (this.currentViewMode == CameraMode.FirstPerson);
  1697.     }
  1698.  
  1699.     internal void InitLocalPlayer()
  1700.     {
  1701.         UnityEngine.Assertions.Assert.IsTrue(LocalPlayer.Entity != this, "LocalPlayer setup! InitLocalPlayer called multiple times!");
  1702.         base.gameObject.name = "LocalPlayer";
  1703.         LocalPlayer.Entity = this;
  1704.         this.blueprints.ClientInit();
  1705.         this.UpdatePlayerCollider(true);
  1706.         this.UpdatePlayerRigidbody(true);
  1707.         this.voiceRecorder = base.GetComponent<PlayerVoiceRecorder>();
  1708.         this.voiceRecorder.Init();
  1709.         this.CreatePlayerMovement();
  1710.         this.metabolism.ClientInit(this);
  1711.         LocalPlayer.OnInventoryChanged();
  1712.         SingletonComponent<SteamClient>.Instance.SendUpdatedInventory();
  1713.         this.CreatePlayerModel();
  1714.     }
  1715.  
  1716.     internal void InitRemotePlayer()
  1717.     {
  1718.         this.UpdatePlayerCollider(false);
  1719.         this.UpdatePlayerRigidbody(false);
  1720.         this.CreatePlayerModel();
  1721.         this.CreatePlayerCollision();
  1722.     }
  1723.  
  1724.     public override void InitShared()
  1725.     {
  1726.         this.Belt = new PlayerBelt(this);
  1727.         this.cachedProtection = ScriptableObject.CreateInstance<ProtectionProperties>();
  1728.         base.baseProtection = ScriptableObject.CreateInstance<ProtectionProperties>();
  1729.         this.inventory = base.GetComponent<PlayerInventory>();
  1730.         this.blueprints = base.GetComponent<PlayerBlueprints>();
  1731.         this.metabolism = base.GetComponent<PlayerMetabolism>();
  1732.         this.eyes = base.GetComponent<PlayerEyes>();
  1733.         this.input = base.GetComponent<PlayerInput>();
  1734.         base.InitShared();
  1735.     }
  1736.  
  1737.     public bool InSafeZone()
  1738.     {
  1739.         return this.HasPlayerFlag(PlayerFlags.SafeZone);
  1740.     }
  1741.  
  1742.     public bool Invite_ShowIf(BasePlayer player)
  1743.     {
  1744.         if (!RelationshipManager.TeamsEnabled())
  1745.         {
  1746.             return false;
  1747.         }
  1748.         if (this.currentTeam != 0L)
  1749.         {
  1750.             return false;
  1751.         }
  1752.         BasePlayer entity = LocalPlayer.Entity;
  1753.         if (entity == null)
  1754.         {
  1755.             return false;
  1756.         }
  1757.         if (this == LocalPlayer.Entity)
  1758.         {
  1759.             return false;
  1760.         }
  1761.         if ((this.IsWounded() || !this.IsAlive()) || this.IsSleeping())
  1762.         {
  1763.             return false;
  1764.         }
  1765.         if (this.IsNpc)
  1766.         {
  1767.             return false;
  1768.         }
  1769.         if (entity.currentTeam == 0L)
  1770.         {
  1771.             return false;
  1772.         }
  1773.         return ((LocalPlayer.Entity.clientTeam != null) && (LocalPlayer.Entity.clientTeam.teamLeader == LocalPlayer.Entity.userID));
  1774.     }
  1775.  
  1776.     [Menu("inviteToTeam", "Invite To Team", Order=100), Icon("add"), ShowIf("Invite_ShowIf"), Description("invite_team_sesc", "Invite this player to your team")]
  1777.     public void InviteToTeam(BasePlayer player)
  1778.     {
  1779.         BasePlayer component = LocalPlayer.Entity.lookingAtEntity.GetComponent<BasePlayer>();
  1780.         if ((component != null) && (component.currentTeam == 0L))
  1781.         {
  1782.             object[] args = new object[] { component.userID };
  1783.             ConsoleSystem.Run(ConsoleSystem.Option.Client, "sendinvite", args);
  1784.         }
  1785.     }
  1786.  
  1787.     private static bool IsAimingAt(BasePlayer aimer, BasePlayer target, float cone = 0.95f)
  1788.     {
  1789.         Vector3 vector2 = target.eyes.position - aimer.eyes.position;
  1790.         Vector3 normalized = vector2.normalized;
  1791.         return (((Vector3.Dot(aimer.eyes.HeadForward(), normalized) > cone) && aimer.VisPlayerArmed()) && target.VisPlayerArmed());
  1792.     }
  1793.  
  1794.     public bool IsBuildingAuthed()
  1795.     {
  1796.         BuildingPrivlidge buildingPrivilege = this.GetBuildingPrivilege();
  1797.         if (buildingPrivilege == null)
  1798.         {
  1799.             return false;
  1800.         }
  1801.         return buildingPrivilege.IsAuthed(this);
  1802.     }
  1803.  
  1804.     public bool IsBuildingAuthed(OBB obb)
  1805.     {
  1806.         BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(obb);
  1807.         if (buildingPrivilege == null)
  1808.         {
  1809.             return false;
  1810.         }
  1811.         return buildingPrivilege.IsAuthed(this);
  1812.     }
  1813.  
  1814.     public bool IsBuildingAuthed(Vector3 position, Quaternion rotation, Bounds bounds)
  1815.     {
  1816.         BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(new OBB(position, rotation, bounds));
  1817.         if (buildingPrivilege == null)
  1818.         {
  1819.             return false;
  1820.         }
  1821.         return buildingPrivilege.IsAuthed(this);
  1822.     }
  1823.  
  1824.     public bool IsBuildingBlocked()
  1825.     {
  1826.         BuildingPrivlidge buildingPrivilege = this.GetBuildingPrivilege();
  1827.         if (buildingPrivilege == null)
  1828.         {
  1829.             return false;
  1830.         }
  1831.         return !buildingPrivilege.IsAuthed(this);
  1832.     }
  1833.  
  1834.     public bool IsBuildingBlocked(OBB obb)
  1835.     {
  1836.         BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(obb);
  1837.         if (buildingPrivilege == null)
  1838.         {
  1839.             return false;
  1840.         }
  1841.         return !buildingPrivilege.IsAuthed(this);
  1842.     }
  1843.  
  1844.     public bool IsBuildingBlocked(Vector3 position, Quaternion rotation, Bounds bounds)
  1845.     {
  1846.         BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(new OBB(position, rotation, bounds));
  1847.         if (buildingPrivilege == null)
  1848.         {
  1849.             return false;
  1850.         }
  1851.         return !buildingPrivilege.IsAuthed(this);
  1852.     }
  1853.  
  1854.     public bool IsDucked()
  1855.     {
  1856.         if (this.movement != null)
  1857.         {
  1858.             return this.movement.IsDucked;
  1859.         }
  1860.         return ((this.modelState != null) && this.modelState.ducked);
  1861.     }
  1862.  
  1863.     public bool IsHeadUnderwater()
  1864.     {
  1865.         if (this.modelState != null)
  1866.         {
  1867.             return (this.modelState.waterLevel > 0.75f);
  1868.         }
  1869.         return (this.WaterFactor() > 0.75f);
  1870.     }
  1871.  
  1872.     public bool IsHoldingEntity<T>()
  1873.     {
  1874.         HeldEntity heldEntity = this.GetHeldEntity();
  1875.         if (heldEntity == null)
  1876.         {
  1877.             return false;
  1878.         }
  1879.         return (heldEntity is T);
  1880.     }
  1881.  
  1882.     public bool IsLocalPlayer()
  1883.     {
  1884.         return (this == LocalPlayer.Entity);
  1885.     }
  1886.  
  1887.     public bool IsOnGround()
  1888.     {
  1889.         if (this.movement != null)
  1890.         {
  1891.             return this.movement.IsGrounded;
  1892.         }
  1893.         return this.modelState.onground;
  1894.     }
  1895.  
  1896.     public bool IsRelaxed()
  1897.     {
  1898.         return this.HasPlayerFlag(PlayerFlags.Relaxed);
  1899.     }
  1900.  
  1901.     public bool IsRunning()
  1902.     {
  1903.         if (this.movement != null)
  1904.         {
  1905.             return this.movement.IsRunning;
  1906.         }
  1907.         return ((this.modelState != null) && this.modelState.sprinting);
  1908.     }
  1909.  
  1910.     public bool IsSleeping()
  1911.     {
  1912.         return this.HasPlayerFlag(PlayerFlags.Sleeping);
  1913.     }
  1914.  
  1915.     public bool IsSpectating()
  1916.     {
  1917.         return this.HasPlayerFlag(PlayerFlags.Spectating);
  1918.     }
  1919.  
  1920.     public bool IsSwimming()
  1921.     {
  1922.         if (this.modelState != null)
  1923.         {
  1924.             return (this.modelState.waterLevel >= 0.65f);
  1925.         }
  1926.         return (this.WaterFactor() >= 0.65f);
  1927.     }
  1928.  
  1929.     public bool IsWounded()
  1930.     {
  1931.         return this.HasPlayerFlag(PlayerFlags.Wounded);
  1932.     }
  1933.  
  1934.     public static void LateClientCycle()
  1935.     {
  1936.         BasePlayer[] buffer = VisiblePlayerList.Buffer;
  1937.         int count = VisiblePlayerList.Count;
  1938.         for (int i = 0; i < count; i++)
  1939.         {
  1940.             BasePlayer player = buffer[i];
  1941.             if (player.playerModel != null)
  1942.             {
  1943.                 player.playerModel.LateCycle();
  1944.             }
  1945.         }
  1946.         if ((LocalPlayer.Entity != null) && (MainCamera.mainCamera != null))
  1947.         {
  1948.             if (!CameraMan.Active)
  1949.             {
  1950.                 LocalPlayer.Entity.input.ApplyViewAngles();
  1951.                 LocalPlayer.Entity.eyes.FrameUpdate(MainCamera.mainCamera);
  1952.             }
  1953.             foreach (BaseViewModel model in BaseViewModel.ActiveModels)
  1954.             {
  1955.                 BaseViewModel.HideViewmodel = (LocalPlayer.Entity.currentViewMode != CameraMode.FirstPerson) || CameraMan.Active;
  1956.                 model.OnCameraPositionChanged(MainCamera.mainCamera);
  1957.             }
  1958.         }
  1959.     }
  1960.  
  1961.     public override void Load(BaseNetworkable.LoadInfo info)
  1962.     {
  1963.         base.Load(info);
  1964.         if (info.msg.basePlayer != null)
  1965.         {
  1966.             ProtoBuf.BasePlayer basePlayer = info.msg.basePlayer;
  1967.             this.userID = basePlayer.userid;
  1968.             this.UserIDString = this.userID.ToString();
  1969.             if (basePlayer.name != null)
  1970.             {
  1971.                 this._displayName = basePlayer.name;
  1972.                 if (string.IsNullOrEmpty(this._displayName.Trim()))
  1973.                 {
  1974.                     this._displayName = "Blaster :D";
  1975.                 }
  1976.             }
  1977.             this.playerFlags = (PlayerFlags) basePlayer.playerFlags;
  1978.             this.currentTeam = basePlayer.currentTeam;
  1979.             if (basePlayer.metabolism != null)
  1980.             {
  1981.                 this.metabolism.Load(basePlayer.metabolism);
  1982.             }
  1983.             if (basePlayer.inventory != null)
  1984.             {
  1985.                 this.inventory.Load(basePlayer.inventory);
  1986.             }
  1987.             if ((this.playerModel != null) && (this.playerModel.nameTag != null))
  1988.             {
  1989.                 this.playerModel.nameTag.UpdateFrom(this);
  1990.             }
  1991.             if (basePlayer.modelState != null)
  1992.             {
  1993.                 if (this.modelState != null)
  1994.                 {
  1995.                     this.modelState.ResetToPool();
  1996.                     this.modelState = null;
  1997.                 }
  1998.                 this.modelState = basePlayer.modelState;
  1999.                 basePlayer.modelState = null;
  2000.                 this.OnModelStateChanged();
  2001.             }
  2002.             if (!info.fromDisk)
  2003.             {
  2004.                 this.ClientUpdateMounted(basePlayer.mounted);
  2005.             }
  2006.             if (base.isClient && (info.msg.basePlayer.persistantData != null))
  2007.             {
  2008.                 this.ClientUpdatePersistantData(info.msg.basePlayer.persistantData);
  2009.             }
  2010.             this.clActiveItem = basePlayer.heldEntity;
  2011.         }
  2012.     }
  2013.  
  2014.     public static bool LocalPlayerIsLeader()
  2015.     {
  2016.         return (((LocalPlayer.Entity != null) && (LocalPlayer.Entity.clientTeam != null)) && (LocalPlayer.Entity.clientTeam.teamLeader == LocalPlayer.Entity.userID));
  2017.     }
  2018.  
  2019.     private void LogDebugCull(float dist)
  2020.     {
  2021.         if (base.isVisible != this.debugPrevVisible)
  2022.         {
  2023.             UnityEngine.Debug.Log(string.Concat(new object[] { "VisChanged: ", this.displayName, ", Distance: ", dist, ", ", this.IsSleeping() }));
  2024.             this.debugPrevVisible = base.isVisible;
  2025.         }
  2026.     }
  2027.  
  2028.     internal void LongUse()
  2029.     {
  2030.         if (!this.IsWounded())
  2031.         {
  2032.             BaseEntity interactionEntity = this.GetInteractionEntity();
  2033.             if (interactionEntity != null)
  2034.             {
  2035.                 interactionEntity.gameObject.SendMessage("OnUseHeld", this, SendMessageOptions.DontRequireReceiver);
  2036.             }
  2037.         }
  2038.     }
  2039.  
  2040.     public override void MakeVisible()
  2041.     {
  2042.         base.MakeVisible();
  2043.         if (this.playerModel != null)
  2044.         {
  2045.             this.playerModel.ApplyVisibility(base.isVisible, base.isAnimatorVisible, base.isShadowVisible);
  2046.         }
  2047.     }
  2048.  
  2049.     public void MarkSwapSeat()
  2050.     {
  2051.         this.nextSeatSwapTime = UnityEngine.Time.time + 0.75f;
  2052.     }
  2053.  
  2054.     public float MaxDeployDistance(Item item)
  2055.     {
  2056.         return 8f;
  2057.     }
  2058.  
  2059.     public override float MaxHealth()
  2060.     {
  2061.         return 100f;
  2062.     }
  2063.  
  2064.     public override float MaxVelocity()
  2065.     {
  2066.         if (this.IsSleeping())
  2067.         {
  2068.             return 0f;
  2069.         }
  2070.         if (this.isMounted)
  2071.         {
  2072.             return this.GetMounted().MaxVelocity();
  2073.         }
  2074.         return this.GetMaxSpeed();
  2075.     }
  2076.  
  2077.     [Icon("player_assist"), ShowIf("Menu_AssistPlayer_ShowIf"), Menu("help_player", "Help Player", Time=6f, OnStart="Menu_AssistPlayer_TimeStart", Order=10), Description("help_player_desc", "Stop this player from dying by helping them to their feet")]
  2078.     public void Menu_AssistPlayer(BasePlayer player)
  2079.     {
  2080.         base.ServerRPC("RPC_Assist");
  2081.     }
  2082.  
  2083.     public bool Menu_AssistPlayer_ShowIf(BasePlayer player)
  2084.     {
  2085.         if (player == this)
  2086.         {
  2087.             return false;
  2088.         }
  2089.         if (!this.IsWounded())
  2090.         {
  2091.             return false;
  2092.         }
  2093.         if (player.lookingAtEntity == this)
  2094.         {
  2095.             this.lastRevivePoint = player.lookingAtPoint;
  2096.             this.lastReviveDirection = player.eyes.HeadForward();
  2097.         }
  2098.         else
  2099.         {
  2100.             if (Vector3.Angle(this.lastReviveDirection, player.eyes.HeadForward()) > 10f)
  2101.             {
  2102.                 return false;
  2103.             }
  2104.             if (!GamePhysics.LineOfSight(this.lastRevivePoint, player.eyes.position, 0x210000, 0.1f))
  2105.             {
  2106.                 return false;
  2107.             }
  2108.         }
  2109.         return true;
  2110.     }
  2111.  
  2112.     public void Menu_AssistPlayer_TimeStart()
  2113.     {
  2114.         base.ServerRPC("RPC_KeepAlive");
  2115.     }
  2116.  
  2117.     [Menu("loot", "Loot"), Icon("player_loot"), ShowIf("Menu_LootPlayer_ShowIf"), Description("help_player_desc", "Access this player's inventory. Steal from them or dress them up all pretty,")]
  2118.     public void Menu_LootPlayer(BasePlayer player)
  2119.     {
  2120.         base.ServerRPC("RPC_LootPlayer");
  2121.         UIInventory.OpenLoot("player_corpse");
  2122.     }
  2123.  
  2124.     public bool Menu_LootPlayer_ShowIf(BasePlayer player)
  2125.     {
  2126.         return this.CanBeLooted(player);
  2127.     }
  2128.  
  2129.     public void Menu_Promote_Start()
  2130.     {
  2131.     }
  2132.  
  2133.     public void ModifyCamera()
  2134.     {
  2135.         Item activeItem = this.Belt.GetActiveItem();
  2136.         if (activeItem != null)
  2137.         {
  2138.             HeldEntity heldEntity = activeItem.GetHeldEntity() as HeldEntity;
  2139.             if (heldEntity != null)
  2140.             {
  2141.                 heldEntity.ModifyCamera();
  2142.             }
  2143.         }
  2144.     }
  2145.  
  2146.     protected virtual void ModifyInputState(ref InputState inputState)
  2147.     {
  2148.     }
  2149.  
  2150.     private void MountableOverrideViewAngles()
  2151.     {
  2152.         BaseMountable mounted = this.GetMounted();
  2153.         if (mounted != null)
  2154.         {
  2155.             mounted.OverrideViewAngles(this);
  2156.         }
  2157.     }
  2158.  
  2159.     public int NewProjectileID()
  2160.     {
  2161.         return ++this.maxProjectileID;
  2162.     }
  2163.  
  2164.     public int NewProjectileSeed()
  2165.     {
  2166.         return UnityEngine.Random.Range(0, 0x7fffffff);
  2167.     }
  2168.  
  2169.     public override void OnAttacked(HitInfo info)
  2170.     {
  2171.         float health = base.health;
  2172.         base.OnAttacked(info);
  2173.         if ((((info.Initiator == LocalPlayer.Entity) && info.isHeadshot) && (info.damageTypes.Has(DamageType.Bullet) || info.damageTypes.Has(DamageType.Arrow))) && ((UnityEngine.Time.realtimeSinceStartup - this.lastHeadshotSoundTime) > 0.01f))
  2174.         {
  2175.             Effect.client.Run("assets/bundled/prefabs/fx/headshot_2d.prefab", LocalPlayer.Entity.eyes.gameObject);
  2176.             this.lastHeadshotSoundTime = UnityEngine.Time.realtimeSinceStartup;
  2177.         }
  2178.     }
  2179.  
  2180.     public override void OnBecameRagdoll(Ragdoll rdoll)
  2181.     {
  2182.         base.OnBecameRagdoll(rdoll);
  2183.         base.lifestate = BaseCombatEntity.LifeState.Dead;
  2184.         base.deathTime = UnityEngine.Time.realtimeSinceStartup;
  2185.     }
  2186.  
  2187.     [RPC_Client]
  2188.     private void OnDied(BaseEntity.RPCMessage msg)
  2189.     {
  2190.         UIInventory.Close();
  2191.         MapInterface.SetOpen(false);
  2192.         LocalPlayer.LastDeathTime = UnityEngine.Time.realtimeSinceStartup;
  2193.     }
  2194.  
  2195.     public bool OnLadder()
  2196.     {
  2197.         return (this.modelState.onLadder && ((bool) base.FindTrigger<TriggerLadder>()));
  2198.     }
  2199.  
  2200.     public void OnLand(float fVelocity)
  2201.     {
  2202.         Vector3 posWorld = new Vector3();
  2203.         posWorld = new Vector3();
  2204.         Effect.client.Run("assets/bundled/prefabs/fx/screen_land.prefab", posWorld, posWorld, new Vector3());
  2205.         if (fVelocity < -8f)
  2206.         {
  2207.             base.ServerRPC<float>("OnPlayerLanded", fVelocity);
  2208.         }
  2209.     }
  2210.  
  2211.     [RPC_Client]
  2212.     private void OnModelState(BaseEntity.RPCMessage data)
  2213.     {
  2214.         ModelState.Deserialize(data.read, this.modelState, false);
  2215.         this.OnModelStateChanged();
  2216.     }
  2217.  
  2218.     private void OnModelStateChanged()
  2219.     {
  2220.         if (!this.IsLocalPlayer() && (this.playerModel != null))
  2221.         {
  2222.             this.playerModel.UpdateModelState(this.modelState);
  2223.         }
  2224.     }
  2225.  
  2226.     [RPC_Client]
  2227.     private void OnRespawnInformation(BaseEntity.RPCMessage msg)
  2228.     {
  2229.         UnityEngine.Debug.Log("Got Respawn Information");
  2230.         UIDeathScreen.OnRespawnInformation(RespawnInformation.Deserialize(msg.read));
  2231.         UIInventory.Close();
  2232.         MapInterface.SetOpen(false);
  2233.     }
  2234.  
  2235.     public override bool OnRpcMessage(BasePlayer player, uint rpc, Message msg)
  2236.     {
  2237.         using (TimeWarning.New("BasePlayer.OnRpcMessage", (float) 0.1f))
  2238.         {
  2239.             BaseEntity.RPCMessage message2;
  2240.             if ((rpc == 0xd2afd729) && (player == null))
  2241.             {
  2242.                 if (ConVar.Global.developer > 2)
  2243.                 {
  2244.                     UnityEngine.Debug.Log("CL_RPCMessage: CLIENT_ClearTeam ");
  2245.                 }
  2246.                 TimeWarning warning2 = TimeWarning.New("CLIENT_ClearTeam", (float) 0.1f);
  2247.                 try
  2248.                 {
  2249.                     using (TimeWarning.New("Call", (float) 0.1f))
  2250.                     {
  2251.                         message2 = new BaseEntity.RPCMessage {
  2252.                             connection = msg.connection,
  2253.                             player = player,
  2254.                             read = msg.read
  2255.                         };
  2256.                         BaseEntity.RPCMessage message = message2;
  2257.                         this.CLIENT_ClearTeam(message);
  2258.                     }
  2259.                 }
  2260.                 catch (Exception exception)
  2261.                 {
  2262.                     Network.Net.cl.Disconnect("RPC Error in CLIENT_ClearTeam", true);
  2263.                     UnityEngine.Debug.LogException(exception);
  2264.                 }
  2265.                 finally
  2266.                 {
  2267.                     if (warning2 != null)
  2268.                     {
  2269.                         ((IDisposable) warning2).Dispose();
  2270.                     }
  2271.                 }
  2272.                 return true;
  2273.             }
  2274.             if ((rpc == 0x2c658f72) && (player == null))
  2275.             {
  2276.                 if (ConVar.Global.developer > 2)
  2277.                 {
  2278.                     UnityEngine.Debug.Log("CL_RPCMessage: CLIENT_PendingInvite ");
  2279.                 }
  2280.                 TimeWarning warning4 = TimeWarning.New("CLIENT_PendingInvite", (float) 0.1f);
  2281.                 try
  2282.                 {
  2283.                     using (TimeWarning.New("Call", (float) 0.1f))
  2284.                     {
  2285.                         message2 = new BaseEntity.RPCMessage {
  2286.                             connection = msg.connection,
  2287.                             player = player,
  2288.                             read = msg.read
  2289.                         };
  2290.                         BaseEntity.RPCMessage message3 = message2;
  2291.                         this.CLIENT_PendingInvite(message3);
  2292.                     }
  2293.                 }
  2294.                 catch (Exception exception2)
  2295.                 {
  2296.                     Network.Net.cl.Disconnect("RPC Error in CLIENT_PendingInvite", true);
  2297.                     UnityEngine.Debug.LogException(exception2);
  2298.                 }
  2299.                 finally
  2300.                 {
  2301.                     if (warning4 != null)
  2302.                     {
  2303.                         ((IDisposable) warning4).Dispose();
  2304.                     }
  2305.                 }
  2306.                 return true;
  2307.             }
  2308.             if ((rpc == 0x3d632728) && (player == null))
  2309.             {
  2310.                 if (ConVar.Global.developer > 2)
  2311.                 {
  2312.                     UnityEngine.Debug.Log("CL_RPCMessage: CLIENT_ReceiveTeamInfo ");
  2313.                 }
  2314.                 TimeWarning warning6 = TimeWarning.New("CLIENT_ReceiveTeamInfo", (float) 0.1f);
  2315.                 try
  2316.                 {
  2317.                     using (TimeWarning.New("Call", (float) 0.1f))
  2318.                     {
  2319.                         message2 = new BaseEntity.RPCMessage {
  2320.                             connection = msg.connection,
  2321.                             player = player,
  2322.                             read = msg.read
  2323.                         };
  2324.                         BaseEntity.RPCMessage message4 = message2;
  2325.                         this.CLIENT_ReceiveTeamInfo(message4);
  2326.                     }
  2327.                 }
  2328.                 catch (Exception exception3)
  2329.                 {
  2330.                     Network.Net.cl.Disconnect("RPC Error in CLIENT_ReceiveTeamInfo", true);
  2331.                     UnityEngine.Debug.LogException(exception3);
  2332.                 }
  2333.                 finally
  2334.                 {
  2335.                     if (warning6 != null)
  2336.                     {
  2337.                         ((IDisposable) warning6).Dispose();
  2338.                     }
  2339.                 }
  2340.                 return true;
  2341.             }
  2342.             if ((rpc == 0x5eb32ae1) && (player == null))
  2343.             {
  2344.                 if (ConVar.Global.developer > 2)
  2345.                 {
  2346.                     UnityEngine.Debug.Log("CL_RPCMessage: CraftMode ");
  2347.                 }
  2348.                 TimeWarning warning8 = TimeWarning.New("CraftMode", (float) 0.1f);
  2349.                 try
  2350.                 {
  2351.                     using (TimeWarning.New("Call", (float) 0.1f))
  2352.                     {
  2353.                         message2 = new BaseEntity.RPCMessage {
  2354.                             connection = msg.connection,
  2355.                             player = player,
  2356.                             read = msg.read
  2357.                         };
  2358.                         BaseEntity.RPCMessage message5 = message2;
  2359.                         this.CraftMode(message5);
  2360.                     }
  2361.                 }
  2362.                 catch (Exception exception4)
  2363.                 {
  2364.                     Network.Net.cl.Disconnect("RPC Error in CraftMode", true);
  2365.                     UnityEngine.Debug.LogException(exception4);
  2366.                 }
  2367.                 finally
  2368.                 {
  2369.                     if (warning8 != null)
  2370.                     {
  2371.                         ((IDisposable) warning8).Dispose();
  2372.                     }
  2373.                 }
  2374.                 return true;
  2375.             }
  2376.             if ((rpc == 0x17b5c293) && (player == null))
  2377.             {
  2378.                 if (ConVar.Global.developer > 2)
  2379.                 {
  2380.                     UnityEngine.Debug.Log("CL_RPCMessage: DirectionalDamage ");
  2381.                 }
  2382.                 TimeWarning warning10 = TimeWarning.New("DirectionalDamage", (float) 0.1f);
  2383.                 try
  2384.                 {
  2385.                     using (TimeWarning.New("Call", (float) 0.1f))
  2386.                     {
  2387.                         Vector3 position = msg.read.Vector3();
  2388.                         int damageType = msg.read.Int32();
  2389.                         this.DirectionalDamage(position, damageType);
  2390.                     }
  2391.                 }
  2392.                 catch (Exception exception5)
  2393.                 {
  2394.                     Network.Net.cl.Disconnect("RPC Error in DirectionalDamage", true);
  2395.                     UnityEngine.Debug.LogException(exception5);
  2396.                 }
  2397.                 finally
  2398.                 {
  2399.                     if (warning10 != null)
  2400.                     {
  2401.                         ((IDisposable) warning10).Dispose();
  2402.                     }
  2403.                 }
  2404.                 return true;
  2405.             }
  2406.             if ((rpc == 0xa79b8625) && (player == null))
  2407.             {
  2408.                 if (ConVar.Global.developer > 2)
  2409.                 {
  2410.                     UnityEngine.Debug.Log("CL_RPCMessage: FinishLoading ");
  2411.                 }
  2412.                 TimeWarning warning12 = TimeWarning.New("FinishLoading", (float) 0.1f);
  2413.                 try
  2414.                 {
  2415.                     using (TimeWarning.New("Call", (float) 0.1f))
  2416.                     {
  2417.                         this.FinishLoading();
  2418.                     }
  2419.                 }
  2420.                 catch (Exception exception6)
  2421.                 {
  2422.                     Network.Net.cl.Disconnect("RPC Error in FinishLoading", true);
  2423.                     UnityEngine.Debug.LogException(exception6);
  2424.                 }
  2425.                 finally
  2426.                 {
  2427.                     if (warning12 != null)
  2428.                     {
  2429.                         ((IDisposable) warning12).Dispose();
  2430.                     }
  2431.                 }
  2432.                 return true;
  2433.             }
  2434.             if ((rpc == 0xc368fe36) && (player == null))
  2435.             {
  2436.                 if (ConVar.Global.developer > 2)
  2437.                 {
  2438.                     UnityEngine.Debug.Log("CL_RPCMessage: ForcePositionTo ");
  2439.                 }
  2440.                 TimeWarning warning14 = TimeWarning.New("ForcePositionTo", (float) 0.1f);
  2441.                 try
  2442.                 {
  2443.                     using (TimeWarning.New("Call", (float) 0.1f))
  2444.                     {
  2445.                         Vector3 vector2 = msg.read.Vector3();
  2446.                         this.ForcePositionTo(vector2);
  2447.                     }
  2448.                 }
  2449.                 catch (Exception exception7)
  2450.                 {
  2451.                     Network.Net.cl.Disconnect("RPC Error in ForcePositionTo", true);
  2452.                     UnityEngine.Debug.LogException(exception7);
  2453.                 }
  2454.                 finally
  2455.                 {
  2456.                     if (warning14 != null)
  2457.                     {
  2458.                         ((IDisposable) warning14).Dispose();
  2459.                     }
  2460.                 }
  2461.                 return true;
  2462.             }
  2463.             if ((rpc == 0x24c4af48) && (player == null))
  2464.             {
  2465.                 if (ConVar.Global.developer > 2)
  2466.                 {
  2467.                     UnityEngine.Debug.Log("CL_RPCMessage: ForcePositionToParentOffset ");
  2468.                 }
  2469.                 TimeWarning warning16 = TimeWarning.New("ForcePositionToParentOffset", (float) 0.1f);
  2470.                 try
  2471.                 {
  2472.                     using (TimeWarning.New("Call", (float) 0.1f))
  2473.                     {
  2474.                         Vector3 vector3 = msg.read.Vector3();
  2475.                         uint entID = msg.read.UInt32();
  2476.                         this.ForcePositionToParentOffset(vector3, entID);
  2477.                     }
  2478.                 }
  2479.                 catch (Exception exception8)
  2480.                 {
  2481.                     Network.Net.cl.Disconnect("RPC Error in ForcePositionToParentOffset", true);
  2482.                     UnityEngine.Debug.LogException(exception8);
  2483.                 }
  2484.                 finally
  2485.                 {
  2486.                     if (warning16 != null)
  2487.                     {
  2488.                         ((IDisposable) warning16).Dispose();
  2489.                     }
  2490.                 }
  2491.                 return true;
  2492.             }
  2493.             if ((rpc == 0x44f4b758) && (player == null))
  2494.             {
  2495.                 if (ConVar.Global.developer > 2)
  2496.                 {
  2497.                     UnityEngine.Debug.Log("CL_RPCMessage: GetPerformanceReport ");
  2498.                 }
  2499.                 TimeWarning warning18 = TimeWarning.New("GetPerformanceReport", (float) 0.1f);
  2500.                 try
  2501.                 {
  2502.                     using (TimeWarning.New("Call", (float) 0.1f))
  2503.                     {
  2504.                         message2 = new BaseEntity.RPCMessage {
  2505.                             connection = msg.connection,
  2506.                             player = player,
  2507.                             read = msg.read
  2508.                         };
  2509.                         BaseEntity.RPCMessage message6 = message2;
  2510.                         this.GetPerformanceReport(message6);
  2511.                     }
  2512.                 }
  2513.                 catch (Exception exception9)
  2514.                 {
  2515.                     Network.Net.cl.Disconnect("RPC Error in GetPerformanceReport", true);
  2516.                     UnityEngine.Debug.LogException(exception9);
  2517.                 }
  2518.                 finally
  2519.                 {
  2520.                     if (warning18 != null)
  2521.                     {
  2522.                         ((IDisposable) warning18).Dispose();
  2523.                     }
  2524.                 }
  2525.                 return true;
  2526.             }
  2527.             if ((rpc == 0x65f58c58) && (player == null))
  2528.             {
  2529.                 if (ConVar.Global.developer > 2)
  2530.                 {
  2531.                     UnityEngine.Debug.Log("CL_RPCMessage: OnDied ");
  2532.                 }
  2533.                 TimeWarning warning20 = TimeWarning.New("OnDied", (float) 0.1f);
  2534.                 try
  2535.                 {
  2536.                     using (TimeWarning.New("Call", (float) 0.1f))
  2537.                     {
  2538.                         message2 = new BaseEntity.RPCMessage {
  2539.                             connection = msg.connection,
  2540.                             player = player,
  2541.                             read = msg.read
  2542.                         };
  2543.                         BaseEntity.RPCMessage message7 = message2;
  2544.                         this.OnDied(message7);
  2545.                     }
  2546.                 }
  2547.                 catch (Exception exception10)
  2548.                 {
  2549.                     Network.Net.cl.Disconnect("RPC Error in OnDied", true);
  2550.                     UnityEngine.Debug.LogException(exception10);
  2551.                 }
  2552.                 finally
  2553.                 {
  2554.                     if (warning20 != null)
  2555.                     {
  2556.                         ((IDisposable) warning20).Dispose();
  2557.                     }
  2558.                 }
  2559.                 return true;
  2560.             }
  2561.             if ((rpc == 0x6a0cb968) && (player == null))
  2562.             {
  2563.                 if (ConVar.Global.developer > 2)
  2564.                 {
  2565.                     UnityEngine.Debug.Log("CL_RPCMessage: OnModelState ");
  2566.                 }
  2567.                 TimeWarning warning22 = TimeWarning.New("OnModelState", (float) 0.1f);
  2568.                 try
  2569.                 {
  2570.                     using (TimeWarning.New("Call", (float) 0.1f))
  2571.                     {
  2572.                         message2 = new BaseEntity.RPCMessage {
  2573.                             connection = msg.connection,
  2574.                             player = player,
  2575.                             read = msg.read
  2576.                         };
  2577.                         BaseEntity.RPCMessage data = message2;
  2578.                         this.OnModelState(data);
  2579.                     }
  2580.                 }
  2581.                 catch (Exception exception11)
  2582.                 {
  2583.                     Network.Net.cl.Disconnect("RPC Error in OnModelState", true);
  2584.                     UnityEngine.Debug.LogException(exception11);
  2585.                 }
  2586.                 finally
  2587.                 {
  2588.                     if (warning22 != null)
  2589.                     {
  2590.                         ((IDisposable) warning22).Dispose();
  2591.                     }
  2592.                 }
  2593.                 return true;
  2594.             }
  2595.             if ((rpc == 0x68eae6b2) && (player == null))
  2596.             {
  2597.                 if (ConVar.Global.developer > 2)
  2598.                 {
  2599.                     UnityEngine.Debug.Log("CL_RPCMessage: OnRespawnInformation ");
  2600.                 }
  2601.                 TimeWarning warning24 = TimeWarning.New("OnRespawnInformation", (float) 0.1f);
  2602.                 try
  2603.                 {
  2604.                     using (TimeWarning.New("Call", (float) 0.1f))
  2605.                     {
  2606.                         message2 = new BaseEntity.RPCMessage {
  2607.                             connection = msg.connection,
  2608.                             player = player,
  2609.                             read = msg.read
  2610.                         };
  2611.                         BaseEntity.RPCMessage message9 = message2;
  2612.                         this.OnRespawnInformation(message9);
  2613.                     }
  2614.                 }
  2615.                 catch (Exception exception12)
  2616.                 {
  2617.                     Network.Net.cl.Disconnect("RPC Error in OnRespawnInformation", true);
  2618.                     UnityEngine.Debug.LogException(exception12);
  2619.                 }
  2620.                 finally
  2621.                 {
  2622.                     if (warning24 != null)
  2623.                     {
  2624.                         ((IDisposable) warning24).Dispose();
  2625.                     }
  2626.                 }
  2627.                 return true;
  2628.             }
  2629.             if ((rpc == 0x96f15d26) && (player == null))
  2630.             {
  2631.                 if (ConVar.Global.developer > 2)
  2632.                 {
  2633.                     UnityEngine.Debug.Log("CL_RPCMessage: RecieveAchievement ");
  2634.                 }
  2635.                 TimeWarning warning26 = TimeWarning.New("RecieveAchievement", (float) 0.1f);
  2636.                 try
  2637.                 {
  2638.                     using (TimeWarning.New("Call", (float) 0.1f))
  2639.                     {
  2640.                         string name = msg.read.String();
  2641.                         this.RecieveAchievement(name);
  2642.                     }
  2643.                 }
  2644.                 catch (Exception exception13)
  2645.                 {
  2646.                     Network.Net.cl.Disconnect("RPC Error in RecieveAchievement", true);
  2647.                     UnityEngine.Debug.LogException(exception13);
  2648.                 }
  2649.                 finally
  2650.                 {
  2651.                     if (warning26 != null)
  2652.                     {
  2653.                         ((IDisposable) warning26).Dispose();
  2654.                     }
  2655.                 }
  2656.                 return true;
  2657.             }
  2658.             if ((rpc == 0xca54937a) && (player == null))
  2659.             {
  2660.                 if (ConVar.Global.developer > 2)
  2661.                 {
  2662.                     UnityEngine.Debug.Log("CL_RPCMessage: RPC_OpenLootPanel ");
  2663.                 }
  2664.                 TimeWarning warning28 = TimeWarning.New("RPC_OpenLootPanel", (float) 0.1f);
  2665.                 try
  2666.                 {
  2667.                     using (TimeWarning.New("Call", (float) 0.1f))
  2668.                     {
  2669.                         message2 = new BaseEntity.RPCMessage {
  2670.                             connection = msg.connection,
  2671.                             player = player,
  2672.                             read = msg.read
  2673.                         };
  2674.                         BaseEntity.RPCMessage message10 = message2;
  2675.                         this.RPC_OpenLootPanel(message10);
  2676.                     }
  2677.                 }
  2678.                 catch (Exception exception14)
  2679.                 {
  2680.                     Network.Net.cl.Disconnect("RPC Error in RPC_OpenLootPanel", true);
  2681.                     UnityEngine.Debug.LogException(exception14);
  2682.                 }
  2683.                 finally
  2684.                 {
  2685.                     if (warning28 != null)
  2686.                     {
  2687.                         ((IDisposable) warning28).Dispose();
  2688.                     }
  2689.                 }
  2690.                 return true;
  2691.             }
  2692.             if ((rpc == 0xaed1b915) && (player == null))
  2693.             {
  2694.                 if (ConVar.Global.developer > 2)
  2695.                 {
  2696.                     UnityEngine.Debug.Log("CL_RPCMessage: SetHostileLength ");
  2697.                 }
  2698.                 TimeWarning warning30 = TimeWarning.New("SetHostileLength", (float) 0.1f);
  2699.                 try
  2700.                 {
  2701.                     using (TimeWarning.New("Call", (float) 0.1f))
  2702.                     {
  2703.                         message2 = new BaseEntity.RPCMessage {
  2704.                             connection = msg.connection,
  2705.                             player = player,
  2706.                             read = msg.read
  2707.                         };
  2708.                         BaseEntity.RPCMessage message11 = message2;
  2709.                         this.SetHostileLength(message11);
  2710.                     }
  2711.                 }
  2712.                 catch (Exception exception15)
  2713.                 {
  2714.                     Network.Net.cl.Disconnect("RPC Error in SetHostileLength", true);
  2715.                     UnityEngine.Debug.LogException(exception15);
  2716.                 }
  2717.                 finally
  2718.                 {
  2719.                     if (warning30 != null)
  2720.                     {
  2721.                         ((IDisposable) warning30).Dispose();
  2722.                     }
  2723.                 }
  2724.                 return true;
  2725.             }
  2726.             if ((rpc == 0x3d5f9278) && (player == null))
  2727.             {
  2728.                 if (ConVar.Global.developer > 2)
  2729.                 {
  2730.                     UnityEngine.Debug.Log("CL_RPCMessage: SetWeaponDrawnDuration ");
  2731.                 }
  2732.                 TimeWarning warning32 = TimeWarning.New("SetWeaponDrawnDuration", (float) 0.1f);
  2733.                 try
  2734.                 {
  2735.                     using (TimeWarning.New("Call", (float) 0.1f))
  2736.                     {
  2737.                         message2 = new BaseEntity.RPCMessage {
  2738.                             connection = msg.connection,
  2739.                             player = player,
  2740.                             read = msg.read
  2741.                         };
  2742.                         BaseEntity.RPCMessage message12 = message2;
  2743.                         this.SetWeaponDrawnDuration(message12);
  2744.                     }
  2745.                 }
  2746.                 catch (Exception exception16)
  2747.                 {
  2748.                     Network.Net.cl.Disconnect("RPC Error in SetWeaponDrawnDuration", true);
  2749.                     UnityEngine.Debug.LogException(exception16);
  2750.                 }
  2751.                 finally
  2752.                 {
  2753.                     if (warning32 != null)
  2754.                     {
  2755.                         ((IDisposable) warning32).Dispose();
  2756.                     }
  2757.                 }
  2758.                 return true;
  2759.             }
  2760.             if ((rpc == 0xa766b6fb) && (player == null))
  2761.             {
  2762.                 if (ConVar.Global.developer > 2)
  2763.                 {
  2764.                     UnityEngine.Debug.Log("CL_RPCMessage: StartLoading ");
  2765.                 }
  2766.                 TimeWarning warning34 = TimeWarning.New("StartLoading", (float) 0.1f);
  2767.                 try
  2768.                 {
  2769.                     using (TimeWarning.New("Call", (float) 0.1f))
  2770.                     {
  2771.                         this.StartLoading();
  2772.                     }
  2773.                 }
  2774.                 catch (Exception exception17)
  2775.                 {
  2776.                     Network.Net.cl.Disconnect("RPC Error in StartLoading", true);
  2777.                     UnityEngine.Debug.LogException(exception17);
  2778.                 }
  2779.                 finally
  2780.                 {
  2781.                     if (warning34 != null)
  2782.                     {
  2783.                         ((IDisposable) warning34).Dispose();
  2784.                     }
  2785.                 }
  2786.                 return true;
  2787.             }
  2788.             if ((rpc == 0x910a1210) && (player == null))
  2789.             {
  2790.                 if (ConVar.Global.developer > 2)
  2791.                 {
  2792.                     UnityEngine.Debug.Log("CL_RPCMessage: UnlockedBlueprint ");
  2793.                 }
  2794.                 TimeWarning warning36 = TimeWarning.New("UnlockedBlueprint", (float) 0.1f);
  2795.                 try
  2796.                 {
  2797.                     using (TimeWarning.New("Call", (float) 0.1f))
  2798.                     {
  2799.                         message2 = new BaseEntity.RPCMessage {
  2800.                             connection = msg.connection,
  2801.                             player = player,
  2802.                             read = msg.read
  2803.                         };
  2804.                         BaseEntity.RPCMessage message13 = message2;
  2805.                         this.UnlockedBlueprint(message13);
  2806.                     }
  2807.                 }
  2808.                 catch (Exception exception18)
  2809.                 {
  2810.                     Network.Net.cl.Disconnect("RPC Error in UnlockedBlueprint", true);
  2811.                     UnityEngine.Debug.LogException(exception18);
  2812.                 }
  2813.                 finally
  2814.                 {
  2815.                     if (warning36 != null)
  2816.                     {
  2817.                         ((IDisposable) warning36).Dispose();
  2818.                     }
  2819.                 }
  2820.                 return true;
  2821.             }
  2822.         }
  2823.         return base.OnRpcMessage(player, rpc, msg);
  2824.     }
  2825.  
  2826.     public override void OnSignal(BaseEntity.Signal signal, string arg)
  2827.     {
  2828.         base.OnSignal(signal, arg);
  2829.         if (base.isVisible)
  2830.         {
  2831.             switch (signal)
  2832.             {
  2833.                 case BaseEntity.Signal.Attack:
  2834.                     if (this.playerModel != null)
  2835.                     {
  2836.                         this.playerModel.Attack();
  2837.                     }
  2838.                     break;
  2839.  
  2840.                 case BaseEntity.Signal.Alt_Attack:
  2841.                     if (this.playerModel != null)
  2842.                     {
  2843.                         this.playerModel.AltAttack();
  2844.                     }
  2845.                     break;
  2846.  
  2847.                 case BaseEntity.Signal.Reload:
  2848.                     if (this.playerModel != null)
  2849.                     {
  2850.                         this.playerModel.Reload();
  2851.                     }
  2852.                     break;
  2853.  
  2854.                 case BaseEntity.Signal.Flinch_Head:
  2855.                     if (this.playerModel != null)
  2856.                     {
  2857.                         this.playerModel.Flinch(0);
  2858.                     }
  2859.                     break;
  2860.  
  2861.                 case BaseEntity.Signal.Flinch_Chest:
  2862.                     if (this.playerModel != null)
  2863.                     {
  2864.                         this.playerModel.Flinch(1);
  2865.                     }
  2866.                     break;
  2867.  
  2868.                 case BaseEntity.Signal.Flinch_Stomach:
  2869.                     if (this.playerModel != null)
  2870.                     {
  2871.                         this.playerModel.Flinch(2);
  2872.                     }
  2873.                     break;
  2874.  
  2875.                 case BaseEntity.Signal.Flinch_RearHead:
  2876.                     if (this.playerModel != null)
  2877.                     {
  2878.                         this.playerModel.Flinch(3);
  2879.                     }
  2880.                     break;
  2881.  
  2882.                 case BaseEntity.Signal.Flinch_RearTorso:
  2883.                     if (this.playerModel != null)
  2884.                     {
  2885.                         this.playerModel.Flinch(4);
  2886.                     }
  2887.                     break;
  2888.  
  2889.                 case BaseEntity.Signal.Throw:
  2890.                     if (this.playerModel != null)
  2891.                     {
  2892.                         this.playerModel.Throw();
  2893.                     }
  2894.                     break;
  2895.  
  2896.                 case BaseEntity.Signal.Gesture:
  2897.                     if (this.playerModel != null)
  2898.                     {
  2899.                         this.playerModel.Gesture(arg);
  2900.                     }
  2901.                     break;
  2902.             }
  2903.         }
  2904.     }
  2905.  
  2906.     public virtual void OnViewModeChanged()
  2907.     {
  2908.         if (this.playerModel != null)
  2909.         {
  2910.             this.playerModel.drawShadowOnly = !this.shouldDrawBody;
  2911.             this.playerModel.Rebuild(true);
  2912.             this.UpdateClothingItems(this.playerModel.multiMesh);
  2913.         }
  2914.         GlobalMessages.OnViewModeChanged();
  2915.     }
  2916.  
  2917.     protected override void OnVisibilityChanged(bool visible)
  2918.     {
  2919.         if (((LocalPlayer.Entity != null) && (MainCamera.mainCamera != null)) && !this.IsLocalPlayer())
  2920.         {
  2921.             float dist = Vector3.Distance(MainCamera.mainCamera.transform.position, base.transform.position);
  2922.             this.VisUpdateUsingCulling(dist, visible);
  2923.         }
  2924.     }
  2925.  
  2926.     public override void OnVoiceData(byte[] data)
  2927.     {
  2928.         this.voiceSpeaker.Receive(data);
  2929.     }
  2930.  
  2931.     public override float PenetrationResistance(HitInfo info)
  2932.     {
  2933.         return 100f;
  2934.     }
  2935.  
  2936.     private void PlayOpenSound()
  2937.     {
  2938.         StorageContainer clientEntity = LocalPlayer.Entity.inventory.loot.GetClientEntity() as StorageContainer;
  2939.         if ((clientEntity != null) && (clientEntity.openSound != null))
  2940.         {
  2941.             SoundManager.PlayOneshot(clientEntity.openSound, clientEntity.gameObject, false, new Vector3());
  2942.         }
  2943.     }
  2944.  
  2945.     private bool PointSeePoint(Vector3 target, Vector3 origin, float dist = 0f, bool useGameTrace = false)
  2946.     {
  2947.         RaycastHit hit;
  2948.         bool flag = false;
  2949.         if (dist == 0f)
  2950.         {
  2951.             dist = Vector3.Distance(target, origin);
  2952.         }
  2953.         Vector3 vector2 = target - origin;
  2954.         Vector3 normalized = vector2.normalized;
  2955.         Ray ray = new Ray(origin, normalized);
  2956.         if (!useGameTrace ? UnityEngine.Physics.Raycast(ray, out hit, dist, 0xa10001) : GamePhysics.Trace(ray, 0f, out hit, dist, 0xa10001, QueryTriggerInteraction.UseGlobal))
  2957.         {
  2958.             ColliderInfo component = hit.collider.GetComponent<ColliderInfo>();
  2959.             if ((component == null) || component.HasFlag(ColliderInfo.Flags.Opaque))
  2960.             {
  2961.                 flag = true;
  2962.             }
  2963.         }
  2964.         return !flag;
  2965.     }
  2966.  
  2967.     public override void PostNetworkUpdate()
  2968.     {
  2969.         base.PostNetworkUpdate();
  2970.         if (base.isClient)
  2971.         {
  2972.             if (this.playerModel != null)
  2973.             {
  2974.                 bool showSash = this.playerModel.showSash;
  2975.                 this.playerModel.showSash = this.HasPlayerFlag(PlayerFlags.DisplaySash);
  2976.                 if (showSash != this.playerModel.showSash)
  2977.                 {
  2978.                     this.needsClothesRebuild = true;
  2979.                 }
  2980.             }
  2981.             if (this.wasSleeping && !this.IsSleeping())
  2982.             {
  2983.                 this.wakeTime = UnityEngine.Time.realtimeSinceStartup;
  2984.             }
  2985.             this.wasSleeping = this.IsSleeping();
  2986.             if (this.movement != null)
  2987.             {
  2988.                 this.movement.SetParent(base.transform.parent);
  2989.             }
  2990.         }
  2991.     }
  2992.  
  2993.     [Menu("promote", "Promote To Leader", Order=120, Time=3f, OnStart="Menu_Promote_Start"), Description("promote_desc", "Promote this team member to leader"), ShowIf("Promote_ShowIf"), Icon("upgrade")]
  2994.     public void Promote(BasePlayer player)
  2995.     {
  2996.         if (LocalPlayer.Entity.lookingAtEntity.GetComponent<BasePlayer>() != null)
  2997.         {
  2998.             ConsoleSystem.Run(ConsoleSystem.Option.Client, "promote", Array.Empty<object>());
  2999.         }
  3000.     }
  3001.  
  3002.     public bool Promote_ShowIf(BasePlayer player)
  3003.     {
  3004.         if (!RelationshipManager.TeamsEnabled())
  3005.         {
  3006.             return false;
  3007.         }
  3008.         if (!LocalPlayerIsLeader())
  3009.         {
  3010.             return false;
  3011.         }
  3012.         if (this == LocalPlayer.Entity)
  3013.         {
  3014.             return false;
  3015.         }
  3016.         BasePlayer component = LocalPlayer.Entity.lookingAtEntity.GetComponent<BasePlayer>();
  3017.         if (component == null)
  3018.         {
  3019.             return false;
  3020.         }
  3021.         if (component.IsDead())
  3022.         {
  3023.             return false;
  3024.         }
  3025.         return ((component.currentTeam == LocalPlayer.Entity.currentTeam) && (LocalPlayer.Entity.currentTeam != 0L));
  3026.     }
  3027.  
  3028.     internal void QuickUse()
  3029.     {
  3030.         if (!this.IsWounded() && !this.HeldItemUse())
  3031.         {
  3032.             BaseEntity interactionEntity = this.GetInteractionEntity();
  3033.             if (interactionEntity != null)
  3034.             {
  3035.                 interactionEntity.gameObject.SendMessage("OnUse", this, SendMessageOptions.DontRequireReceiver);
  3036.             }
  3037.         }
  3038.     }
  3039.  
  3040.     private void RebuildWorldModel()
  3041.     {
  3042.         if (this.playerModel != null)
  3043.         {
  3044.             this.playerModel.Clear();
  3045.             this.SetDefaultFootstepEffects();
  3046.             if (this.inventory.containerWear != null)
  3047.             {
  3048.                 foreach (Item item in this.inventory.containerWear.itemList)
  3049.                 {
  3050.                     ItemModWearable component = item.info.GetComponent<ItemModWearable>();
  3051.                     if (component != null)
  3052.                     {
  3053.                         component.OnDressModel(item, this.playerModel);
  3054.                     }
  3055.                 }
  3056.             }
  3057.             this.playerModel.Rebuild(true);
  3058.             this.UpdateClothingItems(this.playerModel.multiMesh);
  3059.             this.UpdateHolsterOffsets();
  3060.         }
  3061.     }
  3062.  
  3063.     [RPC_Client]
  3064.     public void RecieveAchievement(string name)
  3065.     {
  3066.         if (GameInfo.HasAchievements)
  3067.         {
  3068.             Facepunch.Steamworks.Client.Instance.Achievements.Trigger(name, true);
  3069.         }
  3070.     }
  3071.  
  3072.     public static void RegisterForVisibility(BasePlayer player)
  3073.     {
  3074.         if (!visiblePlayerList.Contains(player.userID))
  3075.         {
  3076.             visiblePlayerList.Add(player.userID, player);
  3077.         }
  3078.         player.RegisterForCulling();
  3079.     }
  3080.  
  3081.     [RPC_Client]
  3082.     private void RPC_OpenLootPanel(BaseEntity.RPCMessage rpc)
  3083.     {
  3084.         if (!Client.IsPlayingDemo && (LocalPlayer.Entity != null))
  3085.         {
  3086.             UIInventory.OpenLoot((!LocalPlayer.Entity.IsAdmin || !(lootPanelOverride != string.Empty)) ? rpc.read.String() : lootPanelOverride);
  3087.             this.PlayOpenSound();
  3088.         }
  3089.     }
  3090.  
  3091.     [Description("saltwater_desc", "Can't Drink This"), ShowIf("SaltWater_ShowIf"), Menu("saltwater", "Salt Water"), Icon("close")]
  3092.     public void SaltWater(BasePlayer player)
  3093.     {
  3094.     }
  3095.  
  3096.     public bool SaltWater_ShowIf(BasePlayer player)
  3097.     {
  3098.         if (this.movement == null)
  3099.         {
  3100.             return false;
  3101.         }
  3102.         if (this.movement.CurrentMoveSpeed() > 0.1f)
  3103.         {
  3104.             return false;
  3105.         }
  3106.         Vector3 waterDrinkingPoint = player.GetWaterDrinkingPoint();
  3107.         if (waterDrinkingPoint == Vector3.zero)
  3108.         {
  3109.             return false;
  3110.         }
  3111.         if (WaterResource.IsFreshWater(waterDrinkingPoint))
  3112.         {
  3113.             return false;
  3114.         }
  3115.         WaterLevel.WaterInfo waterInfo = WaterLevel.GetWaterInfo(waterDrinkingPoint);
  3116.         if (!waterInfo.isValid)
  3117.         {
  3118.             return false;
  3119.         }
  3120.         if (waterInfo.overallDepth < 0.05f)
  3121.         {
  3122.             return false;
  3123.         }
  3124.         return true;
  3125.     }
  3126.  
  3127.     public override void ScaleDamage(HitInfo info)
  3128.     {
  3129.         if (info.UseProtection)
  3130.         {
  3131.             HitArea boneArea = info.boneArea;
  3132.             if (boneArea != -1)
  3133.             {
  3134.                 this.cachedProtection.Clear();
  3135.                 this.cachedProtection.Add(this.inventory.containerWear.itemList, boneArea);
  3136.                 this.cachedProtection.Multiply(DamageType.Arrow, ConVar.Server.arrowarmor);
  3137.                 this.cachedProtection.Multiply(DamageType.Bullet, ConVar.Server.bulletarmor);
  3138.                 this.cachedProtection.Multiply(DamageType.Slash, ConVar.Server.meleearmor);
  3139.                 this.cachedProtection.Multiply(DamageType.Blunt, ConVar.Server.meleearmor);
  3140.                 this.cachedProtection.Multiply(DamageType.Stab, ConVar.Server.meleearmor);
  3141.                 this.cachedProtection.Multiply(DamageType.Bleeding, ConVar.Server.bleedingarmor);
  3142.                 this.cachedProtection.Scale(info.damageTypes, 1f);
  3143.             }
  3144.             else
  3145.             {
  3146.                 base.baseProtection.Scale(info.damageTypes, 1f);
  3147.             }
  3148.         }
  3149.         if (info.damageProperties != null)
  3150.         {
  3151.             info.damageProperties.ScaleDamage(info);
  3152.         }
  3153.     }
  3154.  
  3155.     internal void SendClientTick()
  3156.     {
  3157.         UnityEngine.Assertions.Assert.IsNotNull<PlayerInput>(this.input, "input is null");
  3158.         UnityEngine.Assertions.Assert.IsNotNull<InputState>(this.input.state, "input.state is null");
  3159.         UnityEngine.Assertions.Assert.IsNotNull<Network.Client>(Network.Net.cl, "Network.Net.cl is null");
  3160.         UnityEngine.Assertions.Assert.IsNotNull<Write>(Network.Net.cl.write, "Network.Net.cl.write is null");
  3161.         this.lastSentTickTime = UnityEngine.Time.realtimeSinceStartup;
  3162.         using (PlayerTick tick = Facepunch.Pool.Get<PlayerTick>())
  3163.         {
  3164.             Item activeItem = this.Belt.GetActiveItem();
  3165.             tick.activeItem = (activeItem == null) ? 0 : activeItem.uid;
  3166.             this.ModifyInputState(ref this.input.state);
  3167.             tick.inputState = this.input.state.current;
  3168.             tick.position = base.transform.localPosition;
  3169.             tick.eyePos = this.eyes.position;
  3170.             tick.parentID = this.parentEntity.uid;
  3171.             if (tick.modelState == null)
  3172.             {
  3173.                 tick.modelState = Facepunch.Pool.Get<ModelState>();
  3174.                 tick.modelState.onground = true;
  3175.             }
  3176.             if (this.modelState != null)
  3177.             {
  3178.                 this.modelState.CopyTo(tick.modelState);
  3179.             }
  3180.             if (Network.Net.cl.write.Start())
  3181.             {
  3182.                 Network.Net.cl.write.PacketID(Message.Type.Tick);
  3183.                 tick.WriteToStreamDelta(Network.Net.cl.write, this.lastSentTick);
  3184.                 SendInfo info = new SendInfo(Network.Net.cl.Connection) {
  3185.                     priority = Priority.Immediate
  3186.                 };
  3187.                 Network.Net.cl.write.Send(info);
  3188.             }
  3189.             if (Network.Net.cl.IsRecording)
  3190.             {
  3191.                 byte[] data = tick.ToProtoBytes();
  3192.                 Network.Net.cl.ManualRecordPacket(15, data, data.Length);
  3193.             }
  3194.             if (this.lastSentTick == null)
  3195.             {
  3196.                 this.lastSentTick = Facepunch.Pool.Get<PlayerTick>();
  3197.             }
  3198.             tick.CopyTo(this.lastSentTick);
  3199.         }
  3200.     }
  3201.  
  3202.     public void SendProjectileAttack(PlayerProjectileAttack attack)
  3203.     {
  3204.         base.ServerRPC<PlayerProjectileAttack>("OnProjectileAttack", attack);
  3205.     }
  3206.  
  3207.     public void SendProjectileRicochet(PlayerProjectileRicochet ricochet)
  3208.     {
  3209.         base.ServerRPC<PlayerProjectileRicochet>("OnProjectileRicochet", ricochet);
  3210.     }
  3211.  
  3212.     public void SendProjectileUpdate(PlayerProjectileUpdate update)
  3213.     {
  3214.         base.ServerRPC<PlayerProjectileUpdate>("OnProjectileUpdate", update);
  3215.     }
  3216.  
  3217.     internal void SendVoiceData(byte[] data, int len)
  3218.     {
  3219.         if (((Network.Net.cl != null) && Network.Net.cl.IsConnected()) && Network.Net.cl.write.Start())
  3220.         {
  3221.             Network.Net.cl.write.PacketID(Message.Type.VoiceData);
  3222.             Network.Net.cl.write.BytesWithSize(data, len);
  3223.             SendInfo info = new SendInfo(Network.Net.cl.Connection) {
  3224.                 priority = Priority.Immediate
  3225.             };
  3226.             Network.Net.cl.write.Send(info);
  3227.         }
  3228.     }
  3229.  
  3230.     private void SetDefaultFootstepEffects()
  3231.     {
  3232.         if (this.playerModel != null)
  3233.         {
  3234.             FootstepEffects component = this.playerModel.GetComponent<FootstepEffects>();
  3235.             component.footstepEffectName = "footstep/barefoot";
  3236.             component.jumpStartEffectName = "jump-start/barefoot";
  3237.             component.jumpLandEffectName = "jump-land/barefoot";
  3238.         }
  3239.     }
  3240.  
  3241.     [RPC_Client]
  3242.     public void SetHostileLength(BaseEntity.RPCMessage msg)
  3243.     {
  3244.         float num = msg.read.Float();
  3245.         HostileNote.unhostileTime = UnityEngine.Time.realtimeSinceStartup + num;
  3246.     }
  3247.  
  3248.     public override void SetNetworkPosition(Vector3 vPos)
  3249.     {
  3250.         if (!this.HasLocalControls() && !this.isMounted)
  3251.         {
  3252.             base.SetNetworkPosition(vPos);
  3253.         }
  3254.     }
  3255.  
  3256.     public override void SetNetworkRotation(Quaternion qRot)
  3257.     {
  3258.         if (!this.HasLocalControls() && !this.IsSpectating())
  3259.         {
  3260.             this.eyes.bodyRotation = qRot;
  3261.         }
  3262.     }
  3263.  
  3264.     private void SetNextVisThink(float addTime)
  3265.     {
  3266.         this.nextVisThink = UnityEngine.Time.realtimeSinceStartup + addTime;
  3267.     }
  3268.  
  3269.     [RPC_Client]
  3270.     public void SetWeaponDrawnDuration(BaseEntity.RPCMessage msg)
  3271.     {
  3272.         HostileNote.weaponDrawnDuration = msg.read.Float();
  3273.     }
  3274.  
  3275.     public override bool ShouldDestroyWithGroup()
  3276.     {
  3277.         if (this.IsLocalPlayer())
  3278.         {
  3279.             return false;
  3280.         }
  3281.         return base.ShouldDestroyWithGroup();
  3282.     }
  3283.  
  3284.     public override bool ShouldInheritNetworkGroup()
  3285.     {
  3286.         return (this.IsNpc || this.IsSpectating());
  3287.     }
  3288.  
  3289.     public override bool ShouldLerp()
  3290.     {
  3291.         if (this.IsLocalPlayer())
  3292.         {
  3293.             return false;
  3294.         }
  3295.         if (this.IsDead())
  3296.         {
  3297.             return false;
  3298.         }
  3299.         if (this.IsSleeping())
  3300.         {
  3301.             return false;
  3302.         }
  3303.         if (this.IsWounded())
  3304.         {
  3305.             return false;
  3306.         }
  3307.         return true;
  3308.     }
  3309.  
  3310.     public override float StartHealth()
  3311.     {
  3312.         return UnityEngine.Random.Range((float) 50f, (float) 60f);
  3313.     }
  3314.  
  3315.     [RPC_Client]
  3316.     private void StartLoading()
  3317.     {
  3318.         MapInterface.ResetMap();
  3319.         MusicManager.RaiseIntensityTo(0.75f, 0x3e7);
  3320.         LoadingScreen.Update("Receiving Data");
  3321.         LoadingScreen.Show();
  3322.     }
  3323.  
  3324.     public override float StartMaxHealth()
  3325.     {
  3326.         return 100f;
  3327.     }
  3328.  
  3329.     public bool SwapSeatCooldown()
  3330.     {
  3331.         return (UnityEngine.Time.time < this.nextSeatSwapTime);
  3332.     }
  3333.  
  3334.     private float TimeSinceSeen()
  3335.     {
  3336.         return (UnityEngine.Time.realtimeSinceStartup - this.lastTimeSeen);
  3337.     }
  3338.  
  3339.     public override BasePlayer ToPlayer()
  3340.     {
  3341.         return this;
  3342.     }
  3343.  
  3344.     public override string ToString()
  3345.     {
  3346.         if (base._name == null)
  3347.         {
  3348.             if (base.isServer)
  3349.             {
  3350.                 base._name = string.Format("{1}[{0}/{2}]", (base.net == null) ? ((object) 0) : ((object) base.net.ID), this.displayName, this.userID);
  3351.             }
  3352.             else
  3353.             {
  3354.                 base._name = base.ShortPrefabName;
  3355.             }
  3356.         }
  3357.         return base._name;
  3358.     }
  3359.  
  3360.     [RPC_Client]
  3361.     public void UnlockedBlueprint(BaseEntity.RPCMessage msg)
  3362.     {
  3363.         LocalPlayer.OnInventoryChanged();
  3364.         UIBlueprints.Refresh();
  3365.     }
  3366.  
  3367.     public static void UnregisterFromVisibility(ulong userID)
  3368.     {
  3369.         BasePlayer player;
  3370.         if (visiblePlayerList.TryGetValue(userID, out player))
  3371.         {
  3372.             visiblePlayerList.Remove(userID);
  3373.             player.UnregisterFromCulling();
  3374.         }
  3375.     }
  3376.  
  3377.     protected void UpdateClothesIfNeeded()
  3378.     {
  3379.         if ((this.needsClothesRebuild && this.IsAlive()) && base.isVisible)
  3380.         {
  3381.             this.needsClothesRebuild = false;
  3382.             this.RebuildWorldModel();
  3383.             this.UpdateProtectionFromClothing();
  3384.             this.UpdateMoveSpeedFromClothing();
  3385.             if (this.IsLocalPlayer())
  3386.             {
  3387.                 if (SingletonComponent<uiPlayerPreview>.Instance != null)
  3388.                 {
  3389.                     SingletonComponent<uiPlayerPreview>.Instance.UpdateFrom(this.playerModel);
  3390.                 }
  3391.                 bool flag = false;
  3392.                 bool flag2 = false;
  3393.                 foreach (Item item in this.inventory.containerWear.itemList)
  3394.                 {
  3395.                     ItemModWearable component = item.info.GetComponent<ItemModWearable>();
  3396.                     if ((component != null) && (component.occlusionType != UIBlackoutOverlay.blackoutType.NONE))
  3397.                     {
  3398.                         if (component.occlusionType == UIBlackoutOverlay.blackoutType.SNORKELGOGGLE)
  3399.                         {
  3400.                             flag2 = true;
  3401.                             flag = false;
  3402.                         }
  3403.                         else if (component.occlusionType == UIBlackoutOverlay.blackoutType.HELMETSLIT)
  3404.                         {
  3405.                             flag = true;
  3406.                             flag2 = false;
  3407.                         }
  3408.                         break;
  3409.                     }
  3410.                 }
  3411.                 UIBlackoutOverlay overlay = UIBlackoutOverlay.Get(UIBlackoutOverlay.blackoutType.HELMETSLIT);
  3412.                 if (overlay != null)
  3413.                 {
  3414.                     overlay.SetAlpha(!flag ? ((float) 0) : ((float) 1));
  3415.                 }
  3416.                 UIBlackoutOverlay overlay2 = UIBlackoutOverlay.Get(UIBlackoutOverlay.blackoutType.SNORKELGOGGLE);
  3417.                 if (overlay2 != null)
  3418.                 {
  3419.                     overlay2.SetAlpha(!flag2 ? ((float) 0) : ((float) 1));
  3420.                     WaterOverlay.goggles = flag2;
  3421.                 }
  3422.             }
  3423.             GlobalMessages.OnClothingChanged();
  3424.         }
  3425.     }
  3426.  
  3427.     public void UpdateClothingItems(SkinnedMultiMesh multiMesh)
  3428.     {
  3429.         if ((this.playerModel != null) && (this.inventory != null))
  3430.         {
  3431.             foreach (Item item in this.inventory.containerWear.itemList)
  3432.             {
  3433.                 ItemModWearable component = item.info.GetComponent<ItemModWearable>();
  3434.                 if (component != null)
  3435.                 {
  3436.                     SkinnedMultiMesh.Part[] partArray = multiMesh.FindParts(component.entityPrefab.resourcePath);
  3437.                     if (partArray != null)
  3438.                     {
  3439.                         List<IItemUpdate> results = Facepunch.Pool.GetList<IItemUpdate>();
  3440.                         foreach (SkinnedMultiMesh.Part part in partArray)
  3441.                         {
  3442.                             part.gameObject.GetComponentsInChildren<IItemUpdate>(true, results);
  3443.                             foreach (IItemUpdate update in results)
  3444.                             {
  3445.                                 update.OnItemUpdate(item);
  3446.                             }
  3447.                         }
  3448.                         Facepunch.Pool.FreeList<IItemUpdate>(ref results);
  3449.                     }
  3450.                 }
  3451.             }
  3452.         }
  3453.     }
  3454.  
  3455.     protected override void UpdateCullingSpheres()
  3456.     {
  3457.         Vector3 center;
  3458.         Matrix4x4 localToWorldMatrix;
  3459.         float radius = this.GetRadius() * 2f;
  3460.         if ((this.playerModel != null) && (this.playerModel.collision != null))
  3461.         {
  3462.             center = this.playerModel.collision.center;
  3463.             localToWorldMatrix = this.playerModel.transform.localToWorldMatrix;
  3464.         }
  3465.         else
  3466.         {
  3467.             center = this.bounds.center;
  3468.             localToWorldMatrix = base.transform.localToWorldMatrix;
  3469.         }
  3470.         if (this.IsSleeping() || this.IsWounded())
  3471.         {
  3472.             center.y *= 0.25f;
  3473.             radius *= !this.IsSleeping() ? 1f : 0.5f;
  3474.         }
  3475.         else if (this.IsDucked())
  3476.         {
  3477.             center.y *= 0.66f;
  3478.         }
  3479.         this.localOccludee.sphere = new OcclusionCulling.Sphere(localToWorldMatrix.MultiplyPoint3x4(center), radius);
  3480.     }
  3481.  
  3482.     public void UpdateHolsterOffsets()
  3483.     {
  3484.         if (base.children != null)
  3485.         {
  3486.             foreach (BaseEntity entity in base.children)
  3487.             {
  3488.                 if (entity != null)
  3489.                 {
  3490.                     HeldEntity component = entity.GetComponent<HeldEntity>();
  3491.                     if (component != null)
  3492.                     {
  3493.                         component.UpdateHolsteredOffset();
  3494.                     }
  3495.                 }
  3496.             }
  3497.         }
  3498.     }
  3499.  
  3500.     internal bool UpdateLookingAt(float radius, bool includeSecondaryEntities)
  3501.     {
  3502.         this.lookingAt = base.gameObject;
  3503.         this.lookingAtEntity = this;
  3504.         this.lookingAtCollider = this.triggerCollider;
  3505.         this.lookingAtPoint = this.eyes.position + ((Vector3) (this.eyes.HeadForward() * 8f));
  3506.         List<TraceInfo> traces = Facepunch.Pool.GetList<TraceInfo>();
  3507.         if (this.lookingAtTest == null)
  3508.         {
  3509.             this.lookingAtTest = new HitTest();
  3510.         }
  3511.         else
  3512.         {
  3513.             this.lookingAtTest.Clear();
  3514.         }
  3515.         using (TimeWarning.New("Traces", (float) 0.1f))
  3516.         {
  3517.             this.lookingAtTest.AttackRay = this.eyes.HeadRay();
  3518.             this.lookingAtTest.MaxDistance = 2f;
  3519.             this.lookingAtTest.Radius = radius;
  3520.             this.lookingAtTest.Forgiveness = radius;
  3521.             this.lookingAtTest.ignoreEntity = this;
  3522.             this.lookingAtTest.type = HitTest.Type.Use;
  3523.             GameTrace.TraceAll(this.lookingAtTest, traces, 0xdb16b01);
  3524.             for (int j = 0; j < traces.Count; j++)
  3525.             {
  3526.                 TraceInfo info = traces[j];
  3527.                 if (info.distance > 2f)
  3528.                 {
  3529.                     info.distance = 100f;
  3530.                 }
  3531.                 else if (info.entity == null)
  3532.                 {
  3533.                     info.distance = 100f;
  3534.                 }
  3535.                 else if ((!info.entity.HasMenuOptions && !(info.entity is WorldItem)) && (!(info.entity is CollectibleEntity) && !(info.entity is IOEntity)))
  3536.                 {
  3537.                     if (!includeSecondaryEntities)
  3538.                     {
  3539.                         info.distance = 100f;
  3540.                     }
  3541.                     else
  3542.                     {
  3543.                         info.distance++;
  3544.                     }
  3545.                 }
  3546.                 traces[j] = info;
  3547.             }
  3548.         }
  3549.         using (TimeWarning.New("Sort", (float) 0.1f))
  3550.         {
  3551.             if (<>f__am$cache0 == null)
  3552.             {
  3553.                 <>f__am$cache0 = (a, b) => a.distance.CompareTo(b.distance);
  3554.             }
  3555.             traces.Sort(<>f__am$cache0);
  3556.         }
  3557.         for (int i = 0; i < traces.Count; i++)
  3558.         {
  3559.             TraceInfo trace = traces[i];
  3560.             if ((trace.distance < 100f) && this.CheckLookingAtVisible(this.lookingAtTest, trace))
  3561.             {
  3562.                 trace.UpdateHitTest(this.lookingAtTest);
  3563.                 this.lookingAtPoint = this.lookingAtTest.HitPointWorld();
  3564.                 this.lookingAt = this.lookingAtTest.gameObject;
  3565.                 this.lookingAtCollider = this.lookingAtTest.collider;
  3566.                 this.lookingAtPoint = this.lookingAtTest.AttackRay.origin + ((Vector3) (this.lookingAtTest.AttackRay.direction * this.lookingAtTest.HitDistance));
  3567.                 this.lookingAtEntity = this.lookingAt.ToBaseEntity();
  3568.                 if (this.lookingAtEntity != null)
  3569.                 {
  3570.                     this.lookingAt = this.lookingAtEntity.gameObject;
  3571.                 }
  3572.                 break;
  3573.             }
  3574.         }
  3575.         Facepunch.Pool.FreeList<TraceInfo>(ref traces);
  3576.         return (this.lookingAtEntity != this);
  3577.     }
  3578.  
  3579.     private void UpdateMoveSpeedFromClothing()
  3580.     {
  3581.         float a = 0f;
  3582.         float num2 = 0f;
  3583.         float num3 = 0f;
  3584.         bool flag = false;
  3585.         bool flag2 = false;
  3586.         float num4 = 0f;
  3587.         foreach (Item item in this.inventory.containerWear.itemList)
  3588.         {
  3589.             ItemModWearable component = item.info.GetComponent<ItemModWearable>();
  3590.             if (component != null)
  3591.             {
  3592.                 if (component.blocksAiming)
  3593.                 {
  3594.                     flag = true;
  3595.                 }
  3596.                 if (component.blocksEquipping)
  3597.                 {
  3598.                     flag2 = true;
  3599.                 }
  3600.                 num4 += component.accuracyBonus;
  3601.                 if (component.movementProperties != null)
  3602.                 {
  3603.                     num2 += component.movementProperties.speedReduction;
  3604.                     a = Mathf.Max(a, component.movementProperties.minSpeedReduction);
  3605.                     num3 += component.movementProperties.waterSpeedBonus;
  3606.                 }
  3607.             }
  3608.         }
  3609.         this.clothingAccuracyBonus = num4;
  3610.         this.clothingMoveSpeedReduction = Mathf.Max(num2, a);
  3611.         this.clothingBlocksAiming = flag;
  3612.         this.clothingWaterSpeedBonus = num3;
  3613.         this.equippingBlocked = flag2;
  3614.     }
  3615.  
  3616.     public void UpdatePlayerCollider(bool state)
  3617.     {
  3618.         if (this.triggerCollider == null)
  3619.         {
  3620.             this.triggerCollider = base.gameObject.GetComponent<Collider>();
  3621.         }
  3622.         if (this.triggerCollider.enabled != state)
  3623.         {
  3624.             base.RemoveFromTriggers();
  3625.         }
  3626.         this.triggerCollider.enabled = state;
  3627.     }
  3628.  
  3629.     public void UpdatePlayerRigidbody(bool state)
  3630.     {
  3631.         if (this.physicsRigidbody == null)
  3632.         {
  3633.             this.physicsRigidbody = base.gameObject.GetComponent<Rigidbody>();
  3634.         }
  3635.         if (state)
  3636.         {
  3637.             if (this.physicsRigidbody == null)
  3638.             {
  3639.                 this.physicsRigidbody = base.gameObject.AddComponent<Rigidbody>();
  3640.                 this.physicsRigidbody.useGravity = false;
  3641.                 this.physicsRigidbody.isKinematic = true;
  3642.                 this.physicsRigidbody.mass = 1f;
  3643.                 this.physicsRigidbody.interpolation = RigidbodyInterpolation.None;
  3644.                 this.physicsRigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete;
  3645.             }
  3646.         }
  3647.         else
  3648.         {
  3649.             base.RemoveFromTriggers();
  3650.             if (this.physicsRigidbody != null)
  3651.             {
  3652.                 GameManager.Destroy(this.physicsRigidbody, 0f);
  3653.                 this.physicsRigidbody = null;
  3654.             }
  3655.         }
  3656.     }
  3657.  
  3658.     public static void UpdatePlayerVisibilities()
  3659.     {
  3660.         if (PlayerCull.enabled || Culling.toggle)
  3661.         {
  3662.             BasePlayer[] buffer = VisiblePlayerList.Buffer;
  3663.             int count = VisiblePlayerList.Count;
  3664.             for (int i = 0; i < count; i++)
  3665.             {
  3666.                 BasePlayer player = buffer[i];
  3667.                 if (player.WantsVisUpdate())
  3668.                 {
  3669.                     player.VisUpdate();
  3670.                 }
  3671.             }
  3672.         }
  3673.     }
  3674.  
  3675.     public virtual void UpdateProtectionFromClothing()
  3676.     {
  3677.         base.baseProtection.Clear();
  3678.         base.baseProtection.Add(this.inventory.containerWear.itemList, -1);
  3679.         float num = 0.1666667f;
  3680.         for (int i = 0; i < base.baseProtection.amounts.Length; i++)
  3681.         {
  3682.             if (i != 0x11)
  3683.             {
  3684.                 base.baseProtection.amounts[i] *= num;
  3685.             }
  3686.         }
  3687.     }
  3688.  
  3689.     public void UpdateTopologyStats()
  3690.     {
  3691.         if ((TerrainMeta.TopologyMap != null) && (UnityEngine.Time.realtimeSinceStartup >= this.nextTopologyTestTime))
  3692.         {
  3693.             this.nextTopologyTestTime = UnityEngine.Time.realtimeSinceStartup + 5f;
  3694.             if ((TerrainMeta.TopologyMap.GetTopology(base.transform.position) & 0x800) != 0)
  3695.             {
  3696.                 Facepunch.Rust.Analytics.TimeOnRoad += 5f;
  3697.             }
  3698.         }
  3699.     }
  3700.  
  3701.     public void UpdateViewMode()
  3702.     {
  3703.         CameraMode idealViewMode = this.idealViewMode;
  3704.         if (idealViewMode != this.currentViewMode)
  3705.         {
  3706.             this.currentViewMode = idealViewMode;
  3707.             this.OnViewModeChanged();
  3708.         }
  3709.     }
  3710.  
  3711.     internal void UseAction(InputState state)
  3712.     {
  3713.         if (!state.IsDown(BUTTON.USE))
  3714.         {
  3715.             if ((UnityEngine.Time.realtimeSinceStartup - this.usePressTime) < ConVar.Input.holdtime)
  3716.             {
  3717.                 this.usePressTime = 0f;
  3718.                 this.QuickUse();
  3719.             }
  3720.             if (this.useHeldTime != 0f)
  3721.             {
  3722.                 this.UseStop();
  3723.                 this.useHeldTime = 0f;
  3724.             }
  3725.         }
  3726.         else
  3727.         {
  3728.             if (state.WasJustPressed(BUTTON.USE))
  3729.             {
  3730.                 this.usePressTime = UnityEngine.Time.realtimeSinceStartup;
  3731.             }
  3732.             if ((this.usePressTime != 0f) && ((UnityEngine.Time.realtimeSinceStartup - this.usePressTime) > ConVar.Input.holdtime))
  3733.             {
  3734.                 this.usePressTime = 0f;
  3735.                 this.LongUse();
  3736.                 this.useHeldTime = UnityEngine.Time.realtimeSinceStartup;
  3737.             }
  3738.         }
  3739.     }
  3740.  
  3741.     internal void UseStop()
  3742.     {
  3743.         if (!this.IsWounded())
  3744.         {
  3745.             BaseEntity interactionEntity = this.GetInteractionEntity();
  3746.             if (interactionEntity != null)
  3747.             {
  3748.                 interactionEntity.gameObject.SendMessage("OnUseStopped", this, SendMessageOptions.DontRequireReceiver);
  3749.             }
  3750.         }
  3751.     }
  3752.  
  3753.     private bool VisPlayerArmed()
  3754.     {
  3755.         HeldEntity heldEntity = this.GetHeldEntity();
  3756.         return ((heldEntity != null) && (heldEntity is BaseProjectile));
  3757.     }
  3758.  
  3759.     private void VisUpdate()
  3760.     {
  3761.         if (((LocalPlayer.Entity != null) && (MainCamera.mainCamera != null)) && !this.IsLocalPlayer())
  3762.         {
  3763.             if (Culling.toggle)
  3764.             {
  3765.                 float dist = Vector3.Distance(MainCamera.mainCamera.transform.position, base.transform.position);
  3766.                 if (UnityEngine.Time.realtimeSinceStartup >= this.nextVisThink)
  3767.                 {
  3768.                     this.VisUpdateUsingCulling(dist, this.CheckVisibility());
  3769.                 }
  3770.                 float addTime = base.CalcEntityVisUpdateRate() + UnityEngine.Random.Range((float) 0f, (float) 0.1f);
  3771.                 this.SetNextVisThink(addTime);
  3772.                 if (OcclusionCulling.DebugFilterIsDynamic(Culling.debug))
  3773.                 {
  3774.                     UnityEngine.Color color = !this.IsDead() ? (!base.isVisible ? UnityEngine.Color.red : UnityEngine.Color.green) : UnityEngine.Color.black;
  3775.                     if (this.IsSleeping())
  3776.                     {
  3777.                         UnityEngine.DDraw.Box(this.localOccludee.sphere.position, this.localOccludee.sphere.radius * 1.5f, color, addTime, false);
  3778.                     }
  3779.                     else
  3780.                     {
  3781.                         UnityEngine.DDraw.SphereGizmo(this.localOccludee.sphere.position, this.localOccludee.sphere.radius, color, addTime, false, false);
  3782.                     }
  3783.                 }
  3784.             }
  3785.             else
  3786.             {
  3787.                 float num3 = Vector3.Distance(LocalPlayer.Entity.eyes.position, base.transform.position);
  3788.                 if (UnityEngine.Time.realtimeSinceStartup >= this.nextVisThink)
  3789.                 {
  3790.                     this.VisUpdateUsingRays(num3);
  3791.                 }
  3792.                 float num4 = this.CalcVisUpdateRate(num3) + UnityEngine.Random.Range((float) 0f, (float) 0.1f);
  3793.                 this.SetNextVisThink(num4);
  3794.             }
  3795.         }
  3796.     }
  3797.  
  3798.     private void VisUpdateUsingCulling(float dist, bool visibility)
  3799.     {
  3800.         bool flag = true;
  3801.         float entityMinCullDist = Culling.entityMinCullDist;
  3802.         float entityMinAnimatorCullDist = Culling.entityMinAnimatorCullDist;
  3803.         float entityMinShadowCullDist = Culling.entityMinShadowCullDist;
  3804.         float entityMaxDist = Culling.entityMaxDist;
  3805.         this.UpdateCullingBounds();
  3806.         if (dist > entityMaxDist)
  3807.         {
  3808.             flag = false;
  3809.         }
  3810.         else if (dist <= entityMinCullDist)
  3811.         {
  3812.             flag = true;
  3813.         }
  3814.         else
  3815.         {
  3816.             flag = visibility;
  3817.         }
  3818.         base.isVisible = flag;
  3819.         base.isAnimatorVisible = base.isVisible || (dist <= entityMinAnimatorCullDist);
  3820.         base.isShadowVisible = base.isVisible || (dist <= entityMinShadowCullDist);
  3821.     }
  3822.  
  3823.     private void VisUpdateUsingRays(float dist)
  3824.     {
  3825.         bool flag = true;
  3826.         if (this.IsSleeping() && (dist > PlayerCull.maxSleeperDist))
  3827.         {
  3828.             flag = false;
  3829.         }
  3830.         else if (dist > PlayerCull.maxPlayerDist)
  3831.         {
  3832.             flag = false;
  3833.         }
  3834.         else if (dist <= PlayerCull.minCullDist)
  3835.         {
  3836.             flag = true;
  3837.         }
  3838.         else if (IsAimingAt(LocalPlayer.Entity, this, 0.99f))
  3839.         {
  3840.             flag = true;
  3841.         }
  3842.         else if (IsAimingAt(this, LocalPlayer.Entity, 0.99f))
  3843.         {
  3844.             flag = true;
  3845.         }
  3846.         else
  3847.         {
  3848.             Vector3 vector2 = this.eyes.position - LocalPlayer.Entity.eyes.position;
  3849.             Vector3 normalized = vector2.normalized;
  3850.             if (Vector3.Dot(LocalPlayer.Entity.eyes.HeadForward(), normalized) < 0f)
  3851.             {
  3852.                 flag = false;
  3853.             }
  3854.             else
  3855.             {
  3856.                 flag = this.AnyPartVisible();
  3857.             }
  3858.         }
  3859.         if (flag)
  3860.         {
  3861.             this.lastTimeSeen = UnityEngine.Time.realtimeSinceStartup;
  3862.         }
  3863.         if (flag || (this.TimeSinceSeen() <= 2f))
  3864.         {
  3865.             base.isVisible = true;
  3866.         }
  3867.         else
  3868.         {
  3869.             base.isVisible = false;
  3870.         }
  3871.         base.isAnimatorVisible = base.isVisible;
  3872.         base.isShadowVisible = base.isVisible;
  3873.     }
  3874.  
  3875.     private bool WantsVisUpdate()
  3876.     {
  3877.         return (UnityEngine.Time.realtimeSinceStartup >= this.nextVisThink);
  3878.     }
  3879.  
  3880.     public override float WaterFactor()
  3881.     {
  3882.         if (this.isMounted)
  3883.         {
  3884.             return this.GetMounted().WaterFactorForPlayer(this);
  3885.         }
  3886.         return base.WaterFactor();
  3887.     }
  3888.  
  3889.     public Network.Connection Connection
  3890.     {
  3891.         get
  3892.         {
  3893.             return ((base.net != null) ? base.net.connection : null);
  3894.         }
  3895.     }
  3896.  
  3897.     public string displayName
  3898.     {
  3899.         get
  3900.         {
  3901.             if (base.isClient && ConVar.Global.streamermode)
  3902.             {
  3903.                 return RandomUsernames.Get(this.userID);
  3904.             }
  3905.             return this._displayName;
  3906.         }
  3907.         set
  3908.         {
  3909.             this._displayName = value;
  3910.         }
  3911.     }
  3912.  
  3913.     public override bool HasMenuOptions
  3914.     {
  3915.         get
  3916.         {
  3917.             return (this.Climb_ShowIf(LocalPlayer.Entity) || (this.Drink_ShowIf(LocalPlayer.Entity) || (this.Invite_ShowIf(LocalPlayer.Entity) || (this.Menu_AssistPlayer_ShowIf(LocalPlayer.Entity) || (this.Menu_LootPlayer_ShowIf(LocalPlayer.Entity) || (this.Promote_ShowIf(LocalPlayer.Entity) || (this.SaltWater_ShowIf(LocalPlayer.Entity) || base.HasMenuOptions)))))));
  3918.         }
  3919.     }
  3920.  
  3921.     internal CameraMode idealViewMode
  3922.     {
  3923.         get
  3924.         {
  3925.             if (!this.IsSpectating())
  3926.             {
  3927.                 if (this.IsSleeping())
  3928.                 {
  3929.                     return CameraMode.Eyes;
  3930.                 }
  3931.                 if (this.IsWounded())
  3932.                 {
  3933.                     return CameraMode.Eyes;
  3934.                 }
  3935.                 if (this.IsDead())
  3936.                 {
  3937.                     return CameraMode.Eyes;
  3938.                 }
  3939.             }
  3940.             return this.selectedViewMode;
  3941.         }
  3942.     }
  3943.  
  3944.     public bool IsAdmin
  3945.     {
  3946.         get
  3947.         {
  3948.             return this.HasPlayerFlag(PlayerFlags.IsAdmin);
  3949.         }
  3950.     }
  3951.  
  3952.     public bool IsAiming
  3953.     {
  3954.         get
  3955.         {
  3956.             return this.HasPlayerFlag(PlayerFlags.Aiming);
  3957.         }
  3958.     }
  3959.  
  3960.     public bool IsConnected
  3961.     {
  3962.         get
  3963.         {
  3964.             return (base.isClient && this.HasPlayerFlag(PlayerFlags.Connected));
  3965.         }
  3966.     }
  3967.  
  3968.     public bool IsDeveloper
  3969.     {
  3970.         get
  3971.         {
  3972.             return this.HasPlayerFlag(PlayerFlags.IsDeveloper);
  3973.         }
  3974.     }
  3975.  
  3976.     public bool IsFlying
  3977.     {
  3978.         get
  3979.         {
  3980.             return ((this.modelState != null) && this.modelState.flying);
  3981.         }
  3982.     }
  3983.  
  3984.     public bool isMounted
  3985.     {
  3986.         get
  3987.         {
  3988.             return this.mounted.IsValid(base.isServer);
  3989.         }
  3990.     }
  3991.  
  3992.     public bool IsReceivingSnapshot
  3993.     {
  3994.         get
  3995.         {
  3996.             return this.HasPlayerFlag(PlayerFlags.ReceivingSnapshot);
  3997.         }
  3998.     }
  3999.  
  4000.     internal bool shouldDrawBody
  4001.     {
  4002.         get
  4003.         {
  4004.             if (this.IsLocalPlayer())
  4005.             {
  4006.                 if (this.IsDead())
  4007.                 {
  4008.                     return false;
  4009.                 }
  4010.                 if ((SingletonComponent<CameraMan>.Instance != null) && SingletonComponent<CameraMan>.Instance.isActiveAndEnabled)
  4011.                 {
  4012.                     return true;
  4013.                 }
  4014.                 if (this.currentViewMode == CameraMode.FirstPerson)
  4015.                 {
  4016.                     return false;
  4017.                 }
  4018.             }
  4019.             return true;
  4020.         }
  4021.     }
  4022.  
  4023.     public float TimeAwake
  4024.     {
  4025.         get
  4026.         {
  4027.             return (!this.IsSleeping() ? (UnityEngine.Time.realtimeSinceStartup - this.wakeTime) : 0f);
  4028.         }
  4029.     }
  4030.  
  4031.     public override BaseEntity.TraitFlag Traits
  4032.     {
  4033.         get
  4034.         {
  4035.             return ((((base.Traits | BaseEntity.TraitFlag.Human) | BaseEntity.TraitFlag.Food) | BaseEntity.TraitFlag.Meat) | BaseEntity.TraitFlag.Alive);
  4036.         }
  4037.     }
  4038.  
  4039.     public static BufferList<BasePlayer> VisiblePlayerList
  4040.     {
  4041.         get
  4042.         {
  4043.             return visiblePlayerList.Values;
  4044.         }
  4045.     }
  4046.  
  4047.     [CompilerGenerated]
  4048.     private sealed class <FinishedLoadingRoutine>c__Iterator0 : IEnumerator, IDisposable, IEnumerator<object>
  4049.     {
  4050.         internal object $current;
  4051.         internal bool $disposing;
  4052.         internal int $PC;
  4053.         internal BasePlayer $this;
  4054.  
  4055.         [DebuggerHidden]
  4056.         public void Dispose()
  4057.         {
  4058.             this.$disposing = true;
  4059.             this.$PC = -1;
  4060.         }
  4061.  
  4062.         public bool MoveNext()
  4063.         {
  4064.             uint num = (uint) this.$PC;
  4065.             this.$PC = -1;
  4066.             switch (num)
  4067.             {
  4068.                 case 0:
  4069.                     UIInventory.Close();
  4070.                     MapInterface.SetOpen(false);
  4071.                     HostileNote.unhostileTime = 0f;
  4072.                     HostileNote.weaponDrawnDuration = 0f;
  4073.                     MusicManager.RaiseIntensityTo(1f, 0x3e7);
  4074.                     this.$this.eyes.FrameUpdate(MainCamera.mainCamera);
  4075.                     LoadingScreen.Update("Refreshing Dynamic Decor");
  4076.                     DecorSpawn.RefreshAll(false);
  4077.                     LoadingScreen.Update("Refreshing Foliage");
  4078.                     FoliageGrid.RefreshAll(false);
  4079.                     LoadingScreen.Update("Processing Deferred Actions");
  4080.                     LoadBalancer.ProcessAll();
  4081.                     LoadingScreen.Update("Refreshing LODs");
  4082.                     LODGrid.RefreshAll();
  4083.                     LoadingScreen.Update("Refreshing Renderers");
  4084.                     RendererGrid.RefreshAll();
  4085.                     LoadingScreen.Update("Cleaning Up");
  4086.                     System.GC.Collect();
  4087.                     LoadingScreen.Update("Entering Game");
  4088.                     MainMenuSystem.Hide();
  4089.                     LoadingScreen.Hide();
  4090.                     this.$this.ServerRPC("ClientLoadingComplete");
  4091.                     this.$current = null;
  4092.                     if (!this.$disposing)
  4093.                     {
  4094.                         this.$PC = 1;
  4095.                     }
  4096.                     return true;
  4097.  
  4098.                 case 1:
  4099.                     this.$PC = -1;
  4100.                     break;
  4101.             }
  4102.             return false;
  4103.         }
  4104.  
  4105.         [DebuggerHidden]
  4106.         public void Reset()
  4107.         {
  4108.             throw new NotSupportedException();
  4109.         }
  4110.  
  4111.         object IEnumerator<object>.Current
  4112.         {
  4113.             [DebuggerHidden]
  4114.             get
  4115.             {
  4116.                 return this.$current;
  4117.             }
  4118.         }
  4119.  
  4120.         object IEnumerator.Current
  4121.         {
  4122.             [DebuggerHidden]
  4123.             get
  4124.             {
  4125.                 return this.$current;
  4126.             }
  4127.         }
  4128.     }
  4129.  
  4130.     public enum CameraMode
  4131.     {
  4132.         FirstPerson,
  4133.         ThirdPerson,
  4134.         Eyes
  4135.     }
  4136.  
  4137.     [Flags]
  4138.     public enum PlayerFlags
  4139.     {
  4140.         Aiming = 0x4000,
  4141.         ChatMute = 0x1000,
  4142.         Connected = 0x100,
  4143.         DisplaySash = 0x8000,
  4144.         EyesViewmode = 0x800,
  4145.         IsAdmin = 4,
  4146.         IsDeveloper = 0x80,
  4147.         NoSprint = 0x2000,
  4148.         ReceivingSnapshot = 8,
  4149.         Relaxed = 0x10000,
  4150.         SafeZone = 0x20000,
  4151.         Sleeping = 0x10,
  4152.         Spectating = 0x20,
  4153.         ThirdPersonViewmode = 0x400,
  4154.         Unused1 = 1,
  4155.         Unused2 = 2,
  4156.         VoiceMuted = 0x200,
  4157.         Workbench1 = 0x100000,
  4158.         Workbench2 = 0x200000,
  4159.         Workbench3 = 0x400000,
  4160.         Wounded = 0x40
  4161.     }
  4162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement