예제 #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);
     }
 }
예제 #2
0
 public static void Clean()
 {
     Session               = null;
     Entities              = null;
     Players               = null;
     CubeBuilder           = null;
     TerminalActionsHelper = null;
     Utilities             = null;
     Parallel              = null;
     Multiplayer           = null;
     PrefabManager         = null;
 }
예제 #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);
        }
예제 #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;
 }
예제 #5
0
 public MyEntitiesRepository(IMyEntities context)
 {
     this.Context = context;
 }
예제 #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;
 }
예제 #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);
 }
예제 #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));
 }
예제 #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));
 }
 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;
 }