Exemple #1
0
 void OnEntityRemoveClicked(MyTrashRemovalOperation operation)
 {
     if (m_attachCamera != null)
     {
         MyMultiplayer.RaiseStaticEvent(x => RemoveEntity_Implementation, m_attachCamera, operation);
     }
 }
Exemple #2
0
        static void RemoveTrash_Implementation(MyTrashRemovalSettings settings, MyTrashRemovalOperation operation)
        {
            if (!MyEventContext.Current.IsLocallyInvoked && !MySession.Static.HasPlayerAdminRights(MyEventContext.Current.Sender.Value))
            {
                MyEventContext.ValidationFailed();
                return;
            }

            MyTrashRemoval.Apply(settings, operation);
        }
Exemple #3
0
        static void RemoveEntity_Implementation(long entityId, MyTrashRemovalOperation operation)
        {
            if (!MyEventContext.Current.IsLocallyInvoked && !MySession.Static.HasPlayerAdminRights(MyEventContext.Current.Sender.Value))
            {
                MyEventContext.ValidationFailed();
                return;
            }

            MyEntity entity;

            if (MyEntities.TryGetEntityById(entityId, out entity))
            {
                MyTrashRemoval.ApplyOperation(entity, operation);
            }
        }
 public static void Apply(MyTrashRemovalSettings settings, MyTrashRemovalOperation operation)
 {
     foreach (var entity in MyEntities.GetEntities())
     {
         // So far removal is applied only to grids
         var grid = entity as MyCubeGrid;
         if (grid != null)
         {
             var keepReason = GetTrashState(grid, settings);
             if (keepReason == MyTrashRemovalFlags.None)
             {
                 ApplyOperation(grid, operation);
             }
         }
     }
 }
 public static void Apply(MyTrashRemovalSettings settings, MyTrashRemovalOperation operation)
 {
     foreach (var entity in MyEntities.GetEntities())
     {
         // So far removal is applied only to grids
         var grid = entity as MyCubeGrid;
         if (grid != null)
         {
             var keepReason = GetTrashState(grid, settings);
             if (keepReason == MyTrashRemovalFlags.None)
             {
                 ApplyOperation(grid, operation);
             }
         }
     }
 }
 public static void ApplyOperation(MyEntity entity, MyTrashRemovalOperation operation)
 {
     if ((operation & MyTrashRemovalOperation.Remove) == MyTrashRemovalOperation.Remove)
     {
         entity.Close();
         return;
     }
     if ((operation & MyTrashRemovalOperation.Stop) == MyTrashRemovalOperation.Stop && entity.Physics != null)
     {
         entity.Physics.LinearVelocity  = Vector3.Zero;
         entity.Physics.AngularVelocity = Vector3.Zero;
     }
     if ((operation & MyTrashRemovalOperation.Depower) == MyTrashRemovalOperation.Depower)
     {
         var grid = entity as MyCubeGrid;
         if (grid != null)
         {
             grid.ChangePowerProducerState(MyMultipleEnabledEnum.AllDisabled, 0);
         }
     }
 }
Exemple #7
0
 void OnTrashRemoveClicked(MyTrashRemovalOperation operation)
 {
     MyMultiplayer.RaiseStaticEvent(x => RemoveTrash_Implementation, MyTrashRemoval.PreviewSettings, operation);
 }
 public static void ApplyOperation(MyEntity entity, MyTrashRemovalOperation operation)
 {
     if ((operation & MyTrashRemovalOperation.Remove) == MyTrashRemovalOperation.Remove)
     {
         entity.Close();
         return;
     }
     if ((operation & MyTrashRemovalOperation.Stop) == MyTrashRemovalOperation.Stop && entity.Physics != null)
     {
         entity.Physics.LinearVelocity = Vector3.Zero;
         entity.Physics.AngularVelocity = Vector3.Zero;
     }
     if ((operation & MyTrashRemovalOperation.Depower) == MyTrashRemovalOperation.Depower)
     {
         var grid = entity as MyCubeGrid;
         if (grid != null)
         {
             grid.ChangePowerProducerState(MyMultipleEnabledEnum.AllDisabled, 0);
         }
     }
 }
        static void RemoveTrash_Implementation(MyTrashRemovalSettings settings, MyTrashRemovalOperation operation)
        {
            if (!MyEventContext.Current.IsLocallyInvoked && !MySession.Static.HasPlayerAdminRights(MyEventContext.Current.Sender.Value))
            {
                MyEventContext.ValidationFailed();
                return;
            }

            MyTrashRemoval.Apply(settings, operation);
        }
 void OnTrashRemoveClicked(MyTrashRemovalOperation operation)
 {
     MyMultiplayer.RaiseStaticEvent(x => RemoveTrash_Implementation, MyTrashRemoval.PreviewSettings, operation);
 }
        static void RemoveEntity_Implementation(long entityId, MyTrashRemovalOperation operation)
        {
            if (!MyEventContext.Current.IsLocallyInvoked && !MySession.Static.HasPlayerAdminRights(MyEventContext.Current.Sender.Value))
            {
                MyEventContext.ValidationFailed();
                return;
            }

            MyEntity entity;
            if (MyEntities.TryGetEntityById(entityId, out entity))
                MyTrashRemoval.ApplyOperation(entity, operation);
        }
 void OnEntityRemoveClicked(MyTrashRemovalOperation operation)
 {
     if (m_attachCamera != null)
     {
         MyMultiplayer.RaiseStaticEvent(x => RemoveEntity_Implementation, m_attachCamera, operation);
     }
 }