/// <summary> /// Process non-tree layer objects /// loot, nodes, supply drops, etc /// </summary> /// <param name="gameObject"></param> private void CollectGameObject(GameObjectBase gameObject) { /* Military Crates */ if (_isCollectingMilitaryCrates && gameObject.IsMilitaryCrate()) { MilitaryCrates.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Military Crates */ if (_isCollectingWoodenLootCrates && gameObject.IsNormalCrate()) { WoodenLootCrates.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Sulfur Objects */ if (_isCollectingSulfurNodes && gameObject.IsSulfurOre()) { SulfurNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Metal ore entities */ if (_isCollectingMetalNodes && gameObject.IsMetalOre()) { MetalNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Stone ore entities */ if (_isCollectingStoneNodes && gameObject.IsStoneOre()) { StoneNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Hemp Collectables */ if (_isCollectingHempNodes && gameObject.IsHempNode()) { HempNodes.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Tool Cupboards */ if (_isCollectingToolCupboards && gameObject.IsToolCupboard()) { ToolCupboards.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } /* Storage Containers */ if (_isCollectingStorageContainers && gameObject.IsStorageContainer()) { StorageContainers.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); return; } }
/// <summary> /// Filters out objects from the networkable list /// </summary> /// <param name="i"></param> /// <param name="isLocalPlayer"></param> private void FilterNetworkableObject(int i, bool isLocalPlayer) { try { var gameObjectAddress = GetNetworkableObjectAddress(i); var gameObject = new GameObjectBase((long)gameObjectAddress, false, false, true); /* LocalPlayer */ if (_localPlayer == null && isLocalPlayer && gameObject.Tag == 6) { _localPlayer = new GameObjectBase((long)GetLocalPlayerAddress(), false, false, true); UpdateLocalPlayerPosition(_localPlayer); return; } /* Networkable players */ else if (!isLocalPlayer && gameObject.Tag == 6) { if (_isCollectingPlayers) { Players.AddOrUpdate(gameObject.SteamID, gameObject, (old, newer) => gameObject); } } /* Animals */ else if (gameObject.Layer == 11) { if (_isCollectingAnimals && HasPreferredAnimalName(gameObject.EntityName)) { Animals.AddOrUpdate(gameObject.InitialAddress, gameObject, (old, newer) => gameObject); } } /* Everything networkable that is not a tree */ else if (gameObject.Layer != 30) { CollectGameObject(gameObject); } } catch (Exception ex) { /* Suppress */ } }
/// <summary> /// Separate out this logic since we might have to update this frequently /// </summary> private void UpdateMainCamera() { /* Setting the main camera just sets it to where the entity update tasks can access it and read it's rotation * this isn't something we have to update on each iteration of entities */ if (_isMainCameraSet == false) { /* Read and identify our tagged objects address */ var taggedObjectsAddress = KeeperOf.Memory.ReadLong(IntPtr.Add(_gameObjectManagerValueAddress, 0x08)); /* Our first tagged object is the Main Camera, so we'll set this and start from here when dumping these tagged objects */ _mainCameraObj = new GameObjectBase(taggedObjectsAddress, useNextObjectLink: false, isActiveObject: false, isBaseNetworkableObject: false); _localPlayerRotation = _mainCameraObj; UpdateMainCameraRotation(this._localPlayerRotation); _isMainCameraSet = true; } }