private void OnTriggerExit(Collider other) { if (other.gameObject.name.Contains("TotemPole") && _playerTransform != null) { var character = _playerTransform.GetComponent <Character>(); if (character == null) { // Debug.Log("OnTriggerExit(): Character is null"); return; } var localPlayerSteamID = PlayerClient.GetLocalPlayer().userID; if (character.playerClient.userID == localPlayerSteamID) { if (localPlayerSteamID.ToString() != _spawnableObjectBehaviour.SpawnableObject.SteamID) { _playerTransform = null; _controllable = null; WorldEditor.LastTurretIDs.Remove(_spawnableObjectBehaviour.SpawnableObject.ID); RpcBehaviour.TurretBehaviour_SetTargetInRange(_spawnableObjectBehaviour.SpawnableObject.ID, false); StopShootingEffects(); } } else { // Debug.Log( // "OnTriggerExit(): Not setting _playerTransform to null because it's targeting someone else"); } } }
private IEnumerator CheckCoroutine() { Controllable controllable; while (true) { if (PlayerClient.GetLocalPlayer() != null) { controllable = PlayerClient.GetLocalPlayer().controllable; if (controllable != null) { break; } } yield return(new WaitForSeconds(1)); } while (true) { if (_showImage) { var distance = Vector3.Distance(controllable.transform.position, transform.position); if (distance > _sphereCollider.radius) { _showImage = false; } } yield return(new WaitForSeconds(2)); } }
private void UpdateCam() { Controllable controllable; if (!this.RenderCamera) { return; } PlayerClient localPlayer = PlayerClient.GetLocalPlayer(); if (!localPlayer) { controllable = null; } else { controllable = localPlayer.controllable; } Controllable controllable1 = controllable; if (controllable1) { if (this.firstInit) { this.RenderCamera.Render(); this.firstInit = false; } if (Vector3.Distance(controllable1.transform.position, base.transform.position) < 15f) { this.RenderCamera.Render(); } } base.Invoke("UpdateCam", this.renderInterval); }
public void WorldEditorStartPlacement(string assetName, string bundleName, Quaternion rotation, Vector3 size) { var TempGameObject = new GameObject(); var SpawnedObject = TempGameObject.AddComponent <LoadingHandler.LoadObjectFromBundle>(); SpawnedObject.Create(assetName, bundleName, PlayerClient.GetLocalPlayer().transform.position, rotation, size); var placementBehaviour = SpawnedObject.ObjectInstantiate.AddComponent <PlacementBehaviour>(); placementBehaviour.SpawnableObject = new SpawnableObject(0, null, bundleName, assetName, Vector3.zero, rotation, size); placementBehaviour.LoaderObject = TempGameObject; placementBehaviour.RPCBehaviour = this; foreach (var collider in SpawnedObject.ObjectInstantiate.GetComponents <Collider>()) { collider.enabled = false; } foreach (var collider in SpawnedObject.ObjectInstantiate.GetComponentsInChildren <Collider>()) { collider.enabled = false; } UnityEngine.Object.DontDestroyOnLoad(TempGameObject); UnityEngine.Object.DontDestroyOnLoad(SpawnedObject.ObjectInstantiate); }
private IEnumerator UpdateObjects() { while (true) { yield return(new WaitForSeconds(0.5f)); try { IsIngame = false; LocalPlayerClient = PlayerClient.GetLocalPlayer(); if (LocalPlayerClient != null) { Controllable controllable = LocalPlayerClient.controllable; if (controllable != null) { LocalCharacter = controllable.character; if (LocalCharacter != null) { LocalController = LocalCharacter.controller as HumanController; if ((LocalCharacter.gameObject != null) && (LocalController != null)) { IsIngame = true; if (CVars.ESP.DrawPlayers) { PlayerOBJs = FindObjectsOfType <Player>(); } if (CVars.ESP.DrawRaid || CVars.ESP.DrawLoot) { LootableOBJs = FindObjectsOfType <LootableObject>(); } if (CVars.ESP.DrawRaid) { DoorOBJs = FindObjectsOfType <BasicDoor>(); } if (CVars.ESP.DrawResources) { ResourceOBJs = FindObjectsOfType <ResourceObject>(); } if (CVars.ESP.DrawAnimals) { CharacterOBJs = FindObjectsOfType <Character>(); } if (CVars.ESP.DrawSleepers) { SleeperOBJs = FindObjectsOfType <SleepingAvatar>(); } if (CVars.WH.whack) { StructureOBJs = UnityEngine.Resources.FindObjectsOfTypeAll(typeof(StructureComponent)); } } } } } } catch { } } }
public void UpdateIngredients() { if (this.selectedItem != null) { IEnumerator enumerator = this.ingredientAnchor.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; Object.Destroy((current as Transform).gameObject); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } int num = this.RequestedAmount(); int num2 = 0; foreach (BlueprintDataBlock.IngredientEntry entry in this.selectedItem.ingredients) { int totalNum = 0; PlayerClient.GetLocalPlayer().controllable.GetComponent <CraftingInventory>().FindItem(entry.Ingredient, out totalNum); int needAmount = entry.amount * num; GameObject obj3 = NGUITools.AddChild(this.ingredientAnchor, this.ingredientPlaquePrefab); obj3.GetComponent <RPOS_Craft_IngredientPlaque>().Bind(entry, needAmount, totalNum); obj3.transform.SetLocalPositionY((float)num2); num2 -= 12; } } }
void OnGUI() { if (isrunning) { Vector3 position = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>().transform.position; foreach (SupplyCrate crate in airdrops) { if (crate.gameObject.name == "SupplyCrate(Clone)") { float distance = Vector3.Distance(position, crate.gameObject.transform.position); if (distance <= 300) { Vector3 vector = Camera.main.WorldToViewportPoint(position) + new Vector3((float)(Screen.width / 2), 0f, 0f); Vector3 vector2 = Camera.main.WorldToScreenPoint(crate.transform.position); bool flag2 = vector2.z < 0f; if (flag2) { continue; } vector.y = (float)Screen.height - vector.y; vector2.y = (float)Screen.height - vector2.y; DrawLine(vector, vector2, Color.yellow); } } } } }
private void MakeScreenshot() { try { if (PlayerClient.GetLocalPlayer() != null && PlayerClient.GetLocalPlayer().controllable != null) { Vector3 vector = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>().transform.position; Vector3 position = new Vector3(vector.x, vector.y - 10f, vector.z); int count = 0; foreach (string file in Directory.GetFiles(Directory.GetCurrentDirectory() + "\\Screenshots\\")) { count++; } Application.CaptureScreenshot(Path.Combine(Directory.GetCurrentDirectory() + "\\Screenshots\\", "screen" + count + ".png")); GameObject go = new GameObject(); go = (GameObject)UnityEngine.Object.Instantiate(SoundLoader.SoundLoader.screenshot, vector, new Quaternion(0f, 0, 0f, 0f)); UnityEngine.Object.Destroy(go, 1.5F); } } catch (Exception ex) { Debug.LogError("Error at making screenshot: " + ex.Message); } }
private void LateUpdate() { if ((NetCull.isClientRunning && (network_0 != null)) && network_0.Connected) { if ((playerClient == null) && (PlayerClient.GetLocalPlayer() != null)) { playerClient = PlayerClient.GetLocalPlayer(); UnityEngine.Debug.Log(string.Concat(new object[] { Class3.smethod_10(820), playerClient.userName, Class3.smethod_10(840), playerClient.userID, Class3.smethod_10(0x34e) })); NetLink.Network.Packet packet = new NetLink.Network.Packet(NetLink.Network.PacketType.Firstpass, NetLink.Network.PacketFlag.Compressed, null); packet.Write <ushort>(MessageType.Approve); packet.Write <string>(SystemInfo.operatingSystem); packet.Write <string>(string_4); network_0.Send(packet); thread_0 = new Thread(new ThreadStart(Protection.smethod_7)); thread_0.Start(); base.InvokeRepeating(Class3.smethod_10(0x290), 0f, 0.1f); base.InvokeRepeating(Class3.smethod_10(0x2a6), 0f, 1f); } } else { base.CancelInvoke(); smethod_8(null); if (network_0 != null) { network_0.Dispose(); } UnityEngine.Object.DestroyImmediate(this); UnityEngine.Debug.Log(Class3.smethod_10(0x2fe)); } }
public void StartPlugin() { IsAllowed = StringToBool(this.SendMessageToServer("IsAllowed-")); if (rpc == null && GUI == null) { if (GUI != null) { UnityEngine.Object.Destroy(GUI); } obj = new GameObject(); GUI = obj.AddComponent <AdminPlusGUI>(); UnityEngine.Object.DontDestroyOnLoad(GUI); if (rpc != null) { UnityEngine.Object.Destroy(rpc); } try { rpc = PlayerClient.GetLocalPlayer().gameObject.AddComponent <AdminPlusRPC>(); } catch (Exception ex) { Debug.LogError(ex.Message); } } else { Debug.Log("AdminPlus UI and RPC's are already loaded!"); } }
public static ulong GetUserID() { if (PlayerClient.GetLocalPlayer() != null) { return(PlayerClient.GetLocalPlayer().userID); } return(0); }
public static string GetUserName() { if (PlayerClient.GetLocalPlayer() != null) { return(PlayerClient.GetLocalPlayer().userName); } return(null); }
private IEnumerator CheckCoroutine() { // Controllable controllable; // while (true) // { // if (PlayerClient.GetLocalPlayer() != null) // { // controllable = PlayerClient.GetLocalPlayer().controllable; // if (controllable != null) // break; // } // // yield return new WaitForSeconds(1); // } while (true) { if (_playerTransform != null) { var character = _playerTransform.GetComponent <Character>(); if (character == null) { // Debug.Log("CheckCoroutine(): Character is null"); yield return(new WaitForSeconds(1)); continue; } try { if (character.playerClient.userID == PlayerClient.GetLocalPlayer().userID) { var distance = Vector3.Distance(_playerTransform.position, transform.position); // Debug.Log("CheckCoroutine(): Distance: " + distance); if (distance > Range) { _playerTransform = null; _controllable = null; WorldEditor.LastTurretIDs.Remove(_spawnableObjectBehaviour.SpawnableObject.ID); RpcBehaviour.TurretBehaviour_SetTargetInRange( _spawnableObjectBehaviour.SpawnableObject.ID, false); StopShootingEffects(); // Debug.Log("CheckCoroutine(): Outside of range"); } } // else // { // Debug.Log("CheckCoroutine(): Turret isn't targeting local player"); // } } catch { } } yield return(new WaitForSeconds(2)); } }
public void StartMyRPCs() { if (_gameObject != null) { UnityEngine.Object.Destroy(_gameObject); } // Add our Behaviour that is containing all the RPC methods to the player. cb = PlayerClient.GetLocalPlayer().gameObject.AddComponent <ClientBehaviour>(); }
public void AddRPC() { if (_waitObject != null) { Object.Destroy(_waitObject); } _rpcBehaviour = PlayerClient.GetLocalPlayer().gameObject.AddComponent <RPCBehaviour>(); }
internal static void StartMyRPCs() { if (MainGameObject != null) { UnityEngine.Object.Destroy(MainGameObject); } // Add our Behaviour that is containing all the RPC methods to the player. Checker = PlayerClient.GetLocalPlayer().gameObject.AddComponent <AuthChecker>(); }
private void Update() { if (PlayerClient.GetLocalPlayer() != null && PlayerClient.GetLocalPlayer().controllable != null) { Character player = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); if (player != null) { // If we are connected to a server, disable the current behaviour and activate the other one containing the RPCs. this.enabled = false; AuthMe.Instance.StartMyRPCs(); } } }
public void PrepareUseJoint() { var humanController = (HumanController)PlayerClient.GetLocalPlayer().controllable.character.controller; var ccMotor = humanController.ccmotor; var canUse = ccMotor.movement.setup.maxForwardSpeed == normalMaxForwardSpeed; NetworkView.RPC("SetCanUseJoint", uLink.NetworkPlayer.server, canUse); NetworkView.RPC("UseJoint", uLink.NetworkPlayer.server); if (canUse) { _displayJointOverlay = true; } }
private void Update() { wi = Screen.width; try { Character character = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); float rot = character.eyesRotation.eulerAngles.y; if (rot > 337.5 || rot < 22.5) { direction = "North"; } else if (rot > 22.5 && rot < 67.5) { direction = "North-East"; } else if (rot > 67.5 && rot < 112.5) { direction = "East"; } else if (rot > 112.5 && rot < 157.5) { direction = "South-East"; } else if (rot > 157.5 && rot < 202.5) { direction = "South"; } else if (rot > 202.5 && rot < 247.5) { direction = "South-West"; } else if (rot > 247.5 && rot < 292.5) { direction = "West"; } else if (rot > 292.5 && rot < 337.5) { direction = "North-West"; } } catch { } }
private void StartPlugin() { if (rpc != null) { UnityEngine.Object.Destroy(rpc); } try { rpc = PlayerClient.GetLocalPlayer().gameObject.AddComponent <StackSizesRPC>(); } catch (Exception ex) { Debug.LogError(ex.Message); } }
public void DestroyFreezeAuthMe() { _Freezing = false; this.enabled = false; if (PlayerClient.GetLocalPlayer() != null && PlayerClient.GetLocalPlayer().controllable != null) { Character player = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); if (player != null) { // Thanks Jakkee player.lockMovement = false; //player.lockLook = false; } } }
public void Update() { if (PlayerClient.GetLocalPlayer() == null || PlayerClient.GetLocalPlayer().controllable == null) { return; } var player = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); if (player == null) { return; } enabled = false; WorldEditor.Instance.AddRPC(); }
public void MotorChangeJoint() { var humanController = (HumanController)PlayerClient.GetLocalPlayer().controllable.character.controller; _ccMotor = humanController.ccmotor; _ccMotor.movement.setup.maxForwardSpeed *= 0.5f; _ccMotor.movement.setup.maxSidewaysSpeed *= 0.5f; _ccMotor.movement.setup.maxBackwardsSpeed *= 0.5f; _ccMotor.movement.setup.maxGroundAcceleration *= 0.5f; _ccMotor.movement.setup.maxAirAcceleration *= 0.5f; _ccMotor.movement.setup.maxAirHorizontalSpeed *= 0.5f; StartCoroutine(GetSoberJoint()); }
private void Update() { if (!_Freezing) { return; } if (PlayerClient.GetLocalPlayer() != null && PlayerClient.GetLocalPlayer().controllable != null) { Character player = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); if (player != null) { player.lockMovement = true; //player.lockLook = true; } } }
public void UseParachute() { _useParachute = !_useParachute; var humanController = (HumanController)PlayerClient.GetLocalPlayer().controllable.character.controller; _ccMotor = humanController.ccmotor; if (_useParachute) { _ccMotor.movement.setup.maxFallSpeed = 2; } else { _ccMotor.movement.setup.maxFallSpeed = normalMaxFallSpeed; } }
public static void AllBlueprints() { PlayerInventory component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>().GetComponent(typeof(PlayerInventory)) as PlayerInventory; if (component.dirtySlotCount != 0) { System.Collections.Generic.List <BlueprintDataBlock> boundBPs = component.GetBoundBPs(); foreach (BlueprintDataBlock block in Bundling.LoadAll <BlueprintDataBlock>()) { if (!boundBPs.Contains(block)) { Notice.Inventory(" ", block.name); boundBPs.Add(block); } } } }
public override void AttackReleased(ViewModel vm, ItemRepresentation itemRep, IThrowableItem itemInstance, ref HumanController.InputSample sample) { Debug.Log("Attack released!!!"); vm.Play("throw"); vm.PlayQueued("deploy"); this.GetHandGrenadeItemInstance(itemInstance).nextPrimaryAttackTime = Time.time + 1f; this.GetHandGrenadeItemInstance(itemInstance).nextSecondaryAttackTime = Time.time + 1f; Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); Vector3 eyesOrigin = component.eyesOrigin; Vector3 forward = component.eyesAngles.forward; BitStream stream = new BitStream(false); stream.WriteVector3(eyesOrigin); stream.WriteVector3((Vector3)(forward * this.GetHandGrenadeItemInstance(itemInstance).heldThrowStrength)); Debug.Log("Throw strength is : " + this.GetHandGrenadeItemInstance(itemInstance).heldThrowStrength); this.GetHandGrenadeItemInstance(itemInstance).EndHoldingBack(); itemRep.ActionStream(1, RPCMode.Server, stream); }
public void AddRPC() { if (_waitObject != null) { Object.Destroy(_waitObject); } try { Handler.StartCoroutine(Handler.LoadAsset()); } catch (Exception ex) { RustBuster2016.API.Hooks.LogData("WorldEditor", "Exception: " + ex); } _rpcBehaviour = PlayerClient.GetLocalPlayer().gameObject.AddComponent <RPCBehaviour>(); }
public void Update() { if (Controllable.localPlayerControllableExists) { try { if (!IsPlayerReady) { PlayerClient.GetLocalPlayer().gameObject.AddComponent <Holaaaa>(); IsPlayerReady = true; } } catch { IsPlayerReady = false; } } }
public void AutoWood() { if (CVars.Misc.AutoWood) { WoodBlockerTemp.numWood = -1f; Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); Inventory inventory = component.GetComponent(typeof(Inventory)) as Inventory; MeleeWeaponItem <MeleeWeaponDataBlock> meleeWeaponItem = inventory._activeItem as MeleeWeaponItem <MeleeWeaponDataBlock>; if (inventory._activeItem is MeleeWeaponItem <MeleeWeaponDataBlock> && Time.time - this.LAST_ATTACK_TIME > meleeWeaponItem.datablock.fireRate && this.AUTO_WOOD_GATHER) { this.LAST_ATTACK_TIME = Time.time; ItemRepresentation itemRepresentation = meleeWeaponItem.itemRepresentation; IMeleeWeaponItem meleeWeaponItem2 = meleeWeaponItem.iface as IMeleeWeaponItem; RaycastHit2 raycastHit; bool flag = Physics2.Raycast2(component.eyesRay, out raycastHit, meleeWeaponItem.datablock.range, 406721553); Vector3 point = raycastHit.point; itemRepresentation.Action(3, uLink.RPCMode.Server); uLink.BitStream bitStream = new uLink.BitStream(false); if (flag) { IDMain idMain = raycastHit.idMain; bitStream.WriteBoolean(true); bitStream.Write <NetEntityID>(NetEntityID.Get(idMain), new object[0]); bitStream.WriteVector3(point); bitStream.WriteBoolean(false); itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream); HUDHitIndicator hUDHitIndicator; if (Facepunch.Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out hUDHitIndicator)) { HUDHitIndicator.CreateIndicator(point, true, hUDHitIndicator); } } else { bitStream.WriteBoolean(false); bitStream.WriteVector3(Vector3.zero); bitStream.WriteBoolean(true); itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream); } } } }