- Timestamp:
- Aug 2, 2017, 6:46:15 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/LiveData/Animals.cs
r252 r306 6 6 public class Animals 7 7 { 8 public static List<EntityAnimal> List { 9 get { 10 List<EntityAnimal> lst = new List<EntityAnimal> (); 8 public static void Get (List<EntityAnimal> _list) { 9 _list.Clear (); 10 try { 11 List<Entity> entities = GameManager.Instance.World.Entities.list; 12 for (int i = 0; i < entities.Count; i++) { 13 Entity entity = entities [i]; 11 14 12 try { 13 foreach (object base_entity in GameManager.Instance.World.Entities.list) { 14 try { 15 Entity entity = (Entity)base_entity; 15 // Kind of hack-ish, but the game is legitimately setting the base type of animals ('entityType') to enum 0 ('EntityType.Unknown'). 16 if ((entity.entityType == EntityType.Animal) || (entity is EntityAnimal)) { 17 EntityAnimal ea = (EntityAnimal)entity; 16 18 17 // Kind of hack-ish, but the game is legitimately setting the base type of animals ('entityType') to enum 0 ('EntityType.Unknown'). 18 if ((entity.entityType == EntityType.Animal) || (base_entity.GetType ().ToString ().ToLower ().Contains ("animal"))) { 19 EntityAnimal ea = (EntityAnimal)entity; 19 if (ea.IsAlive ()) 20 _list.Add (ea); 21 } 22 } 23 } 24 catch (Exception e) { 25 Log.Exception (e); 26 } 27 } 20 28 21 if (ea.IsAlive ()) 22 lst.Add (ea); 23 } 24 } 25 catch { } 26 } 27 } 28 catch { } 29 public static int GetCount () { 30 int count = 0; 31 try { 32 List<Entity> entities = GameManager.Instance.World.Entities.list; 33 for (int i = 0; i < entities.Count; i++) { 34 Entity entity = entities [i]; 29 35 30 return lst; 31 } 32 } 36 // Kind of hack-ish, but the game is legitimately setting the base type of animals ('entityType') to enum 0 ('EntityType.Unknown'). 37 if ((entity.entityType == EntityType.Animal) || (entity is EntityAnimal)) { 38 EntityAnimal ea = (EntityAnimal)entity; 33 39 40 if (ea.IsAlive ()) 41 count++; 42 } 43 } 44 } 45 catch (Exception e) { 46 Log.Exception (e); 47 } 48 return count; 49 } 34 50 35 public static int Count {36 get { return List.Count; }37 }38 51 } 39 52 }
Note:
See TracChangeset
for help on using the changeset viewer.