public void PickupItems() { if (!master.inventory) { return; } List <GenericPickupController> pickups = InstanceTracker.GetInstancesList <GenericPickupController>(); for (int i = 0; i < pickups.Count; i++) { GenericPickupController pickup = pickups[i]; // Skip lunar coins if (PickupCatalog.GetPickupDef(pickup.pickupIndex).coinValue > 0) { continue; } // Skip these ItemDef def = ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(pickup.pickupIndex).itemIndex); if (def != null && def.tier == ItemTier.Lunar) { continue; } EquipmentIndex equipmentIndex = PickupCatalog.GetPickupDef(pickup.pickupIndex).equipmentIndex; if (equipmentIndex != EquipmentIndex.None) { if (EquipmentCatalog.GetEquipmentDef(equipmentIndex).isLunar) { continue; } if (master.inventory.currentEquipmentIndex != EquipmentIndex.None) { continue; } } if (pickup.GetInteractability(this.bodyInteractor) == Interactability.Available) { // Move to pickup item if within 60 meters float dist = PlayerBotUtils.GetFastDist(master.GetBody().transform.position, pickup.gameObject.transform.position); if (dist <= (60f * 60f)) { this.ai.customTarget.gameObject = pickup.gameObject; return; } } } }
public static void RegisterSkillHelper(AiSkillHelper skillHelper) { SurvivorIndex index = SurvivorIndex.None; SkillHelperSurvivor[] survivorAttributes = skillHelper.GetType().GetCustomAttributes(typeof(SkillHelperSurvivor), false) as SkillHelperSurvivor[]; if (survivorAttributes.Length > 0) { SkillHelperSurvivor skillHelperSurvivor = survivorAttributes[0]; if (skillHelperSurvivor.Index != SurvivorIndex.None) { index = skillHelperSurvivor.Index; } else if (skillHelperSurvivor.BodyPrefabName != null) { if (PlayerBotUtils.TryGetSurvivorIndexByBodyPrefabName(skillHelperSurvivor.BodyPrefabName, out index)) { string name = BodyCatalog.FindBodyPrefab(skillHelperSurvivor.BodyPrefabName).GetComponent <CharacterBody>().GetDisplayName().ToLower(); if (!PlayerBotManager.SurvivorDict.ContainsKey(name)) { PlayerBotManager.SurvivorDict.Add(name, index); } if (skillHelperSurvivor.AllowRandom) { PlayerBotManager.RandomSurvivorsList.Add(index); } } else { return; } } else { return; } } else { return; } SkillHelperDict.Add(index, skillHelper); }