OSDN Git Service

replaced the static static map with dynamic static map :)
[automap/automap.git] / Automap / Data / EntitiesOfInterest.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4
5 using System.Linq;
6
7 using Vintagestory.API.Common.Entities;
8 using Vintagestory.API.MathTools;
9
10 namespace Automap
11 {
12         /// <summary>
13         /// Actual Physical Point in space - that is interesting.
14         /// </summary>
15         public struct EntityOfInterest
16         {
17                 public string Notes;
18                 public BlockPos Location;
19                 public DateTimeOffset Timestamp;
20                 public long EntityId;
21         }
22
23         /// <summary>
24         /// Entities of interest.
25         /// </summary>
26         /// <remarks>Tracked by ID - these never leave.</remarks>
27         public class EntitiesOfInterest : KeyedCollection<long, EntityOfInterest>
28         {
29
30                 internal void AddReplace(EntityOfInterest entity)
31                 {
32                         if (Contains(entity.EntityId))
33                                 Remove(entity.EntityId);
34
35                         Add(entity);
36                 }
37
38                 protected override long GetKeyForItem(EntityOfInterest item)
39                         => item.EntityId;
40         }
41 }
42