using System; using VRage.Game; using VRageMath; namespace Sandbox.ModAPI.Ingame { public enum MyDetectedEntityType { None = 0, Unknown, SmallGrid, LargeGrid, CharacterHuman, CharacterOther, FloatingObject, Asteroid, Planet, Meteor, Missile, } public struct MyDetectedEntityInfo { public MyDetectedEntityInfo(long entityId, string name, MyDetectedEntityType type, Vector3D? hitPosition, MatrixD orientation, Vector3 velocity, MyRelationsBetweenPlayerAndBlock relationship, BoundingBoxD boundingBox, long timeStamp) { if (timeStamp <= 0) throw new ArgumentException("Invalid Timestamp", "timeStamp"); EntityId = entityId; Name = name; Type = type; HitPosition = hitPosition; Orientation = orientation; Velocity = velocity; Relationship = relationship; BoundingBox = boundingBox; TimeStamp = timeStamp; } /// /// The entity's EntityId /// public readonly long EntityId; /// /// The entity's display name if it is friendly, or a generic descriptor if it is not /// public readonly string Name; /// /// Enum describing the type of entity /// public readonly MyDetectedEntityType Type; /// /// Position where the raycast hit the entity. (can be null if the sensor didn't use a raycast) /// public readonly Vector3D? HitPosition; /// /// The entity's absolute orientation at the time it was detected /// public readonly MatrixD Orientation; /// /// The entity's absolute velocity at the time it was detected /// public readonly Vector3 Velocity; /// /// Relationship between the entity and the owner of the sensor /// public readonly MyRelationsBetweenPlayerAndBlock Relationship; /// /// The entity's world-aligned bounding box /// public readonly BoundingBoxD BoundingBox; /// /// Time when the entity was detected. This field counts milliseconds, compensated for simspeed /// public readonly long TimeStamp; /// /// The entity's position (center of the Bounding Box) /// public Vector3D Position { get { return BoundingBox.Center; } } /// /// Determines if this structure is empty; meaning it does not contain any meaningful data /// /// public bool IsEmpty() { return TimeStamp == 0; } } }