Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ConVar;
- using Facepunch;
- using Facepunch.Rust;
- using Facepunch.Steamworks;
- using GameMenu;
- using Network;
- using ProtoBuf;
- using Rust;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using System.Text;
- using UnityEngine;
- using UnityEngine.Assertions;
- public class BasePlayer : BaseCombatEntity
- {
- private GameMenu.Option __menuOption_Climb;
- private GameMenu.Option __menuOption_Drink;
- private GameMenu.Option __menuOption_InviteToTeam;
- private GameMenu.Option __menuOption_Menu_AssistPlayer;
- private GameMenu.Option __menuOption_Menu_LootPlayer;
- private GameMenu.Option __menuOption_Promote;
- private GameMenu.Option __menuOption_SaltWater;
- protected string _displayName;
- [CompilerGenerated]
- private static Comparison<TraceInfo> <>f__am$cache0;
- public PlayerBelt Belt;
- [NonSerialized]
- public PlayerBlueprints blueprints;
- private BuildingPrivlidge cachedBuildingPrivilege;
- private float cachedBuildingPrivilegeTime;
- private ProtectionProperties cachedProtection;
- private float cachedThreatLevel;
- private uint clActiveItem;
- public PlayerTeam clientTeam;
- public float clothingAccuracyBonus;
- public bool clothingBlocksAiming;
- public float clothingMoveSpeedReduction;
- public float clothingWaterSpeedBonus;
- [NonSerialized]
- public BaseCollision collision;
- public static int craftMode = 0;
- public ulong currentTeam;
- [NonSerialized]
- public CameraMode currentViewMode;
- private bool debugPrevVisible;
- private const int displayNameMaxLength = 0x20;
- private const float drinkMovementSpeed = 0.1f;
- private const float drinkRange = 1.5f;
- public GameObjectRef drownEffect;
- public bool equippingBlocked;
- [NonSerialized]
- public PlayerEyes eyes;
- [Header("BasePlayer")]
- public GameObjectRef fallDamageEffect;
- [NonSerialized]
- public bool Frozen;
- [NonSerialized]
- public PlayerInput input;
- [NonSerialized]
- public PlayerInventory inventory;
- private uint lastClothesHash = uint.MaxValue;
- public static float lastDeathTimeClient = -1f;
- private float lastHeadshotSoundTime;
- private Vector3 lastReviveDirection;
- private Vector3 lastRevivePoint;
- private PlayerTick lastSentTick;
- private float lastSentTickTime;
- private float lastTimeSeen;
- private float lastUpdateTime;
- [NonSerialized]
- public GameObject lookingAt;
- [NonSerialized]
- public Collider lookingAtCollider;
- [NonSerialized]
- public BaseEntity lookingAtEntity;
- [NonSerialized]
- public Vector3 lookingAtPoint;
- private HitTest lookingAtTest;
- [ClientVar(ClientAdmin=true)]
- public static string lootPanelOverride = string.Empty;
- private int maxProjectileID;
- [NonSerialized]
- public PlayerMetabolism metabolism;
- [NonSerialized]
- public ModelState modelState;
- [NonSerialized]
- private EntityRef mounted;
- [NonSerialized]
- public BaseMovement movement;
- private bool needsClothesRebuild;
- private float nextSeatSwapTime;
- private float nextTopologyTestTime;
- private float nextVisThink;
- public static bool oldCameraFix = false;
- [NonSerialized]
- private Rigidbody physicsRigidbody;
- private const string playerCollisionPrefab = "assets/prefabs/player/player_collision.prefab";
- [InspectorFlags]
- public PlayerFlags playerFlags;
- [NonSerialized]
- public PlayerModel playerModel;
- private const string playerModelPrefab = "assets/prefabs/player/player_model.prefab";
- [NonSerialized]
- public CameraMode selectedViewMode;
- [NonSerialized]
- private Collider triggerCollider;
- private float useHeldTime;
- private float usePressTime;
- [NonSerialized]
- public ulong userID;
- [NonSerialized]
- public string UserIDString;
- private static ListDictionary<ulong, BasePlayer> visiblePlayerList = new ListDictionary<ulong, BasePlayer>(8);
- [NonSerialized]
- public PlayerVoiceRecorder voiceRecorder;
- [NonSerialized]
- public PlayerVoiceSpeaker voiceSpeaker;
- private float wakeTime;
- private bool wasSleeping;
- public BasePlayer()
- {
- ModelState state = new ModelState {
- onground = true
- };
- this.modelState = state;
- this.lastUpdateTime = float.NegativeInfinity;
- this.lastSentTickTime = float.NegativeInfinity;
- this.debugPrevVisible = true;
- }
- private bool AnyPartVisible()
- {
- Vector3 position = LocalPlayer.Entity.eyes.position;
- Vector3 vector2 = LocalPlayer.Entity.eyes.HeadRight();
- Vector3 b = base.CenterPoint();
- if (this.IsSleeping())
- {
- b += new Vector3(0f, 1f, 0f);
- }
- float dist = Vector3.Distance(position, b);
- bool flag = false;
- flag = this.PointSeePoint(position, b, dist, true);
- if (!this.IsSleeping())
- {
- if (!flag && (PlayerCull.visQuality > 0))
- {
- Vector3 origin = this.eyes.position;
- flag = this.PointSeePoint(position, origin, dist, false);
- }
- if (!flag && (PlayerCull.visQuality > 1))
- {
- Vector3 vector5 = b + ((Vector3) (vector2 * 0.25f));
- flag = this.PointSeePoint(position, vector5, dist, false);
- if (!flag)
- {
- Vector3 vector6 = b + ((Vector3) (vector2 * -0.25f));
- flag = this.PointSeePoint(position, vector6, dist, false);
- }
- }
- if (!flag && (PlayerCull.visQuality > 2))
- {
- flag = this.PointSeePoint(position, base.transform.position + new Vector3(0f, 0.1f, 0f), dist, false);
- }
- }
- return flag;
- }
- public static bool AnyPlayersVisibleToEntity(Vector3 pos, float radius, BaseEntity source, Vector3 entityEyePos, bool ignorePlayersWithPriv = false)
- {
- List<RaycastHit> hits = Facepunch.Pool.GetList<RaycastHit>();
- List<BasePlayer> list = Facepunch.Pool.GetList<BasePlayer>();
- Vis.Entities<BasePlayer>(pos, radius, list, 0x20000, QueryTriggerInteraction.Collide);
- bool flag = false;
- foreach (BasePlayer player in list)
- {
- if ((player.IsSleeping() || !player.IsAlive()) || (player.IsBuildingAuthed() && ignorePlayersWithPriv))
- {
- continue;
- }
- hits.Clear();
- Vector3 vector = entityEyePos - player.eyes.position;
- GamePhysics.TraceAll(new Ray(player.eyes.position, vector.normalized), 0f, hits, 9f, 0x48a12101, QueryTriggerInteraction.UseGlobal);
- for (int i = 0; i < hits.Count; i++)
- {
- BaseEntity entity = hits[i].GetEntity();
- if ((entity != null) && ((entity == source) || entity.EqualNetID(source)))
- {
- flag = true;
- break;
- }
- if ((entity == null) || entity.ShouldBlockProjectiles())
- {
- break;
- }
- }
- if (flag)
- {
- break;
- }
- }
- Facepunch.Pool.FreeList<RaycastHit>(ref hits);
- Facepunch.Pool.FreeList<BasePlayer>(ref list);
- return flag;
- }
- public virtual void BlockJump(float duration = 0.5f)
- {
- if (this.movement != null)
- {
- this.movement.BlockJump(duration);
- }
- }
- public virtual void BlockSprint(float duration = 0.2f)
- {
- if (this.movement != null)
- {
- this.movement.BlockSprint(duration);
- }
- }
- private float CalcVisUpdateRate(float dist)
- {
- if (this.IsSleeping() && (dist > PlayerCull.maxSleeperDist))
- {
- if (dist > 80f)
- {
- return 10f;
- }
- if (dist > 30f)
- {
- return 3f;
- }
- if (dist > 15f)
- {
- return 1f;
- }
- }
- return (1f / Mathf.Clamp(PlayerCull.updateRate, 0.015f, float.PositiveInfinity));
- }
- public bool CanAttack()
- {
- HeldEntity heldEntity = this.GetHeldEntity();
- if (heldEntity == null)
- {
- return false;
- }
- bool flag = this.IsSwimming();
- bool flag2 = heldEntity.CanBeUsedInWater();
- if (this.movement != null)
- {
- if (this.movement.adminCheat)
- {
- return true;
- }
- if (!flag && !this.movement.IsGrounded)
- {
- return false;
- }
- }
- if (this.modelState.onLadder)
- {
- return false;
- }
- if (!flag && !this.modelState.onground)
- {
- return false;
- }
- if (flag && !flag2)
- {
- return false;
- }
- return true;
- }
- public override bool CanBeLooted(BasePlayer player)
- {
- if (player == this)
- {
- return false;
- }
- return (this.IsWounded() || this.IsSleeping());
- }
- public bool CanBuild()
- {
- BuildingPrivlidge buildingPrivilege = this.GetBuildingPrivilege();
- return ((buildingPrivilege == null) || buildingPrivilege.IsAuthed(this));
- }
- public bool CanBuild(OBB obb)
- {
- BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(obb);
- return ((buildingPrivilege == null) || buildingPrivilege.IsAuthed(this));
- }
- public bool CanBuild(Vector3 position, Quaternion rotation, Bounds bounds)
- {
- BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(new OBB(position, rotation, bounds));
- return ((buildingPrivilege == null) || buildingPrivilege.IsAuthed(this));
- }
- public bool CanInteract()
- {
- return ((!this.IsDead() && !this.IsSleeping()) && !this.IsWounded());
- }
- public bool CanMove()
- {
- if (!this.HasLocalControls())
- {
- return false;
- }
- return true;
- }
- public bool CanPlaceBuildingPrivilege()
- {
- return (this.GetBuildingPrivilege() == null);
- }
- public bool CanPlaceBuildingPrivilege(OBB obb)
- {
- return (base.GetBuildingPrivilege(obb) == null);
- }
- public bool CanPlaceBuildingPrivilege(Vector3 position, Quaternion rotation, Bounds bounds)
- {
- return (base.GetBuildingPrivilege(new OBB(position, rotation, bounds)) == null);
- }
- public bool CanRotate()
- {
- if (!this.IsSpectating() && !this.HasLocalControls())
- {
- return false;
- }
- return true;
- }
- public override string Categorize()
- {
- return "player";
- }
- public void ChatMessage(string msg)
- {
- if (base.isClient)
- {
- object[] args = new object[] { 0, msg };
- ConsoleSystem.Run(ConsoleSystem.Option.Client, "chat.add", args);
- }
- }
- private bool CheckLookingAtVisible(HitTest test, TraceInfo trace)
- {
- RaycastHit hit;
- Vector3 origin = test.AttackRay.origin;
- Vector3 vector3 = trace.point - origin;
- float magnitude = vector3.magnitude;
- if (magnitude < Mathf.Epsilon)
- {
- return true;
- }
- Vector3 direction = (Vector3) (vector3 / magnitude);
- Ray ray = new Ray(origin, direction);
- if (!UnityEngine.Physics.Raycast(ray, out hit, magnitude + 0.01f, 0x48a12001))
- {
- return true;
- }
- BaseEntity other = hit.GetEntity();
- return ((other == trace.entity) || ((((other != null) && (trace.entity.GetParentEntity() != null)) && (trace.entity.GetParentEntity().EqualNetID(other) && (hit.collider != null))) && (hit.collider.gameObject.layer == 13)));
- }
- public void CL_ClothingChanged()
- {
- if (this.playerModel != null)
- {
- uint num = this.inventory.containerWear.ContentsHash();
- if (this.lastClothesHash != num)
- {
- this.needsClothesRebuild = true;
- }
- this.lastClothesHash = num;
- this.UpdateClothingItems(this.playerModel.multiMesh);
- if (this == LocalPlayer.Entity)
- {
- if ((BaseViewModel.ActiveModel != null) && this.needsClothesRebuild)
- {
- BaseViewModel.ActiveModel.OnClothingChanged();
- }
- if (this.inventory.containerWear.itemList.Count >= 3)
- {
- this.RecieveAchievement("EQUIP_CLOTHING");
- }
- }
- }
- }
- public static void ClearVisibility()
- {
- BasePlayer[] buffer = VisiblePlayerList.Buffer;
- int count = VisiblePlayerList.Count;
- for (int i = 0; i < count; i++)
- {
- buffer[i].UnregisterFromCulling();
- }
- visiblePlayerList.Clear();
- }
- [RPC_Client]
- public void CLIENT_ClearTeam(BaseEntity.RPCMessage msg)
- {
- this.clientTeam = null;
- TeamUI.dirty = true;
- SingletonComponent<MapInterface>.Instance.ClientTeamUpdated();
- }
- [RPC_Client]
- public void CLIENT_PendingInvite(BaseEntity.RPCMessage msg)
- {
- string str = msg.read.String();
- ulong num = msg.read.UInt64();
- if (((TeamUI.pendingTeamID == 0L) && (this.clientTeam == null)) && (num != 0L))
- {
- LocalPlayer.Entity.ChatMessage("You have been invited to " + str + "'s team");
- Vector3 normWorld = new Vector3();
- Effect.client.Run("assets/bundled/prefabs/fx/invite_notice.prefab", LocalPlayer.Entity.eyes.position, normWorld, new Vector3());
- }
- TeamUI.pendingTeamLeaderName = str;
- TeamUI.pendingTeamID = num;
- }
- [RPC_Client]
- public void CLIENT_ReceiveTeamInfo(BaseEntity.RPCMessage msg)
- {
- PlayerTeam team = PlayerTeam.Deserialize(msg.read);
- team.ShouldPool = false;
- this.clientTeam = team;
- TeamUI.dirty = true;
- SingletonComponent<MapInterface>.Instance.ClientTeamUpdated();
- }
- public static void ClientCycle(float deltaTime)
- {
- UpdatePlayerVisibilities();
- BasePlayer[] buffer = VisiblePlayerList.Buffer;
- int count = VisiblePlayerList.Count;
- for (int i = 0; i < count; i++)
- {
- BasePlayer player = buffer[i];
- if (player.IsSleeping() && player.IsAlive())
- {
- player.ClientUpdate_Sleeping();
- }
- else
- {
- player.ClientUpdate();
- }
- }
- if (LocalPlayer.Entity != null)
- {
- LocalPlayer.Entity.ClientUpdateLocalPlayer();
- }
- }
- protected override void ClientInit(ProtoBuf.Entity info)
- {
- this.voiceSpeaker = base.GetComponent<PlayerVoiceSpeaker>();
- this.inventory.ClientInit(this);
- base.ClientInit(info);
- if (!this.IsNpc)
- {
- SteamFriendsList.JustSeen(this.userID);
- }
- UnregisterFromVisibility(this.userID);
- RegisterForVisibility(this);
- bool flag = this.userID == ((Client.Steam != null) ? Client.Steam.SteamId : 0L);
- if (Client.IsPlayingDemo)
- {
- flag = false;
- }
- if (flag)
- {
- if ((LocalPlayer.Entity != null) && (LocalPlayer.Entity != this))
- {
- UnityEngine.Debug.LogError("Local player is being set up multiple times!!");
- }
- else
- {
- this.InitLocalPlayer();
- }
- }
- else
- {
- this.InitRemotePlayer();
- }
- }
- internal virtual void ClientInput(InputState state)
- {
- this.input.FrameUpdate();
- this.modelState.ducked = false;
- this.modelState.sprinting = false;
- this.modelState.aiming = false;
- this.modelState.sleeping = this.IsSleeping();
- this.modelState.waterLevel = this.WaterFactor();
- this.voiceRecorder.ClientInput(state);
- if (this.HasLocalControls() && !NeedsKeyboard.AnyActive())
- {
- this.Belt.ClientInput(state);
- }
- else
- {
- UIInventory.Close();
- MapInterface.SetOpen(false);
- }
- if (!this.Frozen)
- {
- this.HeldEntityInput();
- if (this.movement != null)
- {
- using (TimeWarning.New("movement.ClientInput", (float) 0.1f))
- {
- this.movement.ClientInput(state, this.modelState);
- }
- }
- using (TimeWarning.New("UseAction", (float) 0.1f))
- {
- this.UseAction(state);
- }
- if ((Buttons.Chat.JustPressed && this.input.hadInputBuffer) && (ConVar.Graphics.chat && Chat.enabled))
- {
- Chat.open();
- }
- using (TimeWarning.New("MapInterface Update", (float) 0.1f))
- {
- MapInterface.DoPlayerUpdate();
- MapInterface.SetOpen(Buttons.Map.IsDown);
- }
- }
- }
- private void ClientTick()
- {
- if (((Network.Net.cl != null) && Network.Net.cl.IsConnected()) && !LoadingScreen.isOpen)
- {
- this.SendClientTick();
- }
- }
- protected void ClientUpdate()
- {
- this.UpdateClothesIfNeeded();
- if (this.movement != null)
- {
- this.movement.gameObject.SetActive(this.IsAlive() && !this.IsSpectating());
- }
- if (this.isMounted)
- {
- this.GetMounted().UpdatePlayerPosition(this);
- }
- if (this.playerModel != null)
- {
- this.playerModel.UpdateLocalVelocity(base.GetLocalVelocity(), base.transform.parent);
- this.playerModel.ApplyVisibility(base.isVisible, base.isAnimatorVisible, base.isShadowVisible);
- if (!base.isVisible)
- {
- this.playerModel.position = base.transform.position;
- this.playerModel.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
- this.playerModel.visible = false;
- this.playerModel.UpdatePosition();
- this.playerModel.UpdateRotation();
- }
- else
- {
- bool flag = this.IsAlive() && !this.IsSpectating();
- if (this.playerModel.gameObject.activeSelf != flag)
- {
- if (!flag)
- {
- Effect.Strip(this.playerModel.gameObject);
- }
- this.playerModel.gameObject.SetActive(flag);
- }
- this.playerModel.position = base.transform.position;
- this.playerModel.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
- this.playerModel.visible = !this.IsDead();
- this.playerModel.isIncapacitated = this.IsWounded();
- HeldEntity heldEntity = this.GetHeldEntity();
- if (heldEntity != null)
- {
- heldEntity.UpdatePlayerModel(this.playerModel);
- }
- else
- {
- this.playerModel.SetHoldType(null);
- this.playerModel.SetAimSounds(null, null);
- }
- this.playerModel.LookAngles = Quaternion.LookRotation(this.eyes.BodyForward(), !this.isMounted ? Vector3.up : base.transform.up);
- this.playerModel.UpdateModelState(this.modelState);
- this.playerModel.FrameUpdate(this.IsWounded());
- if (this.isMounted)
- {
- BaseMountable mounted = this.GetMounted();
- mounted.UpdatePlayerRotation(this);
- mounted.UpdatePlayerModel(this);
- }
- }
- }
- if (this.voiceSpeaker != null)
- {
- this.voiceSpeaker.ClientFrame(this);
- if (this.playerModel != null)
- {
- this.playerModel.voiceVolume = this.voiceSpeaker.currentVolume;
- }
- }
- }
- protected void ClientUpdate_Sleeping()
- {
- if (((UnityEngine.Time.frameCount % 5) == (base.net.ID % 5)) || base.HasParent())
- {
- this.UpdateClothesIfNeeded();
- if (this.playerModel != null)
- {
- this.playerModel.ApplyVisibility(base.isVisible, base.isAnimatorVisible, base.isShadowVisible);
- if (!base.isVisible)
- {
- this.playerModel.position = base.transform.position;
- this.playerModel.rotation = base.transform.rotation;
- this.playerModel.visible = false;
- this.playerModel.UpdatePosition();
- this.playerModel.UpdateRotation();
- }
- else
- {
- this.playerModel.gameObject.SetActive(base.ragdoll == null);
- this.playerModel.position = base.transform.position;
- this.playerModel.rotation = base.transform.rotation;
- this.playerModel.visible = true;
- this.playerModel.isIncapacitated = false;
- this.modelState.lookDir = base.transform.forward;
- this.playerModel.UpdateModelState(this.modelState);
- this.playerModel.FrameUpdate(this.IsWounded());
- }
- }
- }
- }
- public void ClientUpdateLocalPlayer()
- {
- this.ClientInput(this.input.state);
- float num = 1f / ConVar.Client.tickrate;
- bool flag = this.input.state.current.buttons != this.input.state.previous.buttons;
- bool flag2 = (UnityEngine.Time.realtimeSinceStartup - this.lastSentTickTime) > num;
- if (flag || flag2)
- {
- this.ClientTick();
- }
- this.UpdateViewMode();
- BaseViewModel.HideViewmodel = this.currentViewMode != CameraMode.FirstPerson;
- LODComponent.UpdateDynamicOccludees();
- this.voiceRecorder.ClientFrame(this);
- if (this.IsSleeping())
- {
- this.BlockJump(0.5f);
- }
- if (!this.Frozen)
- {
- ContextMenuUI.FrameUpdate(this);
- ProgressBarUI.FrameUpdate(this);
- if (this.movement != null)
- {
- this.movement.FrameUpdate(this, this.modelState);
- }
- this.HeldEntityViewAngles();
- this.MountableOverrideViewAngles();
- this.input.ApplyViewAngles();
- this.eyes.FrameUpdate(MainCamera.mainCamera);
- this.modelState.lookDir = this.eyes.HeadForward();
- this.Belt.FrameUpdate();
- if (this.playerModel != null)
- {
- this.playerModel.UpdateLocalVelocity(base.GetLocalVelocity(), base.transform.parent);
- this.playerModel.position = base.transform.position;
- this.playerModel.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
- this.playerModel.UpdatePosition();
- }
- if (!this.UpdateLookingAt(0f, false))
- {
- this.UpdateLookingAt(Mathf.Clamp(ConVar.Client.lookatradius, 0f, 0.4f), true);
- }
- this.HeldEntityFrame();
- if (this.CanRotate())
- {
- if (this.isMounted)
- {
- base.transform.localRotation = this.GetMounted().GetMountedRotation();
- }
- else
- {
- base.transform.rotation = Quaternion.Euler(new Vector3(0f, this.eyes.rotation.eulerAngles.y, 0f));
- }
- }
- if (this.IsAdmin || this.IsDeveloper)
- {
- if (UnityEngine.Input.GetKeyDown(KeyCode.F3))
- {
- this.selectedViewMode += 1;
- if (this.selectedViewMode > CameraMode.Eyes)
- {
- this.selectedViewMode = CameraMode.FirstPerson;
- }
- }
- }
- else
- {
- this.selectedViewMode = CameraMode.FirstPerson;
- }
- if (this.HasPlayerFlag(PlayerFlags.ThirdPersonViewmode))
- {
- this.selectedViewMode = CameraMode.ThirdPerson;
- }
- if (this.HasPlayerFlag(PlayerFlags.EyesViewmode))
- {
- this.selectedViewMode = CameraMode.Eyes;
- }
- this.UpdateTopologyStats();
- }
- }
- public void ClientUpdateMounted(uint id)
- {
- if (this.mounted.uid != id)
- {
- BaseMountable mounted = this.GetMounted();
- this.mounted.uid = id;
- BaseMountable mountable2 = this.GetMounted();
- if (mounted != null)
- {
- mounted.PlayerDismounted(this);
- }
- if (mountable2 != null)
- {
- mountable2.PlayerMounted(this);
- }
- }
- }
- public void ClientUpdatePersistantData(PersistantPlayer data)
- {
- this.blueprints.ClientUpdate(data);
- }
- [ShowIf("Climb_ShowIf"), Menu("climb", "Climb"), Description("climb_desc", "Climb"), Icon("upgrade")]
- public void Climb(BasePlayer player)
- {
- if (player.isMounted)
- {
- bool flag = false;
- RaycastHit hit = new RaycastHit();
- foreach (RaycastHit hit2 in UnityEngine.Physics.SphereCastAll(this.eyes.BodyRay(), 0.5f, 3f, 0x40000, QueryTriggerInteraction.Collide))
- {
- if ((hit2.collider.GetComponent<TriggerLadder>() != null) && !UnityEngine.Physics.Raycast(this.eyes.BodyRay(), hit2.distance, 0x48a12001))
- {
- flag = true;
- hit = hit2;
- break;
- }
- }
- if (flag)
- {
- bool flag2 = false;
- BaseEntity entity = hit.GetEntity();
- Vector3 position = hit.collider.transform.position;
- position.y = hit.point.y;
- LadderMinMountHeight componentInChildren = hit.collider.gameObject.GetComponentInChildren<LadderMinMountHeight>();
- if ((componentInChildren != null) && (position.y < componentInChildren.transform.position.y))
- {
- position.y = componentInChildren.transform.position.y;
- }
- position += (Vector3) (hit.collider.transform.forward * (player.GetRadius() + 0.1f));
- if (entity != null)
- {
- flag2 = true;
- position = entity.transform.InverseTransformPoint(position);
- }
- base.ServerRPC<bool, Vector3, uint>("RPC_StartClimb", flag2, position, entity.net.ID);
- }
- }
- }
- public bool Climb_ShowIf(BasePlayer player)
- {
- if (player.isMounted)
- {
- foreach (RaycastHit hit in UnityEngine.Physics.RaycastAll(this.eyes.BodyRay(), 3f, 0x40000, QueryTriggerInteraction.Collide))
- {
- if ((hit.collider.GetComponent<TriggerLadder>() != null) && !UnityEngine.Physics.Raycast(this.eyes.BodyRay(), hit.distance, 0x48a12001))
- {
- return true;
- }
- }
- }
- return false;
- }
- public void ConsoleMessage(string msg)
- {
- if (base.isClient)
- {
- ConsoleSystem.Run(ConsoleSystem.Option.Client, "echo " + msg, Array.Empty<object>());
- }
- }
- [RPC_Client]
- public void CraftMode(BaseEntity.RPCMessage msg)
- {
- if ((LocalPlayer.Entity != null) && (this == LocalPlayer.Entity))
- {
- int num = msg.read.Int32();
- if (craftMode != num)
- {
- craftMode = num;
- LocalPlayer.OnInventoryChanged();
- UIBlueprints.Refresh();
- }
- }
- }
- private void CreatePlayerCollision()
- {
- GameObject obj2 = base.gameManager.CreatePrefab("assets/prefabs/player/player_collision.prefab", base.transform.position, Quaternion.identity, false);
- BaseEntityChild.Setup(obj2, this);
- obj2.AwakeFromInstantiate();
- this.collision = obj2.GetComponent<BaseCollision>();
- this.collision.Owner = this;
- this.collision.model = base.model;
- this.collision.transform.parent = this.playerModel.transform;
- }
- private void CreatePlayerModel()
- {
- if (this.playerModel != null)
- {
- UnityEngine.Debug.LogWarning("playerModel isn't null - but we're creating a new one!");
- }
- GameObject obj2 = base.gameManager.CreatePrefab("assets/prefabs/player/player_model.prefab", base.transform.position, Quaternion.identity, false);
- BaseEntityChild.Setup(obj2, this);
- obj2.AwakeFromInstantiate();
- base.SetModel(obj2.GetComponent<Model>());
- this.playerModel = obj2.GetComponent<PlayerModel>();
- this.playerModel.skinType = (GetRandomFloatBasedOnUserID(this.userID, 0x10ecL) <= 0.5f) ? 0 : 1;
- this.playerModel.skinColor = GetRandomFloatBasedOnUserID(this.userID, 0x1759L);
- this.playerModel.skinNumber = GetRandomFloatBasedOnUserID(this.userID, 0xf87L);
- this.playerModel.meshNumber = GetRandomFloatBasedOnUserID(this.userID, 0xa57L);
- this.playerModel.hairNumber = GetRandomFloatBasedOnUserID(this.userID, 0x18c2L);
- this.playerModel.showSash = this.HasPlayerFlag(PlayerFlags.DisplaySash);
- this.playerModel.isLocalPlayer = this.IsLocalPlayer();
- this.playerModel.drawShadowOnly = !this.shouldDrawBody;
- this.playerModel.UpdateModelState(this.modelState);
- this.playerModel.AlwaysAnimate(this.IsLocalPlayer());
- this.playerModel.UpdateSkeleton((int) this.userID);
- this.playerModel.IsNpc = this.IsNpc;
- this.CL_ClothingChanged();
- }
- private void CreatePlayerMovement()
- {
- if (!Client.IsPlayingDemo)
- {
- GameObject obj2 = base.gameManager.CreatePrefab("assets/prefabs/player/player_movement.prefab", base.transform.position, Quaternion.identity, true);
- UnityEngine.Assertions.Assert.IsTrue(this.movement == null, "movement setup! InitLocalPlayer called multiple times!");
- this.movement = obj2.GetComponent<BaseMovement>();
- this.movement.SetParent(base.transform.parent);
- this.movement.Init(this);
- }
- }
- public override void DestroyShared()
- {
- UnityEngine.Object.Destroy(this.cachedProtection);
- UnityEngine.Object.Destroy(base.baseProtection);
- base.DestroyShared();
- }
- [RPC_Client]
- private void DirectionalDamage(Vector3 position, int damageType)
- {
- if (SingletonComponent<UIUnderlay>.Instance != null)
- {
- SingletonComponent<UIUnderlay>.Instance.DirectionalDamage(position);
- }
- }
- public override bool DisplayHealthInfo(BasePlayer player)
- {
- return false;
- }
- protected override void DoClientDestroy()
- {
- UnregisterFromVisibility(this.userID);
- if (this.inventory != null)
- {
- this.inventory.DoDestroy();
- }
- base.DoClientDestroy();
- if (this.movement != null)
- {
- GameObject gameObject = this.movement.gameObject;
- this.movement = null;
- gameObject.BroadcastOnParentDestroying();
- GameManager.Destroy(gameObject, 0f);
- }
- if (this.collision != null)
- {
- GameObject go = this.collision.gameObject;
- this.collision = null;
- go.BroadcastOnParentDestroying();
- GameManager.client.Retire(go);
- }
- if (this.playerModel != null)
- {
- GameObject obj4 = this.playerModel.gameObject;
- this.playerModel = null;
- base.SetModel(null);
- obj4.BroadcastOnParentDestroying();
- GameManager.client.Retire(obj4);
- }
- }
- public void DoMovement()
- {
- if ((this.IsLocalPlayer() && this.HasLocalControls()) && ((this.movement != null) && !this.Frozen))
- {
- this.movement.DoFixedUpdate(this.modelState);
- }
- }
- [Description("drink_desc", "Drink water"), Menu("drink", "Drink"), Icon("cup_water"), ShowIf("Drink_ShowIf")]
- public void Drink(BasePlayer player)
- {
- if (player.metabolism.CanConsume())
- {
- Vector3 waterDrinkingPoint = player.GetWaterDrinkingPoint();
- if ((waterDrinkingPoint != Vector3.zero) && WaterResource.IsFreshWater(waterDrinkingPoint))
- {
- player.metabolism.MarkConsumption();
- base.ServerRPC<Vector3>("SV_Drink", waterDrinkingPoint);
- }
- }
- }
- public bool Drink_ShowIf(BasePlayer player)
- {
- if (this.movement == null)
- {
- return false;
- }
- if (this.movement.CurrentMoveSpeed() > 0.1f)
- {
- return false;
- }
- Vector3 waterDrinkingPoint = player.GetWaterDrinkingPoint();
- if (waterDrinkingPoint == Vector3.zero)
- {
- return false;
- }
- if (!WaterResource.IsFreshWater(waterDrinkingPoint))
- {
- return false;
- }
- WaterLevel.WaterInfo waterInfo = WaterLevel.GetWaterInfo(waterDrinkingPoint);
- if (!waterInfo.isValid)
- {
- return false;
- }
- if (waterInfo.overallDepth < 0.01f)
- {
- return false;
- }
- return true;
- }
- public void EnsureUpdated()
- {
- if ((UnityEngine.Time.realtimeSinceStartup - this.lastUpdateTime) >= 30f)
- {
- this.lastUpdateTime = UnityEngine.Time.realtimeSinceStartup;
- this.cachedThreatLevel = 0f;
- if (!this.IsSleeping())
- {
- if (this.inventory.containerWear.itemList.Count > 2)
- {
- this.cachedThreatLevel++;
- }
- foreach (Item item in this.inventory.containerBelt.itemList)
- {
- BaseEntity heldEntity = item.GetHeldEntity();
- if (((heldEntity != null) && (heldEntity is BaseProjectile)) && !(heldEntity is BowWeapon))
- {
- this.cachedThreatLevel += 2f;
- break;
- }
- }
- }
- }
- }
- public static BasePlayer Find_Clientside(string strNameOrIDOrIP)
- {
- BasePlayer[] buffer = VisiblePlayerList.Buffer;
- int count = VisiblePlayerList.Count;
- for (int i = 0; i < count; i++)
- {
- BasePlayer player = buffer[i];
- if (player.UserIDString == strNameOrIDOrIP)
- {
- return player;
- }
- }
- for (int j = 0; j < count; j++)
- {
- BasePlayer player2 = buffer[j];
- if (player2.displayName.StartsWith(strNameOrIDOrIP, StringComparison.CurrentCultureIgnoreCase))
- {
- return player2;
- }
- }
- for (int k = 0; k < count; k++)
- {
- BasePlayer player3 = buffer[k];
- if (((player3.net != null) && (player3.net.connection != null)) && (player3.net.connection.ipaddress == strNameOrIDOrIP))
- {
- return player3;
- }
- }
- return null;
- }
- public override Transform FindBone(string strName)
- {
- if ((this.playerModel != null) && (strName != string.Empty))
- {
- Transform transform = this.playerModel.FindBone(strName);
- if (transform != null)
- {
- return transform;
- }
- }
- return base.FindBone(strName);
- }
- public static BasePlayer FindByID_Clientside(ulong userID)
- {
- BasePlayer player;
- visiblePlayerList.TryGetValue(userID, out player);
- return player;
- }
- [DebuggerHidden]
- private IEnumerator FinishedLoadingRoutine()
- {
- return new <FinishedLoadingRoutine>c__Iterator0 { $this = this };
- }
- [RPC_Client]
- private void FinishLoading()
- {
- base.StartCoroutine(this.FinishedLoadingRoutine());
- }
- [RPC_Client]
- private void ForcePositionTo(Vector3 position)
- {
- this.SetNetworkPosition((base.transform.parent == null) ? position : base.transform.parent.InverseTransformPoint(position));
- if (this.movement != null)
- {
- this.movement.TeleportTo(position, this);
- }
- }
- [RPC_Client]
- private void ForcePositionToParentOffset(Vector3 position, uint entID)
- {
- if (entID != 0)
- {
- BaseNetworkable networkable = BaseNetworkable.clientEntities.Find(entID);
- if (networkable != null)
- {
- this.ForcePositionTo(networkable.transform.TransformPoint(position));
- }
- }
- else
- {
- this.ForcePositionTo(position);
- }
- }
- public void ForceUpdateTriggers(bool enter = true, bool exit = true, bool invoke = true)
- {
- List<TriggerBase> list = Facepunch.Pool.GetList<TriggerBase>();
- List<TriggerBase> list2 = Facepunch.Pool.GetList<TriggerBase>();
- if (base.triggers != null)
- {
- list.AddRange(base.triggers);
- }
- CapsuleCollider component = base.GetComponent<CapsuleCollider>();
- Vector3 vector = base.transform.position + new Vector3(0f, this.GetRadius(), 0f);
- Vector3 vector2 = base.transform.position + new Vector3(0f, this.GetHeight() - this.GetRadius(), 0f);
- GamePhysics.OverlapCapsule<TriggerBase>(vector, vector2, this.GetRadius(), list2, 0x40000, QueryTriggerInteraction.Collide);
- if (exit)
- {
- foreach (TriggerBase base2 in list)
- {
- if (!list2.Contains(base2))
- {
- base2.OnTriggerExit(component);
- }
- }
- }
- if (enter)
- {
- foreach (TriggerBase base3 in list2)
- {
- if (!list.Contains(base3))
- {
- base3.OnTriggerEnter(component);
- }
- }
- }
- Facepunch.Pool.FreeList<TriggerBase>(ref list);
- Facepunch.Pool.FreeList<TriggerBase>(ref list2);
- if (invoke)
- {
- base.Invoke(new Action(this.ForceUpdateTriggersAction), UnityEngine.Time.fixedDeltaTime * 1.5f);
- }
- }
- private void ForceUpdateTriggersAction()
- {
- if (!base.IsDestroyed)
- {
- this.ForceUpdateTriggers(false, true, false);
- }
- }
- public Bounds GetBounds()
- {
- return this.GetBounds(this.modelState.ducked);
- }
- public Bounds GetBounds(bool ducked)
- {
- return new Bounds(base.transform.position + this.GetOffset(ducked), this.GetSize(ducked));
- }
- public override BuildingPrivlidge GetBuildingPrivilege()
- {
- if (!base.isClient)
- {
- return base.GetBuildingPrivilege();
- }
- if ((UnityEngine.Time.time - this.cachedBuildingPrivilegeTime) > 1f)
- {
- this.cachedBuildingPrivilegeTime = UnityEngine.Time.time;
- this.cachedBuildingPrivilege = base.GetBuildingPrivilege(base.WorldSpaceBounds());
- }
- return this.cachedBuildingPrivilege;
- }
- public Vector3 GetCenter()
- {
- return this.GetCenter(this.modelState.ducked);
- }
- public Vector3 GetCenter(bool ducked)
- {
- return (base.transform.position + this.GetOffset(ducked));
- }
- public string GetDebugStatus()
- {
- StringBuilder builder = new StringBuilder();
- builder.AppendFormat("Entity: {0}\n", this.ToString());
- builder.AppendFormat("Name: {0}\n", this.displayName);
- builder.AppendFormat("SteamID: {0}\n", this.userID);
- IEnumerator enumerator = System.Enum.GetValues(typeof(PlayerFlags)).GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- PlayerFlags current = (PlayerFlags) enumerator.Current;
- builder.AppendFormat("{1}: {0}\n", this.HasPlayerFlag(current), current);
- }
- }
- finally
- {
- IDisposable disposable = enumerator as IDisposable;
- if (disposable != null)
- {
- disposable.Dispose();
- }
- }
- return builder.ToString();
- }
- public override float GetExtrapolationTime()
- {
- return Mathf.Clamp(Lerp.extrapolation, 0f, 0.1f);
- }
- public float GetHeight()
- {
- return this.GetHeight(this.modelState.ducked);
- }
- public float GetHeight(bool ducked)
- {
- if (ducked)
- {
- return 1.1f;
- }
- return 1.8f;
- }
- public HeldEntity GetHeldEntity()
- {
- if (!base.isClient)
- {
- return null;
- }
- if (this.IsLocalPlayer())
- {
- Item heldItem = this.GetHeldItem();
- if (heldItem == null)
- {
- return null;
- }
- HeldEntity heldEntity = heldItem.GetHeldEntity() as HeldEntity;
- if (heldEntity == null)
- {
- return null;
- }
- if (heldEntity.GetOwnerPlayer() != this)
- {
- return null;
- }
- return heldEntity;
- }
- if (this.clActiveItem == 0)
- {
- return null;
- }
- Item item2 = this.inventory.containerBelt.FindItemByUID(this.clActiveItem);
- if (item2 == null)
- {
- return null;
- }
- return (item2.GetHeldEntity() as HeldEntity);
- }
- private Item GetHeldItem()
- {
- return this.Belt.GetActiveItem();
- }
- public uint GetHeldItemID()
- {
- if (this.IsLocalPlayer())
- {
- Item heldItem = this.GetHeldItem();
- return ((heldItem == null) ? 0 : heldItem.uid);
- }
- return this.clActiveItem;
- }
- internal BaseEntity GetInteractionEntity()
- {
- BaseEntity lookingAtEntity = null;
- if (!this.IsSpectating() && !this.IsDead())
- {
- lookingAtEntity = this.lookingAtEntity;
- if ((this.lookingAtCollider != null) && this.lookingAtCollider.gameObject.CompareTag("Not Player Usable"))
- {
- lookingAtEntity = null;
- }
- }
- if ((lookingAtEntity != null) && !GameMenu.Util.GetInfo(lookingAtEntity.gameObject, this).IsValid)
- {
- lookingAtEntity = null;
- }
- if (lookingAtEntity == null)
- {
- lookingAtEntity = this;
- if ((lookingAtEntity != null) && !GameMenu.Util.GetInfo(lookingAtEntity.gameObject, this).IsValid)
- {
- lookingAtEntity = null;
- }
- }
- return lookingAtEntity;
- }
- public override Item GetItem(uint itemId)
- {
- if (this.inventory == null)
- {
- return null;
- }
- return this.inventory.FindItemUID(itemId);
- }
- public float GetJumpHeight()
- {
- return 1.5f;
- }
- public override Vector3 GetLocalVelocityClient()
- {
- if (this.movement == null)
- {
- return base.GetLocalVelocityClient();
- }
- if (base.transform.parent != null)
- {
- return base.transform.parent.InverseTransformDirection(this.movement.CurrentVelocity());
- }
- return this.movement.CurrentVelocity();
- }
- public float GetMaxSpeed()
- {
- return this.GetSpeed(1f, 0f);
- }
- public override void GetMenuOptions(List<GameMenu.Option> list)
- {
- using (TimeWarning.New("BasePlayer.GetMenuOptions", (float) 0.1f))
- {
- using (TimeWarning.New("Climb", (float) 0.1f))
- {
- if (this.Climb_ShowIf(LocalPlayer.Entity))
- {
- this.__menuOption_Climb.show = true;
- this.__menuOption_Climb.showDisabled = false;
- this.__menuOption_Climb.longUseOnly = false;
- this.__menuOption_Climb.order = 0;
- this.__menuOption_Climb.icon = "upgrade";
- this.__menuOption_Climb.desc = "climb_desc";
- this.__menuOption_Climb.title = "climb";
- if (this.__menuOption_Climb.function == null)
- {
- this.__menuOption_Climb.function = new Action<BasePlayer>(this.Climb);
- }
- list.Add(this.__menuOption_Climb);
- }
- }
- using (TimeWarning.New("Drink", (float) 0.1f))
- {
- if (this.Drink_ShowIf(LocalPlayer.Entity))
- {
- this.__menuOption_Drink.show = true;
- this.__menuOption_Drink.showDisabled = false;
- this.__menuOption_Drink.longUseOnly = false;
- this.__menuOption_Drink.order = 0;
- this.__menuOption_Drink.icon = "cup_water";
- this.__menuOption_Drink.desc = "drink_desc";
- this.__menuOption_Drink.title = "drink";
- if (this.__menuOption_Drink.function == null)
- {
- this.__menuOption_Drink.function = new Action<BasePlayer>(this.Drink);
- }
- list.Add(this.__menuOption_Drink);
- }
- }
- using (TimeWarning.New("InviteToTeam", (float) 0.1f))
- {
- if (this.Invite_ShowIf(LocalPlayer.Entity))
- {
- this.__menuOption_InviteToTeam.show = true;
- this.__menuOption_InviteToTeam.showDisabled = false;
- this.__menuOption_InviteToTeam.longUseOnly = false;
- this.__menuOption_InviteToTeam.order = 100;
- this.__menuOption_InviteToTeam.icon = "add";
- this.__menuOption_InviteToTeam.desc = "invite_team_sesc";
- this.__menuOption_InviteToTeam.title = "inviteToTeam";
- if (this.__menuOption_InviteToTeam.function == null)
- {
- this.__menuOption_InviteToTeam.function = new Action<BasePlayer>(this.InviteToTeam);
- }
- list.Add(this.__menuOption_InviteToTeam);
- }
- }
- using (TimeWarning.New("Menu_AssistPlayer", (float) 0.1f))
- {
- if (this.Menu_AssistPlayer_ShowIf(LocalPlayer.Entity))
- {
- this.__menuOption_Menu_AssistPlayer.show = true;
- this.__menuOption_Menu_AssistPlayer.showDisabled = false;
- this.__menuOption_Menu_AssistPlayer.longUseOnly = false;
- this.__menuOption_Menu_AssistPlayer.order = 10;
- this.__menuOption_Menu_AssistPlayer.time = 6f;
- this.__menuOption_Menu_AssistPlayer.icon = "player_assist";
- this.__menuOption_Menu_AssistPlayer.desc = "help_player_desc";
- this.__menuOption_Menu_AssistPlayer.title = "help_player";
- if (this.__menuOption_Menu_AssistPlayer.function == null)
- {
- this.__menuOption_Menu_AssistPlayer.function = new Action<BasePlayer>(this.Menu_AssistPlayer);
- }
- if (this.__menuOption_Menu_AssistPlayer.timeStart == null)
- {
- this.__menuOption_Menu_AssistPlayer.timeStart = new Action(this.Menu_AssistPlayer_TimeStart);
- }
- list.Add(this.__menuOption_Menu_AssistPlayer);
- }
- }
- using (TimeWarning.New("Menu_LootPlayer", (float) 0.1f))
- {
- if (this.Menu_LootPlayer_ShowIf(LocalPlayer.Entity))
- {
- this.__menuOption_Menu_LootPlayer.show = true;
- this.__menuOption_Menu_LootPlayer.showDisabled = false;
- this.__menuOption_Menu_LootPlayer.longUseOnly = false;
- this.__menuOption_Menu_LootPlayer.order = 0;
- this.__menuOption_Menu_LootPlayer.icon = "player_loot";
- this.__menuOption_Menu_LootPlayer.desc = "help_player_desc";
- this.__menuOption_Menu_LootPlayer.title = "loot";
- if (this.__menuOption_Menu_LootPlayer.function == null)
- {
- this.__menuOption_Menu_LootPlayer.function = new Action<BasePlayer>(this.Menu_LootPlayer);
- }
- list.Add(this.__menuOption_Menu_LootPlayer);
- }
- }
- using (TimeWarning.New("Promote", (float) 0.1f))
- {
- if (this.Promote_ShowIf(LocalPlayer.Entity))
- {
- this.__menuOption_Promote.show = true;
- this.__menuOption_Promote.showDisabled = false;
- this.__menuOption_Promote.longUseOnly = false;
- this.__menuOption_Promote.order = 120;
- this.__menuOption_Promote.time = 3f;
- this.__menuOption_Promote.icon = "upgrade";
- this.__menuOption_Promote.desc = "promote_desc";
- this.__menuOption_Promote.title = "promote";
- if (this.__menuOption_Promote.function == null)
- {
- this.__menuOption_Promote.function = new Action<BasePlayer>(this.Promote);
- }
- if (this.__menuOption_Promote.timeStart == null)
- {
- this.__menuOption_Promote.timeStart = new Action(this.Menu_Promote_Start);
- }
- list.Add(this.__menuOption_Promote);
- }
- }
- using (TimeWarning.New("SaltWater", (float) 0.1f))
- {
- if (this.SaltWater_ShowIf(LocalPlayer.Entity))
- {
- this.__menuOption_SaltWater.show = true;
- this.__menuOption_SaltWater.showDisabled = false;
- this.__menuOption_SaltWater.longUseOnly = false;
- this.__menuOption_SaltWater.order = 0;
- this.__menuOption_SaltWater.icon = "close";
- this.__menuOption_SaltWater.desc = "saltwater_desc";
- this.__menuOption_SaltWater.title = "saltwater";
- if (this.__menuOption_SaltWater.function == null)
- {
- this.__menuOption_SaltWater.function = new Action<BasePlayer>(this.SaltWater);
- }
- list.Add(this.__menuOption_SaltWater);
- }
- }
- }
- base.GetMenuOptions(list);
- }
- public float GetMinSpeed()
- {
- return this.GetSpeed(0f, 1f);
- }
- public BaseMountable GetMounted()
- {
- return (this.mounted.Get(base.isServer) as BaseMountable);
- }
- public override Quaternion GetNetworkRotation()
- {
- if (base.isClient)
- {
- return this.eyes.bodyRotation;
- }
- return Quaternion.identity;
- }
- public Vector3 GetOffset()
- {
- return this.GetOffset(this.modelState.ducked);
- }
- public Vector3 GetOffset(bool ducked)
- {
- if (ducked)
- {
- return new Vector3(0f, 0.55f, 0f);
- }
- return new Vector3(0f, 0.9f, 0f);
- }
- [RPC_Client]
- public void GetPerformanceReport(BaseEntity.RPCMessage msg)
- {
- base.ServerRPC<int, int, float, int>("PerformanceReport", (int) Performance.report.memoryAllocations, (int) Performance.report.memoryCollections, Performance.report.frameRateAverage, (int) UnityEngine.Time.realtimeSinceStartup);
- }
- public float GetRadius()
- {
- return 0.5f;
- }
- public static float GetRandomFloatBasedOnUserID(ulong steamid, ulong seed)
- {
- UnityEngine.Random.State state = UnityEngine.Random.state;
- UnityEngine.Random.InitState((int) (seed + steamid));
- float num = UnityEngine.Random.Range((float) 0f, (float) 1f);
- UnityEngine.Random.state = state;
- return num;
- }
- public Vector3 GetSize()
- {
- return this.GetSize(this.modelState.ducked);
- }
- public Vector3 GetSize(bool ducked)
- {
- if (ducked)
- {
- return new Vector3(1f, 1.1f, 1f);
- }
- return new Vector3(1f, 1.8f, 1f);
- }
- public float GetSpeed(float running, float ducking)
- {
- float num = 1f;
- num -= this.clothingMoveSpeedReduction;
- if (this.IsSwimming())
- {
- num += this.clothingWaterSpeedBonus;
- }
- return (Mathf.Lerp(Mathf.Lerp(2.8f, 5.5f, running), 1.7f, ducking) * num);
- }
- public string GetSubName(int maxlen = 0x20)
- {
- string displayName = this.displayName;
- if (displayName.Length > maxlen)
- {
- displayName = displayName.Substring(0, maxlen) + "..";
- }
- return displayName;
- }
- public override float GetThreatLevel()
- {
- this.EnsureUpdated();
- return this.cachedThreatLevel;
- }
- private Vector3 GetWaterDrinkingPoint()
- {
- using (TimeWarning.New("GetWaterDrinkingPoint", (float) 0.1f))
- {
- RaycastHit hit;
- if (!UnityEngine.Physics.Raycast(this.eyes.BodyRay(), out hit, 1.5f, 0x800010))
- {
- return Vector3.zero;
- }
- return (hit.point - new Vector3(0f, 0.5f, 0f));
- }
- }
- public bool HasLocalControls()
- {
- if (!this.IsLocalPlayer())
- {
- return false;
- }
- if (this.IsSpectating())
- {
- return false;
- }
- if (this.IsDead())
- {
- return false;
- }
- if (this.IsSleeping())
- {
- return false;
- }
- if (this.IsWounded())
- {
- return false;
- }
- return true;
- }
- public bool HasPlayerFlag(PlayerFlags f)
- {
- return ((this.playerFlags & f) == f);
- }
- public void HeldEntityEnd()
- {
- UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
- HeldEntity heldEntity = this.GetHeldEntity();
- if (heldEntity != null)
- {
- heldEntity.OnHolster();
- }
- }
- private void HeldEntityFrame()
- {
- UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
- using (TimeWarning.New("HeldEntityFrame", (float) 0.1f))
- {
- HeldEntity heldEntity = this.GetHeldEntity();
- if ((heldEntity != null) && (heldEntity.GetOwnerPlayer() == this))
- {
- heldEntity.OnFrame();
- }
- }
- }
- private void HeldEntityInput()
- {
- UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
- using (TimeWarning.New("HeldEntityInput", (float) 0.1f))
- {
- HeldEntity heldEntity = this.GetHeldEntity();
- if ((heldEntity != null) && (heldEntity.GetOwnerPlayer() == this))
- {
- heldEntity.OnInput();
- }
- }
- }
- public void HeldEntityStart()
- {
- UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
- HeldEntity heldEntity = this.GetHeldEntity();
- if (heldEntity != null)
- {
- heldEntity.OnDeploy();
- }
- }
- private void HeldEntityViewAngles()
- {
- UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
- HeldEntity heldEntity = this.GetHeldEntity();
- if ((heldEntity != null) && (heldEntity.GetOwnerPlayer() == this))
- {
- heldEntity.EditViewAngles();
- }
- }
- private bool HeldItemUse()
- {
- UnityEngine.Assertions.Assert.IsTrue(this.IsLocalPlayer(), "Not Local Player!");
- HeldEntity heldEntity = this.GetHeldEntity();
- if (heldEntity == null)
- {
- return false;
- }
- return ((heldEntity.GetOwnerPlayer() != this) && false);
- }
- public bool InFirstPersonMode()
- {
- return (this.currentViewMode == CameraMode.FirstPerson);
- }
- internal void InitLocalPlayer()
- {
- UnityEngine.Assertions.Assert.IsTrue(LocalPlayer.Entity != this, "LocalPlayer setup! InitLocalPlayer called multiple times!");
- base.gameObject.name = "LocalPlayer";
- LocalPlayer.Entity = this;
- this.blueprints.ClientInit();
- this.UpdatePlayerCollider(true);
- this.UpdatePlayerRigidbody(true);
- this.voiceRecorder = base.GetComponent<PlayerVoiceRecorder>();
- this.voiceRecorder.Init();
- this.CreatePlayerMovement();
- this.metabolism.ClientInit(this);
- LocalPlayer.OnInventoryChanged();
- SingletonComponent<SteamClient>.Instance.SendUpdatedInventory();
- this.CreatePlayerModel();
- }
- internal void InitRemotePlayer()
- {
- this.UpdatePlayerCollider(false);
- this.UpdatePlayerRigidbody(false);
- this.CreatePlayerModel();
- this.CreatePlayerCollision();
- }
- public override void InitShared()
- {
- this.Belt = new PlayerBelt(this);
- this.cachedProtection = ScriptableObject.CreateInstance<ProtectionProperties>();
- base.baseProtection = ScriptableObject.CreateInstance<ProtectionProperties>();
- this.inventory = base.GetComponent<PlayerInventory>();
- this.blueprints = base.GetComponent<PlayerBlueprints>();
- this.metabolism = base.GetComponent<PlayerMetabolism>();
- this.eyes = base.GetComponent<PlayerEyes>();
- this.input = base.GetComponent<PlayerInput>();
- base.InitShared();
- }
- public bool InSafeZone()
- {
- return this.HasPlayerFlag(PlayerFlags.SafeZone);
- }
- public bool Invite_ShowIf(BasePlayer player)
- {
- if (!RelationshipManager.TeamsEnabled())
- {
- return false;
- }
- if (this.currentTeam != 0L)
- {
- return false;
- }
- BasePlayer entity = LocalPlayer.Entity;
- if (entity == null)
- {
- return false;
- }
- if (this == LocalPlayer.Entity)
- {
- return false;
- }
- if ((this.IsWounded() || !this.IsAlive()) || this.IsSleeping())
- {
- return false;
- }
- if (this.IsNpc)
- {
- return false;
- }
- if (entity.currentTeam == 0L)
- {
- return false;
- }
- return ((LocalPlayer.Entity.clientTeam != null) && (LocalPlayer.Entity.clientTeam.teamLeader == LocalPlayer.Entity.userID));
- }
- [Menu("inviteToTeam", "Invite To Team", Order=100), Icon("add"), ShowIf("Invite_ShowIf"), Description("invite_team_sesc", "Invite this player to your team")]
- public void InviteToTeam(BasePlayer player)
- {
- BasePlayer component = LocalPlayer.Entity.lookingAtEntity.GetComponent<BasePlayer>();
- if ((component != null) && (component.currentTeam == 0L))
- {
- object[] args = new object[] { component.userID };
- ConsoleSystem.Run(ConsoleSystem.Option.Client, "sendinvite", args);
- }
- }
- private static bool IsAimingAt(BasePlayer aimer, BasePlayer target, float cone = 0.95f)
- {
- Vector3 vector2 = target.eyes.position - aimer.eyes.position;
- Vector3 normalized = vector2.normalized;
- return (((Vector3.Dot(aimer.eyes.HeadForward(), normalized) > cone) && aimer.VisPlayerArmed()) && target.VisPlayerArmed());
- }
- public bool IsBuildingAuthed()
- {
- BuildingPrivlidge buildingPrivilege = this.GetBuildingPrivilege();
- if (buildingPrivilege == null)
- {
- return false;
- }
- return buildingPrivilege.IsAuthed(this);
- }
- public bool IsBuildingAuthed(OBB obb)
- {
- BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(obb);
- if (buildingPrivilege == null)
- {
- return false;
- }
- return buildingPrivilege.IsAuthed(this);
- }
- public bool IsBuildingAuthed(Vector3 position, Quaternion rotation, Bounds bounds)
- {
- BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(new OBB(position, rotation, bounds));
- if (buildingPrivilege == null)
- {
- return false;
- }
- return buildingPrivilege.IsAuthed(this);
- }
- public bool IsBuildingBlocked()
- {
- BuildingPrivlidge buildingPrivilege = this.GetBuildingPrivilege();
- if (buildingPrivilege == null)
- {
- return false;
- }
- return !buildingPrivilege.IsAuthed(this);
- }
- public bool IsBuildingBlocked(OBB obb)
- {
- BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(obb);
- if (buildingPrivilege == null)
- {
- return false;
- }
- return !buildingPrivilege.IsAuthed(this);
- }
- public bool IsBuildingBlocked(Vector3 position, Quaternion rotation, Bounds bounds)
- {
- BuildingPrivlidge buildingPrivilege = base.GetBuildingPrivilege(new OBB(position, rotation, bounds));
- if (buildingPrivilege == null)
- {
- return false;
- }
- return !buildingPrivilege.IsAuthed(this);
- }
- public bool IsDucked()
- {
- if (this.movement != null)
- {
- return this.movement.IsDucked;
- }
- return ((this.modelState != null) && this.modelState.ducked);
- }
- public bool IsHeadUnderwater()
- {
- if (this.modelState != null)
- {
- return (this.modelState.waterLevel > 0.75f);
- }
- return (this.WaterFactor() > 0.75f);
- }
- public bool IsHoldingEntity<T>()
- {
- HeldEntity heldEntity = this.GetHeldEntity();
- if (heldEntity == null)
- {
- return false;
- }
- return (heldEntity is T);
- }
- public bool IsLocalPlayer()
- {
- return (this == LocalPlayer.Entity);
- }
- public bool IsOnGround()
- {
- if (this.movement != null)
- {
- return this.movement.IsGrounded;
- }
- return this.modelState.onground;
- }
- public bool IsRelaxed()
- {
- return this.HasPlayerFlag(PlayerFlags.Relaxed);
- }
- public bool IsRunning()
- {
- if (this.movement != null)
- {
- return this.movement.IsRunning;
- }
- return ((this.modelState != null) && this.modelState.sprinting);
- }
- public bool IsSleeping()
- {
- return this.HasPlayerFlag(PlayerFlags.Sleeping);
- }
- public bool IsSpectating()
- {
- return this.HasPlayerFlag(PlayerFlags.Spectating);
- }
- public bool IsSwimming()
- {
- if (this.modelState != null)
- {
- return (this.modelState.waterLevel >= 0.65f);
- }
- return (this.WaterFactor() >= 0.65f);
- }
- public bool IsWounded()
- {
- return this.HasPlayerFlag(PlayerFlags.Wounded);
- }
- public static void LateClientCycle()
- {
- BasePlayer[] buffer = VisiblePlayerList.Buffer;
- int count = VisiblePlayerList.Count;
- for (int i = 0; i < count; i++)
- {
- BasePlayer player = buffer[i];
- if (player.playerModel != null)
- {
- player.playerModel.LateCycle();
- }
- }
- if ((LocalPlayer.Entity != null) && (MainCamera.mainCamera != null))
- {
- if (!CameraMan.Active)
- {
- LocalPlayer.Entity.input.ApplyViewAngles();
- LocalPlayer.Entity.eyes.FrameUpdate(MainCamera.mainCamera);
- }
- foreach (BaseViewModel model in BaseViewModel.ActiveModels)
- {
- BaseViewModel.HideViewmodel = (LocalPlayer.Entity.currentViewMode != CameraMode.FirstPerson) || CameraMan.Active;
- model.OnCameraPositionChanged(MainCamera.mainCamera);
- }
- }
- }
- public override void Load(BaseNetworkable.LoadInfo info)
- {
- base.Load(info);
- if (info.msg.basePlayer != null)
- {
- ProtoBuf.BasePlayer basePlayer = info.msg.basePlayer;
- this.userID = basePlayer.userid;
- this.UserIDString = this.userID.ToString();
- if (basePlayer.name != null)
- {
- this._displayName = basePlayer.name;
- if (string.IsNullOrEmpty(this._displayName.Trim()))
- {
- this._displayName = "Blaster :D";
- }
- }
- this.playerFlags = (PlayerFlags) basePlayer.playerFlags;
- this.currentTeam = basePlayer.currentTeam;
- if (basePlayer.metabolism != null)
- {
- this.metabolism.Load(basePlayer.metabolism);
- }
- if (basePlayer.inventory != null)
- {
- this.inventory.Load(basePlayer.inventory);
- }
- if ((this.playerModel != null) && (this.playerModel.nameTag != null))
- {
- this.playerModel.nameTag.UpdateFrom(this);
- }
- if (basePlayer.modelState != null)
- {
- if (this.modelState != null)
- {
- this.modelState.ResetToPool();
- this.modelState = null;
- }
- this.modelState = basePlayer.modelState;
- basePlayer.modelState = null;
- this.OnModelStateChanged();
- }
- if (!info.fromDisk)
- {
- this.ClientUpdateMounted(basePlayer.mounted);
- }
- if (base.isClient && (info.msg.basePlayer.persistantData != null))
- {
- this.ClientUpdatePersistantData(info.msg.basePlayer.persistantData);
- }
- this.clActiveItem = basePlayer.heldEntity;
- }
- }
- public static bool LocalPlayerIsLeader()
- {
- return (((LocalPlayer.Entity != null) && (LocalPlayer.Entity.clientTeam != null)) && (LocalPlayer.Entity.clientTeam.teamLeader == LocalPlayer.Entity.userID));
- }
- private void LogDebugCull(float dist)
- {
- if (base.isVisible != this.debugPrevVisible)
- {
- UnityEngine.Debug.Log(string.Concat(new object[] { "VisChanged: ", this.displayName, ", Distance: ", dist, ", ", this.IsSleeping() }));
- this.debugPrevVisible = base.isVisible;
- }
- }
- internal void LongUse()
- {
- if (!this.IsWounded())
- {
- BaseEntity interactionEntity = this.GetInteractionEntity();
- if (interactionEntity != null)
- {
- interactionEntity.gameObject.SendMessage("OnUseHeld", this, SendMessageOptions.DontRequireReceiver);
- }
- }
- }
- public override void MakeVisible()
- {
- base.MakeVisible();
- if (this.playerModel != null)
- {
- this.playerModel.ApplyVisibility(base.isVisible, base.isAnimatorVisible, base.isShadowVisible);
- }
- }
- public void MarkSwapSeat()
- {
- this.nextSeatSwapTime = UnityEngine.Time.time + 0.75f;
- }
- public float MaxDeployDistance(Item item)
- {
- return 8f;
- }
- public override float MaxHealth()
- {
- return 100f;
- }
- public override float MaxVelocity()
- {
- if (this.IsSleeping())
- {
- return 0f;
- }
- if (this.isMounted)
- {
- return this.GetMounted().MaxVelocity();
- }
- return this.GetMaxSpeed();
- }
- [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")]
- public void Menu_AssistPlayer(BasePlayer player)
- {
- base.ServerRPC("RPC_Assist");
- }
- public bool Menu_AssistPlayer_ShowIf(BasePlayer player)
- {
- if (player == this)
- {
- return false;
- }
- if (!this.IsWounded())
- {
- return false;
- }
- if (player.lookingAtEntity == this)
- {
- this.lastRevivePoint = player.lookingAtPoint;
- this.lastReviveDirection = player.eyes.HeadForward();
- }
- else
- {
- if (Vector3.Angle(this.lastReviveDirection, player.eyes.HeadForward()) > 10f)
- {
- return false;
- }
- if (!GamePhysics.LineOfSight(this.lastRevivePoint, player.eyes.position, 0x210000, 0.1f))
- {
- return false;
- }
- }
- return true;
- }
- public void Menu_AssistPlayer_TimeStart()
- {
- base.ServerRPC("RPC_KeepAlive");
- }
- [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,")]
- public void Menu_LootPlayer(BasePlayer player)
- {
- base.ServerRPC("RPC_LootPlayer");
- UIInventory.OpenLoot("player_corpse");
- }
- public bool Menu_LootPlayer_ShowIf(BasePlayer player)
- {
- return this.CanBeLooted(player);
- }
- public void Menu_Promote_Start()
- {
- }
- public void ModifyCamera()
- {
- Item activeItem = this.Belt.GetActiveItem();
- if (activeItem != null)
- {
- HeldEntity heldEntity = activeItem.GetHeldEntity() as HeldEntity;
- if (heldEntity != null)
- {
- heldEntity.ModifyCamera();
- }
- }
- }
- protected virtual void ModifyInputState(ref InputState inputState)
- {
- }
- private void MountableOverrideViewAngles()
- {
- BaseMountable mounted = this.GetMounted();
- if (mounted != null)
- {
- mounted.OverrideViewAngles(this);
- }
- }
- public int NewProjectileID()
- {
- return ++this.maxProjectileID;
- }
- public int NewProjectileSeed()
- {
- return UnityEngine.Random.Range(0, 0x7fffffff);
- }
- public override void OnAttacked(HitInfo info)
- {
- float health = base.health;
- base.OnAttacked(info);
- if ((((info.Initiator == LocalPlayer.Entity) && info.isHeadshot) && (info.damageTypes.Has(DamageType.Bullet) || info.damageTypes.Has(DamageType.Arrow))) && ((UnityEngine.Time.realtimeSinceStartup - this.lastHeadshotSoundTime) > 0.01f))
- {
- Effect.client.Run("assets/bundled/prefabs/fx/headshot_2d.prefab", LocalPlayer.Entity.eyes.gameObject);
- this.lastHeadshotSoundTime = UnityEngine.Time.realtimeSinceStartup;
- }
- }
- public override void OnBecameRagdoll(Ragdoll rdoll)
- {
- base.OnBecameRagdoll(rdoll);
- base.lifestate = BaseCombatEntity.LifeState.Dead;
- base.deathTime = UnityEngine.Time.realtimeSinceStartup;
- }
- [RPC_Client]
- private void OnDied(BaseEntity.RPCMessage msg)
- {
- UIInventory.Close();
- MapInterface.SetOpen(false);
- LocalPlayer.LastDeathTime = UnityEngine.Time.realtimeSinceStartup;
- }
- public bool OnLadder()
- {
- return (this.modelState.onLadder && ((bool) base.FindTrigger<TriggerLadder>()));
- }
- public void OnLand(float fVelocity)
- {
- Vector3 posWorld = new Vector3();
- posWorld = new Vector3();
- Effect.client.Run("assets/bundled/prefabs/fx/screen_land.prefab", posWorld, posWorld, new Vector3());
- if (fVelocity < -8f)
- {
- base.ServerRPC<float>("OnPlayerLanded", fVelocity);
- }
- }
- [RPC_Client]
- private void OnModelState(BaseEntity.RPCMessage data)
- {
- ModelState.Deserialize(data.read, this.modelState, false);
- this.OnModelStateChanged();
- }
- private void OnModelStateChanged()
- {
- if (!this.IsLocalPlayer() && (this.playerModel != null))
- {
- this.playerModel.UpdateModelState(this.modelState);
- }
- }
- [RPC_Client]
- private void OnRespawnInformation(BaseEntity.RPCMessage msg)
- {
- UnityEngine.Debug.Log("Got Respawn Information");
- UIDeathScreen.OnRespawnInformation(RespawnInformation.Deserialize(msg.read));
- UIInventory.Close();
- MapInterface.SetOpen(false);
- }
- public override bool OnRpcMessage(BasePlayer player, uint rpc, Message msg)
- {
- using (TimeWarning.New("BasePlayer.OnRpcMessage", (float) 0.1f))
- {
- BaseEntity.RPCMessage message2;
- if ((rpc == 0xd2afd729) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: CLIENT_ClearTeam ");
- }
- TimeWarning warning2 = TimeWarning.New("CLIENT_ClearTeam", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message = message2;
- this.CLIENT_ClearTeam(message);
- }
- }
- catch (Exception exception)
- {
- Network.Net.cl.Disconnect("RPC Error in CLIENT_ClearTeam", true);
- UnityEngine.Debug.LogException(exception);
- }
- finally
- {
- if (warning2 != null)
- {
- ((IDisposable) warning2).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x2c658f72) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: CLIENT_PendingInvite ");
- }
- TimeWarning warning4 = TimeWarning.New("CLIENT_PendingInvite", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message3 = message2;
- this.CLIENT_PendingInvite(message3);
- }
- }
- catch (Exception exception2)
- {
- Network.Net.cl.Disconnect("RPC Error in CLIENT_PendingInvite", true);
- UnityEngine.Debug.LogException(exception2);
- }
- finally
- {
- if (warning4 != null)
- {
- ((IDisposable) warning4).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x3d632728) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: CLIENT_ReceiveTeamInfo ");
- }
- TimeWarning warning6 = TimeWarning.New("CLIENT_ReceiveTeamInfo", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message4 = message2;
- this.CLIENT_ReceiveTeamInfo(message4);
- }
- }
- catch (Exception exception3)
- {
- Network.Net.cl.Disconnect("RPC Error in CLIENT_ReceiveTeamInfo", true);
- UnityEngine.Debug.LogException(exception3);
- }
- finally
- {
- if (warning6 != null)
- {
- ((IDisposable) warning6).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x5eb32ae1) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: CraftMode ");
- }
- TimeWarning warning8 = TimeWarning.New("CraftMode", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message5 = message2;
- this.CraftMode(message5);
- }
- }
- catch (Exception exception4)
- {
- Network.Net.cl.Disconnect("RPC Error in CraftMode", true);
- UnityEngine.Debug.LogException(exception4);
- }
- finally
- {
- if (warning8 != null)
- {
- ((IDisposable) warning8).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x17b5c293) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: DirectionalDamage ");
- }
- TimeWarning warning10 = TimeWarning.New("DirectionalDamage", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- Vector3 position = msg.read.Vector3();
- int damageType = msg.read.Int32();
- this.DirectionalDamage(position, damageType);
- }
- }
- catch (Exception exception5)
- {
- Network.Net.cl.Disconnect("RPC Error in DirectionalDamage", true);
- UnityEngine.Debug.LogException(exception5);
- }
- finally
- {
- if (warning10 != null)
- {
- ((IDisposable) warning10).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0xa79b8625) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: FinishLoading ");
- }
- TimeWarning warning12 = TimeWarning.New("FinishLoading", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- this.FinishLoading();
- }
- }
- catch (Exception exception6)
- {
- Network.Net.cl.Disconnect("RPC Error in FinishLoading", true);
- UnityEngine.Debug.LogException(exception6);
- }
- finally
- {
- if (warning12 != null)
- {
- ((IDisposable) warning12).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0xc368fe36) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: ForcePositionTo ");
- }
- TimeWarning warning14 = TimeWarning.New("ForcePositionTo", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- Vector3 vector2 = msg.read.Vector3();
- this.ForcePositionTo(vector2);
- }
- }
- catch (Exception exception7)
- {
- Network.Net.cl.Disconnect("RPC Error in ForcePositionTo", true);
- UnityEngine.Debug.LogException(exception7);
- }
- finally
- {
- if (warning14 != null)
- {
- ((IDisposable) warning14).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x24c4af48) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: ForcePositionToParentOffset ");
- }
- TimeWarning warning16 = TimeWarning.New("ForcePositionToParentOffset", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- Vector3 vector3 = msg.read.Vector3();
- uint entID = msg.read.UInt32();
- this.ForcePositionToParentOffset(vector3, entID);
- }
- }
- catch (Exception exception8)
- {
- Network.Net.cl.Disconnect("RPC Error in ForcePositionToParentOffset", true);
- UnityEngine.Debug.LogException(exception8);
- }
- finally
- {
- if (warning16 != null)
- {
- ((IDisposable) warning16).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x44f4b758) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: GetPerformanceReport ");
- }
- TimeWarning warning18 = TimeWarning.New("GetPerformanceReport", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message6 = message2;
- this.GetPerformanceReport(message6);
- }
- }
- catch (Exception exception9)
- {
- Network.Net.cl.Disconnect("RPC Error in GetPerformanceReport", true);
- UnityEngine.Debug.LogException(exception9);
- }
- finally
- {
- if (warning18 != null)
- {
- ((IDisposable) warning18).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x65f58c58) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: OnDied ");
- }
- TimeWarning warning20 = TimeWarning.New("OnDied", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message7 = message2;
- this.OnDied(message7);
- }
- }
- catch (Exception exception10)
- {
- Network.Net.cl.Disconnect("RPC Error in OnDied", true);
- UnityEngine.Debug.LogException(exception10);
- }
- finally
- {
- if (warning20 != null)
- {
- ((IDisposable) warning20).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x6a0cb968) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: OnModelState ");
- }
- TimeWarning warning22 = TimeWarning.New("OnModelState", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage data = message2;
- this.OnModelState(data);
- }
- }
- catch (Exception exception11)
- {
- Network.Net.cl.Disconnect("RPC Error in OnModelState", true);
- UnityEngine.Debug.LogException(exception11);
- }
- finally
- {
- if (warning22 != null)
- {
- ((IDisposable) warning22).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x68eae6b2) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: OnRespawnInformation ");
- }
- TimeWarning warning24 = TimeWarning.New("OnRespawnInformation", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message9 = message2;
- this.OnRespawnInformation(message9);
- }
- }
- catch (Exception exception12)
- {
- Network.Net.cl.Disconnect("RPC Error in OnRespawnInformation", true);
- UnityEngine.Debug.LogException(exception12);
- }
- finally
- {
- if (warning24 != null)
- {
- ((IDisposable) warning24).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x96f15d26) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: RecieveAchievement ");
- }
- TimeWarning warning26 = TimeWarning.New("RecieveAchievement", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- string name = msg.read.String();
- this.RecieveAchievement(name);
- }
- }
- catch (Exception exception13)
- {
- Network.Net.cl.Disconnect("RPC Error in RecieveAchievement", true);
- UnityEngine.Debug.LogException(exception13);
- }
- finally
- {
- if (warning26 != null)
- {
- ((IDisposable) warning26).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0xca54937a) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: RPC_OpenLootPanel ");
- }
- TimeWarning warning28 = TimeWarning.New("RPC_OpenLootPanel", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message10 = message2;
- this.RPC_OpenLootPanel(message10);
- }
- }
- catch (Exception exception14)
- {
- Network.Net.cl.Disconnect("RPC Error in RPC_OpenLootPanel", true);
- UnityEngine.Debug.LogException(exception14);
- }
- finally
- {
- if (warning28 != null)
- {
- ((IDisposable) warning28).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0xaed1b915) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: SetHostileLength ");
- }
- TimeWarning warning30 = TimeWarning.New("SetHostileLength", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message11 = message2;
- this.SetHostileLength(message11);
- }
- }
- catch (Exception exception15)
- {
- Network.Net.cl.Disconnect("RPC Error in SetHostileLength", true);
- UnityEngine.Debug.LogException(exception15);
- }
- finally
- {
- if (warning30 != null)
- {
- ((IDisposable) warning30).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x3d5f9278) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: SetWeaponDrawnDuration ");
- }
- TimeWarning warning32 = TimeWarning.New("SetWeaponDrawnDuration", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message12 = message2;
- this.SetWeaponDrawnDuration(message12);
- }
- }
- catch (Exception exception16)
- {
- Network.Net.cl.Disconnect("RPC Error in SetWeaponDrawnDuration", true);
- UnityEngine.Debug.LogException(exception16);
- }
- finally
- {
- if (warning32 != null)
- {
- ((IDisposable) warning32).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0xa766b6fb) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: StartLoading ");
- }
- TimeWarning warning34 = TimeWarning.New("StartLoading", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- this.StartLoading();
- }
- }
- catch (Exception exception17)
- {
- Network.Net.cl.Disconnect("RPC Error in StartLoading", true);
- UnityEngine.Debug.LogException(exception17);
- }
- finally
- {
- if (warning34 != null)
- {
- ((IDisposable) warning34).Dispose();
- }
- }
- return true;
- }
- if ((rpc == 0x910a1210) && (player == null))
- {
- if (ConVar.Global.developer > 2)
- {
- UnityEngine.Debug.Log("CL_RPCMessage: UnlockedBlueprint ");
- }
- TimeWarning warning36 = TimeWarning.New("UnlockedBlueprint", (float) 0.1f);
- try
- {
- using (TimeWarning.New("Call", (float) 0.1f))
- {
- message2 = new BaseEntity.RPCMessage {
- connection = msg.connection,
- player = player,
- read = msg.read
- };
- BaseEntity.RPCMessage message13 = message2;
- this.UnlockedBlueprint(message13);
- }
- }
- catch (Exception exception18)
- {
- Network.Net.cl.Disconnect("RPC Error in UnlockedBlueprint", true);
- UnityEngine.Debug.LogException(exception18);
- }
- finally
- {
- if (warning36 != null)
- {
- ((IDisposable) warning36).Dispose();
- }
- }
- return true;
- }
- }
- return base.OnRpcMessage(player, rpc, msg);
- }
- public override void OnSignal(BaseEntity.Signal signal, string arg)
- {
- base.OnSignal(signal, arg);
- if (base.isVisible)
- {
- switch (signal)
- {
- case BaseEntity.Signal.Attack:
- if (this.playerModel != null)
- {
- this.playerModel.Attack();
- }
- break;
- case BaseEntity.Signal.Alt_Attack:
- if (this.playerModel != null)
- {
- this.playerModel.AltAttack();
- }
- break;
- case BaseEntity.Signal.Reload:
- if (this.playerModel != null)
- {
- this.playerModel.Reload();
- }
- break;
- case BaseEntity.Signal.Flinch_Head:
- if (this.playerModel != null)
- {
- this.playerModel.Flinch(0);
- }
- break;
- case BaseEntity.Signal.Flinch_Chest:
- if (this.playerModel != null)
- {
- this.playerModel.Flinch(1);
- }
- break;
- case BaseEntity.Signal.Flinch_Stomach:
- if (this.playerModel != null)
- {
- this.playerModel.Flinch(2);
- }
- break;
- case BaseEntity.Signal.Flinch_RearHead:
- if (this.playerModel != null)
- {
- this.playerModel.Flinch(3);
- }
- break;
- case BaseEntity.Signal.Flinch_RearTorso:
- if (this.playerModel != null)
- {
- this.playerModel.Flinch(4);
- }
- break;
- case BaseEntity.Signal.Throw:
- if (this.playerModel != null)
- {
- this.playerModel.Throw();
- }
- break;
- case BaseEntity.Signal.Gesture:
- if (this.playerModel != null)
- {
- this.playerModel.Gesture(arg);
- }
- break;
- }
- }
- }
- public virtual void OnViewModeChanged()
- {
- if (this.playerModel != null)
- {
- this.playerModel.drawShadowOnly = !this.shouldDrawBody;
- this.playerModel.Rebuild(true);
- this.UpdateClothingItems(this.playerModel.multiMesh);
- }
- GlobalMessages.OnViewModeChanged();
- }
- protected override void OnVisibilityChanged(bool visible)
- {
- if (((LocalPlayer.Entity != null) && (MainCamera.mainCamera != null)) && !this.IsLocalPlayer())
- {
- float dist = Vector3.Distance(MainCamera.mainCamera.transform.position, base.transform.position);
- this.VisUpdateUsingCulling(dist, visible);
- }
- }
- public override void OnVoiceData(byte[] data)
- {
- this.voiceSpeaker.Receive(data);
- }
- public override float PenetrationResistance(HitInfo info)
- {
- return 100f;
- }
- private void PlayOpenSound()
- {
- StorageContainer clientEntity = LocalPlayer.Entity.inventory.loot.GetClientEntity() as StorageContainer;
- if ((clientEntity != null) && (clientEntity.openSound != null))
- {
- SoundManager.PlayOneshot(clientEntity.openSound, clientEntity.gameObject, false, new Vector3());
- }
- }
- private bool PointSeePoint(Vector3 target, Vector3 origin, float dist = 0f, bool useGameTrace = false)
- {
- RaycastHit hit;
- bool flag = false;
- if (dist == 0f)
- {
- dist = Vector3.Distance(target, origin);
- }
- Vector3 vector2 = target - origin;
- Vector3 normalized = vector2.normalized;
- Ray ray = new Ray(origin, normalized);
- if (!useGameTrace ? UnityEngine.Physics.Raycast(ray, out hit, dist, 0xa10001) : GamePhysics.Trace(ray, 0f, out hit, dist, 0xa10001, QueryTriggerInteraction.UseGlobal))
- {
- ColliderInfo component = hit.collider.GetComponent<ColliderInfo>();
- if ((component == null) || component.HasFlag(ColliderInfo.Flags.Opaque))
- {
- flag = true;
- }
- }
- return !flag;
- }
- public override void PostNetworkUpdate()
- {
- base.PostNetworkUpdate();
- if (base.isClient)
- {
- if (this.playerModel != null)
- {
- bool showSash = this.playerModel.showSash;
- this.playerModel.showSash = this.HasPlayerFlag(PlayerFlags.DisplaySash);
- if (showSash != this.playerModel.showSash)
- {
- this.needsClothesRebuild = true;
- }
- }
- if (this.wasSleeping && !this.IsSleeping())
- {
- this.wakeTime = UnityEngine.Time.realtimeSinceStartup;
- }
- this.wasSleeping = this.IsSleeping();
- if (this.movement != null)
- {
- this.movement.SetParent(base.transform.parent);
- }
- }
- }
- [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")]
- public void Promote(BasePlayer player)
- {
- if (LocalPlayer.Entity.lookingAtEntity.GetComponent<BasePlayer>() != null)
- {
- ConsoleSystem.Run(ConsoleSystem.Option.Client, "promote", Array.Empty<object>());
- }
- }
- public bool Promote_ShowIf(BasePlayer player)
- {
- if (!RelationshipManager.TeamsEnabled())
- {
- return false;
- }
- if (!LocalPlayerIsLeader())
- {
- return false;
- }
- if (this == LocalPlayer.Entity)
- {
- return false;
- }
- BasePlayer component = LocalPlayer.Entity.lookingAtEntity.GetComponent<BasePlayer>();
- if (component == null)
- {
- return false;
- }
- if (component.IsDead())
- {
- return false;
- }
- return ((component.currentTeam == LocalPlayer.Entity.currentTeam) && (LocalPlayer.Entity.currentTeam != 0L));
- }
- internal void QuickUse()
- {
- if (!this.IsWounded() && !this.HeldItemUse())
- {
- BaseEntity interactionEntity = this.GetInteractionEntity();
- if (interactionEntity != null)
- {
- interactionEntity.gameObject.SendMessage("OnUse", this, SendMessageOptions.DontRequireReceiver);
- }
- }
- }
- private void RebuildWorldModel()
- {
- if (this.playerModel != null)
- {
- this.playerModel.Clear();
- this.SetDefaultFootstepEffects();
- if (this.inventory.containerWear != null)
- {
- foreach (Item item in this.inventory.containerWear.itemList)
- {
- ItemModWearable component = item.info.GetComponent<ItemModWearable>();
- if (component != null)
- {
- component.OnDressModel(item, this.playerModel);
- }
- }
- }
- this.playerModel.Rebuild(true);
- this.UpdateClothingItems(this.playerModel.multiMesh);
- this.UpdateHolsterOffsets();
- }
- }
- [RPC_Client]
- public void RecieveAchievement(string name)
- {
- if (GameInfo.HasAchievements)
- {
- Facepunch.Steamworks.Client.Instance.Achievements.Trigger(name, true);
- }
- }
- public static void RegisterForVisibility(BasePlayer player)
- {
- if (!visiblePlayerList.Contains(player.userID))
- {
- visiblePlayerList.Add(player.userID, player);
- }
- player.RegisterForCulling();
- }
- [RPC_Client]
- private void RPC_OpenLootPanel(BaseEntity.RPCMessage rpc)
- {
- if (!Client.IsPlayingDemo && (LocalPlayer.Entity != null))
- {
- UIInventory.OpenLoot((!LocalPlayer.Entity.IsAdmin || !(lootPanelOverride != string.Empty)) ? rpc.read.String() : lootPanelOverride);
- this.PlayOpenSound();
- }
- }
- [Description("saltwater_desc", "Can't Drink This"), ShowIf("SaltWater_ShowIf"), Menu("saltwater", "Salt Water"), Icon("close")]
- public void SaltWater(BasePlayer player)
- {
- }
- public bool SaltWater_ShowIf(BasePlayer player)
- {
- if (this.movement == null)
- {
- return false;
- }
- if (this.movement.CurrentMoveSpeed() > 0.1f)
- {
- return false;
- }
- Vector3 waterDrinkingPoint = player.GetWaterDrinkingPoint();
- if (waterDrinkingPoint == Vector3.zero)
- {
- return false;
- }
- if (WaterResource.IsFreshWater(waterDrinkingPoint))
- {
- return false;
- }
- WaterLevel.WaterInfo waterInfo = WaterLevel.GetWaterInfo(waterDrinkingPoint);
- if (!waterInfo.isValid)
- {
- return false;
- }
- if (waterInfo.overallDepth < 0.05f)
- {
- return false;
- }
- return true;
- }
- public override void ScaleDamage(HitInfo info)
- {
- if (info.UseProtection)
- {
- HitArea boneArea = info.boneArea;
- if (boneArea != -1)
- {
- this.cachedProtection.Clear();
- this.cachedProtection.Add(this.inventory.containerWear.itemList, boneArea);
- this.cachedProtection.Multiply(DamageType.Arrow, ConVar.Server.arrowarmor);
- this.cachedProtection.Multiply(DamageType.Bullet, ConVar.Server.bulletarmor);
- this.cachedProtection.Multiply(DamageType.Slash, ConVar.Server.meleearmor);
- this.cachedProtection.Multiply(DamageType.Blunt, ConVar.Server.meleearmor);
- this.cachedProtection.Multiply(DamageType.Stab, ConVar.Server.meleearmor);
- this.cachedProtection.Multiply(DamageType.Bleeding, ConVar.Server.bleedingarmor);
- this.cachedProtection.Scale(info.damageTypes, 1f);
- }
- else
- {
- base.baseProtection.Scale(info.damageTypes, 1f);
- }
- }
- if (info.damageProperties != null)
- {
- info.damageProperties.ScaleDamage(info);
- }
- }
- internal void SendClientTick()
- {
- UnityEngine.Assertions.Assert.IsNotNull<PlayerInput>(this.input, "input is null");
- UnityEngine.Assertions.Assert.IsNotNull<InputState>(this.input.state, "input.state is null");
- UnityEngine.Assertions.Assert.IsNotNull<Network.Client>(Network.Net.cl, "Network.Net.cl is null");
- UnityEngine.Assertions.Assert.IsNotNull<Write>(Network.Net.cl.write, "Network.Net.cl.write is null");
- this.lastSentTickTime = UnityEngine.Time.realtimeSinceStartup;
- using (PlayerTick tick = Facepunch.Pool.Get<PlayerTick>())
- {
- Item activeItem = this.Belt.GetActiveItem();
- tick.activeItem = (activeItem == null) ? 0 : activeItem.uid;
- this.ModifyInputState(ref this.input.state);
- tick.inputState = this.input.state.current;
- tick.position = base.transform.localPosition;
- tick.eyePos = this.eyes.position;
- tick.parentID = this.parentEntity.uid;
- if (tick.modelState == null)
- {
- tick.modelState = Facepunch.Pool.Get<ModelState>();
- tick.modelState.onground = true;
- }
- if (this.modelState != null)
- {
- this.modelState.CopyTo(tick.modelState);
- }
- if (Network.Net.cl.write.Start())
- {
- Network.Net.cl.write.PacketID(Message.Type.Tick);
- tick.WriteToStreamDelta(Network.Net.cl.write, this.lastSentTick);
- SendInfo info = new SendInfo(Network.Net.cl.Connection) {
- priority = Priority.Immediate
- };
- Network.Net.cl.write.Send(info);
- }
- if (Network.Net.cl.IsRecording)
- {
- byte[] data = tick.ToProtoBytes();
- Network.Net.cl.ManualRecordPacket(15, data, data.Length);
- }
- if (this.lastSentTick == null)
- {
- this.lastSentTick = Facepunch.Pool.Get<PlayerTick>();
- }
- tick.CopyTo(this.lastSentTick);
- }
- }
- public void SendProjectileAttack(PlayerProjectileAttack attack)
- {
- base.ServerRPC<PlayerProjectileAttack>("OnProjectileAttack", attack);
- }
- public void SendProjectileRicochet(PlayerProjectileRicochet ricochet)
- {
- base.ServerRPC<PlayerProjectileRicochet>("OnProjectileRicochet", ricochet);
- }
- public void SendProjectileUpdate(PlayerProjectileUpdate update)
- {
- base.ServerRPC<PlayerProjectileUpdate>("OnProjectileUpdate", update);
- }
- internal void SendVoiceData(byte[] data, int len)
- {
- if (((Network.Net.cl != null) && Network.Net.cl.IsConnected()) && Network.Net.cl.write.Start())
- {
- Network.Net.cl.write.PacketID(Message.Type.VoiceData);
- Network.Net.cl.write.BytesWithSize(data, len);
- SendInfo info = new SendInfo(Network.Net.cl.Connection) {
- priority = Priority.Immediate
- };
- Network.Net.cl.write.Send(info);
- }
- }
- private void SetDefaultFootstepEffects()
- {
- if (this.playerModel != null)
- {
- FootstepEffects component = this.playerModel.GetComponent<FootstepEffects>();
- component.footstepEffectName = "footstep/barefoot";
- component.jumpStartEffectName = "jump-start/barefoot";
- component.jumpLandEffectName = "jump-land/barefoot";
- }
- }
- [RPC_Client]
- public void SetHostileLength(BaseEntity.RPCMessage msg)
- {
- float num = msg.read.Float();
- HostileNote.unhostileTime = UnityEngine.Time.realtimeSinceStartup + num;
- }
- public override void SetNetworkPosition(Vector3 vPos)
- {
- if (!this.HasLocalControls() && !this.isMounted)
- {
- base.SetNetworkPosition(vPos);
- }
- }
- public override void SetNetworkRotation(Quaternion qRot)
- {
- if (!this.HasLocalControls() && !this.IsSpectating())
- {
- this.eyes.bodyRotation = qRot;
- }
- }
- private void SetNextVisThink(float addTime)
- {
- this.nextVisThink = UnityEngine.Time.realtimeSinceStartup + addTime;
- }
- [RPC_Client]
- public void SetWeaponDrawnDuration(BaseEntity.RPCMessage msg)
- {
- HostileNote.weaponDrawnDuration = msg.read.Float();
- }
- public override bool ShouldDestroyWithGroup()
- {
- if (this.IsLocalPlayer())
- {
- return false;
- }
- return base.ShouldDestroyWithGroup();
- }
- public override bool ShouldInheritNetworkGroup()
- {
- return (this.IsNpc || this.IsSpectating());
- }
- public override bool ShouldLerp()
- {
- if (this.IsLocalPlayer())
- {
- return false;
- }
- if (this.IsDead())
- {
- return false;
- }
- if (this.IsSleeping())
- {
- return false;
- }
- if (this.IsWounded())
- {
- return false;
- }
- return true;
- }
- public override float StartHealth()
- {
- return UnityEngine.Random.Range((float) 50f, (float) 60f);
- }
- [RPC_Client]
- private void StartLoading()
- {
- MapInterface.ResetMap();
- MusicManager.RaiseIntensityTo(0.75f, 0x3e7);
- LoadingScreen.Update("Receiving Data");
- LoadingScreen.Show();
- }
- public override float StartMaxHealth()
- {
- return 100f;
- }
- public bool SwapSeatCooldown()
- {
- return (UnityEngine.Time.time < this.nextSeatSwapTime);
- }
- private float TimeSinceSeen()
- {
- return (UnityEngine.Time.realtimeSinceStartup - this.lastTimeSeen);
- }
- public override BasePlayer ToPlayer()
- {
- return this;
- }
- public override string ToString()
- {
- if (base._name == null)
- {
- if (base.isServer)
- {
- base._name = string.Format("{1}[{0}/{2}]", (base.net == null) ? ((object) 0) : ((object) base.net.ID), this.displayName, this.userID);
- }
- else
- {
- base._name = base.ShortPrefabName;
- }
- }
- return base._name;
- }
- [RPC_Client]
- public void UnlockedBlueprint(BaseEntity.RPCMessage msg)
- {
- LocalPlayer.OnInventoryChanged();
- UIBlueprints.Refresh();
- }
- public static void UnregisterFromVisibility(ulong userID)
- {
- BasePlayer player;
- if (visiblePlayerList.TryGetValue(userID, out player))
- {
- visiblePlayerList.Remove(userID);
- player.UnregisterFromCulling();
- }
- }
- protected void UpdateClothesIfNeeded()
- {
- if ((this.needsClothesRebuild && this.IsAlive()) && base.isVisible)
- {
- this.needsClothesRebuild = false;
- this.RebuildWorldModel();
- this.UpdateProtectionFromClothing();
- this.UpdateMoveSpeedFromClothing();
- if (this.IsLocalPlayer())
- {
- if (SingletonComponent<uiPlayerPreview>.Instance != null)
- {
- SingletonComponent<uiPlayerPreview>.Instance.UpdateFrom(this.playerModel);
- }
- bool flag = false;
- bool flag2 = false;
- foreach (Item item in this.inventory.containerWear.itemList)
- {
- ItemModWearable component = item.info.GetComponent<ItemModWearable>();
- if ((component != null) && (component.occlusionType != UIBlackoutOverlay.blackoutType.NONE))
- {
- if (component.occlusionType == UIBlackoutOverlay.blackoutType.SNORKELGOGGLE)
- {
- flag2 = true;
- flag = false;
- }
- else if (component.occlusionType == UIBlackoutOverlay.blackoutType.HELMETSLIT)
- {
- flag = true;
- flag2 = false;
- }
- break;
- }
- }
- UIBlackoutOverlay overlay = UIBlackoutOverlay.Get(UIBlackoutOverlay.blackoutType.HELMETSLIT);
- if (overlay != null)
- {
- overlay.SetAlpha(!flag ? ((float) 0) : ((float) 1));
- }
- UIBlackoutOverlay overlay2 = UIBlackoutOverlay.Get(UIBlackoutOverlay.blackoutType.SNORKELGOGGLE);
- if (overlay2 != null)
- {
- overlay2.SetAlpha(!flag2 ? ((float) 0) : ((float) 1));
- WaterOverlay.goggles = flag2;
- }
- }
- GlobalMessages.OnClothingChanged();
- }
- }
- public void UpdateClothingItems(SkinnedMultiMesh multiMesh)
- {
- if ((this.playerModel != null) && (this.inventory != null))
- {
- foreach (Item item in this.inventory.containerWear.itemList)
- {
- ItemModWearable component = item.info.GetComponent<ItemModWearable>();
- if (component != null)
- {
- SkinnedMultiMesh.Part[] partArray = multiMesh.FindParts(component.entityPrefab.resourcePath);
- if (partArray != null)
- {
- List<IItemUpdate> results = Facepunch.Pool.GetList<IItemUpdate>();
- foreach (SkinnedMultiMesh.Part part in partArray)
- {
- part.gameObject.GetComponentsInChildren<IItemUpdate>(true, results);
- foreach (IItemUpdate update in results)
- {
- update.OnItemUpdate(item);
- }
- }
- Facepunch.Pool.FreeList<IItemUpdate>(ref results);
- }
- }
- }
- }
- }
- protected override void UpdateCullingSpheres()
- {
- Vector3 center;
- Matrix4x4 localToWorldMatrix;
- float radius = this.GetRadius() * 2f;
- if ((this.playerModel != null) && (this.playerModel.collision != null))
- {
- center = this.playerModel.collision.center;
- localToWorldMatrix = this.playerModel.transform.localToWorldMatrix;
- }
- else
- {
- center = this.bounds.center;
- localToWorldMatrix = base.transform.localToWorldMatrix;
- }
- if (this.IsSleeping() || this.IsWounded())
- {
- center.y *= 0.25f;
- radius *= !this.IsSleeping() ? 1f : 0.5f;
- }
- else if (this.IsDucked())
- {
- center.y *= 0.66f;
- }
- this.localOccludee.sphere = new OcclusionCulling.Sphere(localToWorldMatrix.MultiplyPoint3x4(center), radius);
- }
- public void UpdateHolsterOffsets()
- {
- if (base.children != null)
- {
- foreach (BaseEntity entity in base.children)
- {
- if (entity != null)
- {
- HeldEntity component = entity.GetComponent<HeldEntity>();
- if (component != null)
- {
- component.UpdateHolsteredOffset();
- }
- }
- }
- }
- }
- internal bool UpdateLookingAt(float radius, bool includeSecondaryEntities)
- {
- this.lookingAt = base.gameObject;
- this.lookingAtEntity = this;
- this.lookingAtCollider = this.triggerCollider;
- this.lookingAtPoint = this.eyes.position + ((Vector3) (this.eyes.HeadForward() * 8f));
- List<TraceInfo> traces = Facepunch.Pool.GetList<TraceInfo>();
- if (this.lookingAtTest == null)
- {
- this.lookingAtTest = new HitTest();
- }
- else
- {
- this.lookingAtTest.Clear();
- }
- using (TimeWarning.New("Traces", (float) 0.1f))
- {
- this.lookingAtTest.AttackRay = this.eyes.HeadRay();
- this.lookingAtTest.MaxDistance = 2f;
- this.lookingAtTest.Radius = radius;
- this.lookingAtTest.Forgiveness = radius;
- this.lookingAtTest.ignoreEntity = this;
- this.lookingAtTest.type = HitTest.Type.Use;
- GameTrace.TraceAll(this.lookingAtTest, traces, 0xdb16b01);
- for (int j = 0; j < traces.Count; j++)
- {
- TraceInfo info = traces[j];
- if (info.distance > 2f)
- {
- info.distance = 100f;
- }
- else if (info.entity == null)
- {
- info.distance = 100f;
- }
- else if ((!info.entity.HasMenuOptions && !(info.entity is WorldItem)) && (!(info.entity is CollectibleEntity) && !(info.entity is IOEntity)))
- {
- if (!includeSecondaryEntities)
- {
- info.distance = 100f;
- }
- else
- {
- info.distance++;
- }
- }
- traces[j] = info;
- }
- }
- using (TimeWarning.New("Sort", (float) 0.1f))
- {
- if (<>f__am$cache0 == null)
- {
- <>f__am$cache0 = (a, b) => a.distance.CompareTo(b.distance);
- }
- traces.Sort(<>f__am$cache0);
- }
- for (int i = 0; i < traces.Count; i++)
- {
- TraceInfo trace = traces[i];
- if ((trace.distance < 100f) && this.CheckLookingAtVisible(this.lookingAtTest, trace))
- {
- trace.UpdateHitTest(this.lookingAtTest);
- this.lookingAtPoint = this.lookingAtTest.HitPointWorld();
- this.lookingAt = this.lookingAtTest.gameObject;
- this.lookingAtCollider = this.lookingAtTest.collider;
- this.lookingAtPoint = this.lookingAtTest.AttackRay.origin + ((Vector3) (this.lookingAtTest.AttackRay.direction * this.lookingAtTest.HitDistance));
- this.lookingAtEntity = this.lookingAt.ToBaseEntity();
- if (this.lookingAtEntity != null)
- {
- this.lookingAt = this.lookingAtEntity.gameObject;
- }
- break;
- }
- }
- Facepunch.Pool.FreeList<TraceInfo>(ref traces);
- return (this.lookingAtEntity != this);
- }
- private void UpdateMoveSpeedFromClothing()
- {
- float a = 0f;
- float num2 = 0f;
- float num3 = 0f;
- bool flag = false;
- bool flag2 = false;
- float num4 = 0f;
- foreach (Item item in this.inventory.containerWear.itemList)
- {
- ItemModWearable component = item.info.GetComponent<ItemModWearable>();
- if (component != null)
- {
- if (component.blocksAiming)
- {
- flag = true;
- }
- if (component.blocksEquipping)
- {
- flag2 = true;
- }
- num4 += component.accuracyBonus;
- if (component.movementProperties != null)
- {
- num2 += component.movementProperties.speedReduction;
- a = Mathf.Max(a, component.movementProperties.minSpeedReduction);
- num3 += component.movementProperties.waterSpeedBonus;
- }
- }
- }
- this.clothingAccuracyBonus = num4;
- this.clothingMoveSpeedReduction = Mathf.Max(num2, a);
- this.clothingBlocksAiming = flag;
- this.clothingWaterSpeedBonus = num3;
- this.equippingBlocked = flag2;
- }
- public void UpdatePlayerCollider(bool state)
- {
- if (this.triggerCollider == null)
- {
- this.triggerCollider = base.gameObject.GetComponent<Collider>();
- }
- if (this.triggerCollider.enabled != state)
- {
- base.RemoveFromTriggers();
- }
- this.triggerCollider.enabled = state;
- }
- public void UpdatePlayerRigidbody(bool state)
- {
- if (this.physicsRigidbody == null)
- {
- this.physicsRigidbody = base.gameObject.GetComponent<Rigidbody>();
- }
- if (state)
- {
- if (this.physicsRigidbody == null)
- {
- this.physicsRigidbody = base.gameObject.AddComponent<Rigidbody>();
- this.physicsRigidbody.useGravity = false;
- this.physicsRigidbody.isKinematic = true;
- this.physicsRigidbody.mass = 1f;
- this.physicsRigidbody.interpolation = RigidbodyInterpolation.None;
- this.physicsRigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete;
- }
- }
- else
- {
- base.RemoveFromTriggers();
- if (this.physicsRigidbody != null)
- {
- GameManager.Destroy(this.physicsRigidbody, 0f);
- this.physicsRigidbody = null;
- }
- }
- }
- public static void UpdatePlayerVisibilities()
- {
- if (PlayerCull.enabled || Culling.toggle)
- {
- BasePlayer[] buffer = VisiblePlayerList.Buffer;
- int count = VisiblePlayerList.Count;
- for (int i = 0; i < count; i++)
- {
- BasePlayer player = buffer[i];
- if (player.WantsVisUpdate())
- {
- player.VisUpdate();
- }
- }
- }
- }
- public virtual void UpdateProtectionFromClothing()
- {
- base.baseProtection.Clear();
- base.baseProtection.Add(this.inventory.containerWear.itemList, -1);
- float num = 0.1666667f;
- for (int i = 0; i < base.baseProtection.amounts.Length; i++)
- {
- if (i != 0x11)
- {
- base.baseProtection.amounts[i] *= num;
- }
- }
- }
- public void UpdateTopologyStats()
- {
- if ((TerrainMeta.TopologyMap != null) && (UnityEngine.Time.realtimeSinceStartup >= this.nextTopologyTestTime))
- {
- this.nextTopologyTestTime = UnityEngine.Time.realtimeSinceStartup + 5f;
- if ((TerrainMeta.TopologyMap.GetTopology(base.transform.position) & 0x800) != 0)
- {
- Facepunch.Rust.Analytics.TimeOnRoad += 5f;
- }
- }
- }
- public void UpdateViewMode()
- {
- CameraMode idealViewMode = this.idealViewMode;
- if (idealViewMode != this.currentViewMode)
- {
- this.currentViewMode = idealViewMode;
- this.OnViewModeChanged();
- }
- }
- internal void UseAction(InputState state)
- {
- if (!state.IsDown(BUTTON.USE))
- {
- if ((UnityEngine.Time.realtimeSinceStartup - this.usePressTime) < ConVar.Input.holdtime)
- {
- this.usePressTime = 0f;
- this.QuickUse();
- }
- if (this.useHeldTime != 0f)
- {
- this.UseStop();
- this.useHeldTime = 0f;
- }
- }
- else
- {
- if (state.WasJustPressed(BUTTON.USE))
- {
- this.usePressTime = UnityEngine.Time.realtimeSinceStartup;
- }
- if ((this.usePressTime != 0f) && ((UnityEngine.Time.realtimeSinceStartup - this.usePressTime) > ConVar.Input.holdtime))
- {
- this.usePressTime = 0f;
- this.LongUse();
- this.useHeldTime = UnityEngine.Time.realtimeSinceStartup;
- }
- }
- }
- internal void UseStop()
- {
- if (!this.IsWounded())
- {
- BaseEntity interactionEntity = this.GetInteractionEntity();
- if (interactionEntity != null)
- {
- interactionEntity.gameObject.SendMessage("OnUseStopped", this, SendMessageOptions.DontRequireReceiver);
- }
- }
- }
- private bool VisPlayerArmed()
- {
- HeldEntity heldEntity = this.GetHeldEntity();
- return ((heldEntity != null) && (heldEntity is BaseProjectile));
- }
- private void VisUpdate()
- {
- if (((LocalPlayer.Entity != null) && (MainCamera.mainCamera != null)) && !this.IsLocalPlayer())
- {
- if (Culling.toggle)
- {
- float dist = Vector3.Distance(MainCamera.mainCamera.transform.position, base.transform.position);
- if (UnityEngine.Time.realtimeSinceStartup >= this.nextVisThink)
- {
- this.VisUpdateUsingCulling(dist, this.CheckVisibility());
- }
- float addTime = base.CalcEntityVisUpdateRate() + UnityEngine.Random.Range((float) 0f, (float) 0.1f);
- this.SetNextVisThink(addTime);
- if (OcclusionCulling.DebugFilterIsDynamic(Culling.debug))
- {
- UnityEngine.Color color = !this.IsDead() ? (!base.isVisible ? UnityEngine.Color.red : UnityEngine.Color.green) : UnityEngine.Color.black;
- if (this.IsSleeping())
- {
- UnityEngine.DDraw.Box(this.localOccludee.sphere.position, this.localOccludee.sphere.radius * 1.5f, color, addTime, false);
- }
- else
- {
- UnityEngine.DDraw.SphereGizmo(this.localOccludee.sphere.position, this.localOccludee.sphere.radius, color, addTime, false, false);
- }
- }
- }
- else
- {
- float num3 = Vector3.Distance(LocalPlayer.Entity.eyes.position, base.transform.position);
- if (UnityEngine.Time.realtimeSinceStartup >= this.nextVisThink)
- {
- this.VisUpdateUsingRays(num3);
- }
- float num4 = this.CalcVisUpdateRate(num3) + UnityEngine.Random.Range((float) 0f, (float) 0.1f);
- this.SetNextVisThink(num4);
- }
- }
- }
- private void VisUpdateUsingCulling(float dist, bool visibility)
- {
- bool flag = true;
- float entityMinCullDist = Culling.entityMinCullDist;
- float entityMinAnimatorCullDist = Culling.entityMinAnimatorCullDist;
- float entityMinShadowCullDist = Culling.entityMinShadowCullDist;
- float entityMaxDist = Culling.entityMaxDist;
- this.UpdateCullingBounds();
- if (dist > entityMaxDist)
- {
- flag = false;
- }
- else if (dist <= entityMinCullDist)
- {
- flag = true;
- }
- else
- {
- flag = visibility;
- }
- base.isVisible = flag;
- base.isAnimatorVisible = base.isVisible || (dist <= entityMinAnimatorCullDist);
- base.isShadowVisible = base.isVisible || (dist <= entityMinShadowCullDist);
- }
- private void VisUpdateUsingRays(float dist)
- {
- bool flag = true;
- if (this.IsSleeping() && (dist > PlayerCull.maxSleeperDist))
- {
- flag = false;
- }
- else if (dist > PlayerCull.maxPlayerDist)
- {
- flag = false;
- }
- else if (dist <= PlayerCull.minCullDist)
- {
- flag = true;
- }
- else if (IsAimingAt(LocalPlayer.Entity, this, 0.99f))
- {
- flag = true;
- }
- else if (IsAimingAt(this, LocalPlayer.Entity, 0.99f))
- {
- flag = true;
- }
- else
- {
- Vector3 vector2 = this.eyes.position - LocalPlayer.Entity.eyes.position;
- Vector3 normalized = vector2.normalized;
- if (Vector3.Dot(LocalPlayer.Entity.eyes.HeadForward(), normalized) < 0f)
- {
- flag = false;
- }
- else
- {
- flag = this.AnyPartVisible();
- }
- }
- if (flag)
- {
- this.lastTimeSeen = UnityEngine.Time.realtimeSinceStartup;
- }
- if (flag || (this.TimeSinceSeen() <= 2f))
- {
- base.isVisible = true;
- }
- else
- {
- base.isVisible = false;
- }
- base.isAnimatorVisible = base.isVisible;
- base.isShadowVisible = base.isVisible;
- }
- private bool WantsVisUpdate()
- {
- return (UnityEngine.Time.realtimeSinceStartup >= this.nextVisThink);
- }
- public override float WaterFactor()
- {
- if (this.isMounted)
- {
- return this.GetMounted().WaterFactorForPlayer(this);
- }
- return base.WaterFactor();
- }
- public Network.Connection Connection
- {
- get
- {
- return ((base.net != null) ? base.net.connection : null);
- }
- }
- public string displayName
- {
- get
- {
- if (base.isClient && ConVar.Global.streamermode)
- {
- return RandomUsernames.Get(this.userID);
- }
- return this._displayName;
- }
- set
- {
- this._displayName = value;
- }
- }
- public override bool HasMenuOptions
- {
- get
- {
- 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)))))));
- }
- }
- internal CameraMode idealViewMode
- {
- get
- {
- if (!this.IsSpectating())
- {
- if (this.IsSleeping())
- {
- return CameraMode.Eyes;
- }
- if (this.IsWounded())
- {
- return CameraMode.Eyes;
- }
- if (this.IsDead())
- {
- return CameraMode.Eyes;
- }
- }
- return this.selectedViewMode;
- }
- }
- public bool IsAdmin
- {
- get
- {
- return this.HasPlayerFlag(PlayerFlags.IsAdmin);
- }
- }
- public bool IsAiming
- {
- get
- {
- return this.HasPlayerFlag(PlayerFlags.Aiming);
- }
- }
- public bool IsConnected
- {
- get
- {
- return (base.isClient && this.HasPlayerFlag(PlayerFlags.Connected));
- }
- }
- public bool IsDeveloper
- {
- get
- {
- return this.HasPlayerFlag(PlayerFlags.IsDeveloper);
- }
- }
- public bool IsFlying
- {
- get
- {
- return ((this.modelState != null) && this.modelState.flying);
- }
- }
- public bool isMounted
- {
- get
- {
- return this.mounted.IsValid(base.isServer);
- }
- }
- public bool IsReceivingSnapshot
- {
- get
- {
- return this.HasPlayerFlag(PlayerFlags.ReceivingSnapshot);
- }
- }
- internal bool shouldDrawBody
- {
- get
- {
- if (this.IsLocalPlayer())
- {
- if (this.IsDead())
- {
- return false;
- }
- if ((SingletonComponent<CameraMan>.Instance != null) && SingletonComponent<CameraMan>.Instance.isActiveAndEnabled)
- {
- return true;
- }
- if (this.currentViewMode == CameraMode.FirstPerson)
- {
- return false;
- }
- }
- return true;
- }
- }
- public float TimeAwake
- {
- get
- {
- return (!this.IsSleeping() ? (UnityEngine.Time.realtimeSinceStartup - this.wakeTime) : 0f);
- }
- }
- public override BaseEntity.TraitFlag Traits
- {
- get
- {
- return ((((base.Traits | BaseEntity.TraitFlag.Human) | BaseEntity.TraitFlag.Food) | BaseEntity.TraitFlag.Meat) | BaseEntity.TraitFlag.Alive);
- }
- }
- public static BufferList<BasePlayer> VisiblePlayerList
- {
- get
- {
- return visiblePlayerList.Values;
- }
- }
- [CompilerGenerated]
- private sealed class <FinishedLoadingRoutine>c__Iterator0 : IEnumerator, IDisposable, IEnumerator<object>
- {
- internal object $current;
- internal bool $disposing;
- internal int $PC;
- internal BasePlayer $this;
- [DebuggerHidden]
- public void Dispose()
- {
- this.$disposing = true;
- this.$PC = -1;
- }
- public bool MoveNext()
- {
- uint num = (uint) this.$PC;
- this.$PC = -1;
- switch (num)
- {
- case 0:
- UIInventory.Close();
- MapInterface.SetOpen(false);
- HostileNote.unhostileTime = 0f;
- HostileNote.weaponDrawnDuration = 0f;
- MusicManager.RaiseIntensityTo(1f, 0x3e7);
- this.$this.eyes.FrameUpdate(MainCamera.mainCamera);
- LoadingScreen.Update("Refreshing Dynamic Decor");
- DecorSpawn.RefreshAll(false);
- LoadingScreen.Update("Refreshing Foliage");
- FoliageGrid.RefreshAll(false);
- LoadingScreen.Update("Processing Deferred Actions");
- LoadBalancer.ProcessAll();
- LoadingScreen.Update("Refreshing LODs");
- LODGrid.RefreshAll();
- LoadingScreen.Update("Refreshing Renderers");
- RendererGrid.RefreshAll();
- LoadingScreen.Update("Cleaning Up");
- System.GC.Collect();
- LoadingScreen.Update("Entering Game");
- MainMenuSystem.Hide();
- LoadingScreen.Hide();
- this.$this.ServerRPC("ClientLoadingComplete");
- this.$current = null;
- if (!this.$disposing)
- {
- this.$PC = 1;
- }
- return true;
- case 1:
- this.$PC = -1;
- break;
- }
- return false;
- }
- [DebuggerHidden]
- public void Reset()
- {
- throw new NotSupportedException();
- }
- object IEnumerator<object>.Current
- {
- [DebuggerHidden]
- get
- {
- return this.$current;
- }
- }
- object IEnumerator.Current
- {
- [DebuggerHidden]
- get
- {
- return this.$current;
- }
- }
- }
- public enum CameraMode
- {
- FirstPerson,
- ThirdPerson,
- Eyes
- }
- [Flags]
- public enum PlayerFlags
- {
- Aiming = 0x4000,
- ChatMute = 0x1000,
- Connected = 0x100,
- DisplaySash = 0x8000,
- EyesViewmode = 0x800,
- IsAdmin = 4,
- IsDeveloper = 0x80,
- NoSprint = 0x2000,
- ReceivingSnapshot = 8,
- Relaxed = 0x10000,
- SafeZone = 0x20000,
- Sleeping = 0x10,
- Spectating = 0x20,
- ThirdPersonViewmode = 0x400,
- Unused1 = 1,
- Unused2 = 2,
- VoiceMuted = 0x200,
- Workbench1 = 0x100000,
- Workbench2 = 0x200000,
- Workbench3 = 0x400000,
- Wounded = 0x40
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement