static void CycleRequest_Implementation(MyEntityCyclingOrder order, bool reset, bool findLarger, float metricValue, long currentEntityId, CyclingOptions options) { if (reset) { metricValue = float.MinValue; currentEntityId = 0; findLarger = false; } MyEntityCycling.FindNext(order, ref metricValue, ref currentEntityId, findLarger, options); var e = MyEntities.GetEntityByIdOrDefault(currentEntityId); Vector3D pos = e != null ? e.WorldMatrix.Translation : Vector3D.Zero; if (MyEventContext.Current.IsLocallyInvoked) { Cycle_Implementation(metricValue, currentEntityId, pos); } else { var proxy = e as IMyEventProxy; if (proxy != null) { if (proxy is MyCubeGrid && (proxy as MyCubeGrid).Physics == null) { //don't send grids without physics } else { MyMultiplayer.ReplicateImmediatelly(proxy, MyEventContext.Current.Sender); } } MyMultiplayer.RaiseStaticEvent(x => Cycle_Implementation, metricValue, currentEntityId, pos, MyEventContext.Current.Sender); } }
static void CycleRequest_Implementation(MyEntityCyclingOrder order, bool reset, bool findLarger, float metricValue, long currentEntityId,CyclingOptions options) { if (reset) { metricValue = float.MinValue; currentEntityId = 0; findLarger = false; } MyEntityCycling.FindNext(order, ref metricValue, ref currentEntityId, findLarger, options); var e = MyEntities.GetEntityByIdOrDefault(currentEntityId); Vector3D pos = e != null ? e.WorldMatrix.Translation : Vector3D.Zero; if (MyEventContext.Current.IsLocallyInvoked) { Cycle_Implementation(metricValue, currentEntityId, pos); } else { var proxy = e as IMyEventProxy; if (proxy != null) { if (proxy is MyCubeGrid && (proxy as MyCubeGrid).Physics == null) { //don't send grids without physics } else { MyMultiplayer.ReplicateImmediatelly(proxy, MyEventContext.Current.Sender); } } MyMultiplayer.RaiseStaticEvent(x => Cycle_Implementation, metricValue, currentEntityId, pos, MyEventContext.Current.Sender); } }