Ejemplo n.º 1
0
 /// <remarks>I have not tested IsInsideVoxel for thread-safety, I assumed it is not.</remarks>
 public static bool RayCastVoxel(this IMyEntities entities, Vector3 from, Vector3 to, out Vector3 boundary)
 {
     using (Lock_MainThread.AcquireSharedUsing())
     {
         entities.IsInsideVoxel(from, to, out boundary);
         return(boundary != from);
     }
 }
Ejemplo n.º 2
0
 public static void Clean()
 {
     Session               = null;
     Entities              = null;
     Players               = null;
     CubeBuilder           = null;
     TerminalActionsHelper = null;
     Utilities             = null;
     Parallel              = null;
     Multiplayer           = null;
     PrefabManager         = null;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// <para>Uses IMyEntities.GetEntities to get entities in AABB</para>
        /// <para>Always use over GetEntitiesInAABB_Safe() when blocks are not needed, much faster.</para>
        /// </summary>
        /// <param name="preCollect">applied before intersection test</param>
        public static void GetEntitiesInAABB_Safe_NoBlock(this IMyEntities entitiesObject, BoundingBoxD boundingBox, HashSet <IMyEntity> entities, Func <IMyEntity, bool> preCollect = null)
        {
            Func <IMyEntity, bool> collector;

            if (preCollect == null)
            {
                collector = (entity) => boundingBox.Intersects(entity.WorldAABB);
            }
            else
            {
                collector = (entity) => { return(preCollect(entity) && boundingBox.Intersects(entity.WorldAABB)); }
            };
            entitiesObject.GetEntities_Safe(entities, collector);
        }
Ejemplo n.º 4
0
 public static void Clean()
 {
     Session     = null;
     Entities    = null;
     Players     = null;
     CubeBuilder = null;
     if (IngameScripting != null)
     {
         IngameScripting.Clean();
     }
     IngameScripting       = null;
     TerminalActionsHelper = null;
     Utilities             = null;
     Parallel         = null;
     Physics          = null;
     Multiplayer      = null;
     PrefabManager    = null;
     Input            = null;
     TerminalControls = null;
 }
Ejemplo n.º 5
0
 public MyEntitiesRepository(IMyEntities context)
 {
     this.Context = context;
 }
Ejemplo n.º 6
0
 public static void Clean()
 {
     Session = null;
     Entities = null;
     Players = null;
     CubeBuilder = null;
     TerminalActionsHelper = null;
     Utilities = null;
     Parallel = null;
     Multiplayer = null;
     PrefabManager = null;
     Input = null;
 }
Ejemplo n.º 7
0
 public static void GetEntities_Safe(this IMyEntities entitiesObject, HashSet <IMyEntity> entities, Func <IMyEntity, bool> collect = null)
 {
     using (Lock_MainThread.AcquireSharedUsing())
         entitiesObject.GetEntities(entities, collect);
 }
Ejemplo n.º 8
0
 /// <summary>Consider using GetEntitiesInSphere_Safe_NoBlock instead.</summary>
 public static List <IMyEntity> GetEntitiesInSphere_Safe(this IMyEntities entitiesObject, ref BoundingSphereD boundingSphere)
 {
     using (Lock_MainThread.AcquireSharedUsing())
         return(entitiesObject.GetEntitiesInSphere(ref boundingSphere));
 }
Ejemplo n.º 9
0
 /// <summary>Consider using GetEntitiesInAABB_Safe_NoBlock instead.</summary>
 public static List <IMyEntity> GetEntitiesInAABB_Safe(this IMyEntities entitiesObject, ref BoundingBoxD boundingBox)
 {
     using (Lock_MainThread.AcquireSharedUsing())
         return(entitiesObject.GetEntitiesInAABB(ref boundingBox));
 }
Ejemplo n.º 10
0
 public static void Clean()
 {
     Session = null;
     Entities = null;
     Players = null;
     CubeBuilder = null;
     if (IngameScripting != null)
     {
         IngameScripting.Clean();
     }
     IngameScripting = null;
     TerminalActionsHelper = null;
     Utilities = null;
     Parallel = null;
     Physics = null;
     Multiplayer = null;
     PrefabManager = null;
     Input = null;
     TerminalControls = null;
 }