public void CleanUp() { management = new AlarmManagement(); entityManagement = new EntityManagement(); management.DeleteAll(); entityManagement.DeleteAllEntities(); }
public override void OnPlayerJoined(ulong remoteUserId) { if (!PluginSettings.Instance.DynamicConcealEnabled) { return; } if (HandleUtilityGridsRefresh.RefreshTrack.Contains(remoteUserId)) { HandleUtilityGridsRefresh.RefreshTrack.Remove(remoteUserId); } EntityManagement.SetOnline(remoteUserId, true); if (!PluginSettings.Instance.DynamicConcealEnabled) { return; } if (DateTime.Now - m_lastRevealCheck > TimeSpan.FromSeconds(2)) { EntityManagement.CheckAndRevealEntities( ); m_lastRevealCheck = DateTime.Now; } Essentials.Log.Info("Check Reveal due to: {0}", remoteUserId); base.OnPlayerJoined(remoteUserId); }
public Tracker(EntityManagement.EntityManager entityManager) { this.EntityManager = entityManager; this.Tags = new Birko.TimeTracker.Tracker.Tags(this.EntityManager); this.Tasks = new Birko.TimeTracker.Tracker.Tasks(this.EntityManager); this.Categories = new Birko.TimeTracker.Tracker.Categories(this.EntityManager); }
public void CleanUp() { management = new PhraseManagement(); management.DeleteAllPhrases(); entityManagement = new EntityManagement(); entityManagement.DeleteAllEntities(); authorManagement.EmptyAll(); }
private void FinishLevel(bool isSuccessful) { if (isSuccessful) { } else { EntityManagement.ClearEntities(); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }
public override void OnPlayerWorldSent(ulong remoteUserId) { if (!PluginSettings.Instance.DynamicConcealEnabled) { return; } EntityManagement.CheckAndRevealEntities(); m_lastRevealCheck = DateTime.Now; Logging.WriteLineAndConsole(string.Format("Check Reveal due to: {0}", remoteUserId)); base.OnPlayerWorldSent(remoteUserId); }
public override bool HandleCommand(ulong userId, string[] words) { bool force = words.FirstOrDefault(x => x.ToLower( ) == "force") != null; if (force) { EntityManagement.RevealAll( ); } else { Communication.SendPrivateInformation(userId, $"Command would reveal {EntityManagement.RemovedGrids.Count} grids. Type /admin reveal force to reveal them."); } return(true); }
public void SetUp() { management = new PhraseManagement(); entityManagement = new EntityManagement(); authorManagement = new AuthorManagement(); author = new Author() { UserName = "******", Name = "Joaquin", LastName = "Lamela", BirthDate = new DateTime(2000, 02, 29) }; management.DeleteAllPhrases(); entityManagement.DeleteAllEntities(); authorManagement.EmptyAll(); }
public override void OnPlayerWorldSent(ulong remoteUserId) { EntityManagement.SetOnline(remoteUserId, true); if (!PluginSettings.Instance.DynamicConcealEnabled) { return; } EntityManagement.CheckAndRevealEntities(); m_lastRevealCheck = DateTime.Now; Essentials.Log.Info("Check Reveal due to: {0}", remoteUserId); base.OnPlayerWorldSent(remoteUserId); }
public override bool HandleCommand(ulong userId, string[] words) { if (m_refreshTrack.Contains(userId)) { Communication.SendPrivateInformation(userId, "You may only refresh once per login. Please relog and try again."); return(true); } if (!EntityManagement.ToggleMedbayGrids(userId)) { Communication.SendPrivateInformation(userId, "Unable to refresh grids, server busy."); return(true); } m_refreshTrack.Add(userId); Communication.SendPrivateInformation(userId, "Grids being refreshed ... please wait a moment"); return(true); }
public override void Handle() { if (PluginSettings.Instance.DynamicTurretManagmentEnabled) { if (DateTime.Now - m_lastEnableCheck > TimeSpan.FromSeconds(6)) { EntityManagement.CheckAndEnableTurrets(); m_lastEnableCheck = DateTime.Now; } if (DateTime.Now - m_lastDisableCheck > TimeSpan.FromSeconds(45)) { EntityManagement.CheckAndDisableTurrets(); m_lastDisableCheck = DateTime.Now; } } base.Handle(); }
public override void OnPlayerWorldSent(ulong remoteUserId) { //OnPlayerWorldSent doesn't seem to exist anymore. Doesn't hurt to leave this, though. EntityManagement.SetOnline(remoteUserId, true); if (!PluginSettings.Instance.DynamicConcealEnabled) { return; } if (DateTime.Now - m_lastRevealCheck > TimeSpan.FromSeconds(2)) { EntityManagement.CheckAndRevealEntities( ); m_lastRevealCheck = DateTime.Now; } Essentials.Log.Info("Check Reveal due to: {0}", remoteUserId); base.OnPlayerWorldSent(remoteUserId); }
public override void Handle() { int updateSpeed = PluginSettings.Instance.DynamicConcealUpdateSpeed; //force reveal bypasses the plugin setting. useful to recover grids after you turn it off if (ForceReveal && DateTime.Now - m_lastConcealProcess > TimeSpan.FromMilliseconds(updateSpeed)) { //Essentials.Log.Info( "Process force reveal" ); EntityManagement.ProcessConcealment(true); m_lastConcealProcess = DateTime.Now; } if (!PluginSettings.Instance.DynamicConcealEnabled) { return; } if (DateTime.Now - m_lastConcealCheck > TimeSpan.FromSeconds(30)) { //Essentials.Log.Info("CheckAndConcealEntities"); EntityManagement.CheckAndConcealEntities(); m_lastConcealCheck = DateTime.Now; } if (DateTime.Now - m_lastRevealCheck > TimeSpan.FromSeconds(5)) { //Essentials.Log.Info("CheckAndRevealEntities"); EntityManagement.CheckAndRevealEntities(); m_lastRevealCheck = DateTime.Now; } if (DateTime.Now - m_lastConcealProcess > TimeSpan.FromMilliseconds(updateSpeed)) { //Essentials.Log.Info( "Process concealment" ); EntityManagement.ProcessConcealment( ); m_lastConcealProcess = DateTime.Now; } base.Handle(); }
public override void Handle() { if (!PluginSettings.Instance.DynamicConcealEnabled) { return; } if (DateTime.Now - m_lastConcealCheck > TimeSpan.FromSeconds(30)) { //Log.Info("CheckAndConcealEntities"); EntityManagement.CheckAndConcealEntities(); m_lastConcealCheck = DateTime.Now; } if (DateTime.Now - m_lastRevealCheck > TimeSpan.FromSeconds(5)) { //Log.Info("CheckAndRevealEntities"); EntityManagement.CheckAndRevealEntities(); m_lastRevealCheck = DateTime.Now; } base.Handle(); }
public Tasks(EntityManagement.EntityManager entityManager) { this.EntityManager = entityManager; }
public override void OnPlayerLeft(ulong remoteUserId) { EntityManagement.SetOnline(remoteUserId, false); base.OnPlayerLeft(remoteUserId); }
public Categories(EntityManagement.EntityManager entityManager) { this.EntityManager = entityManager; }
public void SetUp() { management = new EntityManagement(); management.DeleteAllEntities(); }
public override bool HandleCommand(ulong userId, string[] words) { bool showConcealed = !(words.Length > 0 && words[0].ToLower() == "revealed"); if (words.Length > 0 && words[0].ToLower( ) == "force") { EntityManagement.CheckAndConcealEntities( ); return(true); } /* * if ( words.Length > 0 && words[0].ToLower( ) == "dialog" ) * { * //TODO: present entity list in a dialog * return true; * } */ if (showConcealed) { HashSet <MyEntity> entities = new HashSet <MyEntity>(); Wrapper.GameAction(() => { entities = MyEntities.GetEntities(); }); Communication.SendPrivateInformation(userId, "==== Concealed Entities ==="); int count = 0; foreach (MyEntity entity in entities) { if (!EntityManagement.RemovedGrids.Contains(entity.EntityId)) { continue; } MyCubeGrid grid = (MyCubeGrid)entity; long ownerId = 0; string ownerName = ""; if (grid.BigOwners.Count > 0) { ownerId = grid.BigOwners.First(); ownerName = PlayerMap.Instance.GetPlayerNameFromPlayerId(ownerId); } Communication.SendPrivateInformation(userId, string.Format("Id: {0} Display: {1} OwnerId: {2} OwnerName: {3} Position: {4}", entity.EntityId, entity.DisplayName, ownerId, ownerName, General.Vector3DToString(entity.PositionComp.GetPosition()))); count++; } Communication.SendPrivateInformation(userId, string.Format("Total concealed entities: {0}", count)); } else { HashSet <IMyEntity> entities = new HashSet <IMyEntity>(); Wrapper.GameAction(() => { MyAPIGateway.Entities.GetEntities(entities); }); Communication.SendPrivateInformation(userId, "==== Revealed Entities ==="); Communication.SendPrivateInformation(userId, "==== Unconnected Entities ==="); HashSet <IMyEntity> entitiesFound = new HashSet <IMyEntity>(); //CubeGrids.GetGridsUnconnected(entitiesFound, entities); int count = 0; foreach (IMyEntity entity in entitiesFound) { if (!(entity is MyCubeGrid)) { continue; } if (!entity.InScene) { continue; } MyCubeGrid grid = (MyCubeGrid)entity; long ownerId = 0; string ownerName = ""; if (grid.BigOwners.Count > 0) { ownerId = grid.BigOwners.First(); ownerName = PlayerMap.Instance.GetPlayerItemFromPlayerId(ownerId).Name; } if (ownerName == "") { ownerName = "No one"; } Communication.SendPrivateInformation(userId, string.Format("Id: {0} Display: {1} OwnerId: {2} OwnerName: {3} Position: {4} BlockCount: {5}", entity.EntityId, entity.DisplayName, ownerId, ownerName, General.Vector3DToString(entity.GetPosition()), grid.BlocksCount)); count++; } Communication.SendPrivateInformation(userId, string.Format("Total unconnected revealed entities: {0}", count)); Communication.SendPrivateInformation(userId, "==== Connected Entities ==="); var groups = GridGroup.GetAllGroups(GridLinkTypeEnum.Logical); //Console.WriteLine("Here: {0} : {1} {2}", connectedFound.Intersect(entitiesFound).Count(), entitiesFound.Count, connectedFound.Count); count = 0; foreach (var group in groups) { foreach (MyCubeGrid grid in group.Grids) { MyEntity entity = (MyEntity)grid; if (entitiesFound.Contains(entity)) { continue; } if (!entity.InScene) { continue; } if (group.Grids.Count < 2) { continue; } long ownerId = 0; string ownerName = ""; if (grid.BigOwners.Count > 0) { ownerId = grid.BigOwners.First( ); ownerName = PlayerMap.Instance.GetPlayerItemFromPlayerId(ownerId).Name; } if (ownerName == "") { ownerName = "No one"; } Communication.SendPrivateInformation(userId, $"Id: {entity.EntityId} Display: {entity.DisplayName} OwnerId: {ownerId} OwnerName: {ownerName} Position: {grid.PositionComp.GetPosition( )} BlockCount: {grid.BlocksCount} Connections: {@group.Grids.Count}"); //Communication.SendPrivateInformation(userId, string.Format("Id: {0} Display: {1} OwnerId: {2} OwnerName: {3} Position: {4} BlockCount: {5} Connections: {6}", entity.EntityId, entity.DisplayName, ownerId, ownerName, General.Vector3DToString(entity.GetPosition()), slimBlocks.Count)); count++; } } Communication.SendPrivateInformation(userId, string.Format("Total connected revealed entities: {0}", count)); } return(true); }
public override bool HandleCommand(ulong userId, string[] words) { bool showConcealed = true; if (words.Length > 0 && words[0].ToLower() == "revealed") { showConcealed = false; } if (words.Length > 0 && words[0].ToLower( ) == "force") { EntityManagement.CheckAndConcealEntities( ); return(true); } /* * if ( words.Length > 0 && words[0].ToLower( ) == "dialog" ) * { * //TODO: present entity list in a dialog * return true; * } */ if (showConcealed) { HashSet <IMyEntity> entities = new HashSet <IMyEntity>(); Wrapper.GameAction(() => { MyAPIGateway.Entities.GetEntities(entities); }); Communication.SendPrivateInformation(userId, "==== Concealed Entities ==="); int count = 0; foreach (IMyEntity entity in entities) { if (!(entity is IMyCubeGrid)) { continue; } if (entity.InScene) { continue; } IMyCubeGrid grid = (IMyCubeGrid)entity; long ownerId = 0; string ownerName = ""; if (grid.BigOwners.Count > 0) { ownerId = grid.BigOwners.First(); ownerName = PlayerMap.Instance.GetPlayerItemFromPlayerId(ownerId).Name; } if (ownerName == "") { ownerName = "No one"; } Communication.SendPrivateInformation(userId, string.Format("Id: {0} Display: {1} OwnerId: {2} OwnerName: {3} Position: {4}", entity.EntityId, entity.DisplayName, ownerId, ownerName, General.Vector3DToString(entity.GetPosition()))); count++; } Communication.SendPrivateInformation(userId, string.Format("Total concealed entities: {0}", count)); } else { HashSet <IMyEntity> entities = new HashSet <IMyEntity>(); Wrapper.GameAction(() => { MyAPIGateway.Entities.GetEntities(entities); }); Communication.SendPrivateInformation(userId, "==== Revealed Entities ==="); Communication.SendPrivateInformation(userId, "==== Unconnected Entities ==="); HashSet <IMyEntity> entitiesFound = new HashSet <IMyEntity>(); CubeGrids.GetGridsUnconnected(entitiesFound, entities); int count = 0; List <IMySlimBlock> slimBlocks = new List <IMySlimBlock>(); foreach (IMyEntity entity in entitiesFound) { if (!(entity is IMyCubeGrid)) { continue; } if (!entity.InScene) { continue; } IMyCubeGrid grid = (IMyCubeGrid)entity; long ownerId = 0; string ownerName = ""; if (grid.BigOwners.Count > 0) { ownerId = grid.BigOwners.First(); ownerName = PlayerMap.Instance.GetPlayerItemFromPlayerId(ownerId).Name; } if (ownerName == "") { ownerName = "No one"; } grid.GetBlocks(slimBlocks, null); Communication.SendPrivateInformation(userId, string.Format("Id: {0} Display: {1} OwnerId: {2} OwnerName: {3} Position: {4} BlockCount: {5}", entity.EntityId, entity.DisplayName, ownerId, ownerName, General.Vector3DToString(entity.GetPosition()), slimBlocks.Count)); slimBlocks.Clear(); count++; } Communication.SendPrivateInformation(userId, string.Format("Total unconnected revealed entities: {0}", count)); Communication.SendPrivateInformation(userId, "==== Connected Entities ==="); HashSet <IMyEntity> connectedFound = new HashSet <IMyEntity>(); CubeGrids.GetConnectedGrids(connectedFound); Console.WriteLine("Here: {0} : {1} {2}", connectedFound.Intersect(entitiesFound).Count(), entitiesFound.Count, connectedFound.Count); count = 0; slimBlocks.Clear(); foreach (IMyEntity entity in connectedFound) { if (!(entity is IMyCubeGrid)) { continue; } if (entitiesFound.Contains(entity)) { continue; } if (!entity.InScene) { continue; } if (CubeGrids.GetRecursiveGridList((IMyCubeGrid)entity).Count < 2) { continue; } IMyCubeGrid grid = (IMyCubeGrid)entity; long ownerId = 0; string ownerName = ""; if (grid.BigOwners.Count > 0) { ownerId = grid.BigOwners.First(); ownerName = PlayerMap.Instance.GetPlayerItemFromPlayerId(ownerId).Name; } if (ownerName == "") { ownerName = "No one"; } grid.GetBlocks(slimBlocks, null); Communication.SendPrivateInformation(userId, string.Format("Id: {0} Display: {1} OwnerId: {2} OwnerName: {3} Position: {4} BlockCount: {5} Connections: {6}", entity.EntityId, entity.DisplayName, ownerId, ownerName, General.Vector3DToString(entity.GetPosition()), slimBlocks.Count, CubeGrids.GetRecursiveGridList(grid).Count)); //Communication.SendPrivateInformation(userId, string.Format("Id: {0} Display: {1} OwnerId: {2} OwnerName: {3} Position: {4} BlockCount: {5} Connections: {6}", entity.EntityId, entity.DisplayName, ownerId, ownerName, General.Vector3DToString(entity.GetPosition()), slimBlocks.Count)); slimBlocks.Clear(); count++; } Communication.SendPrivateInformation(userId, string.Format("Total connected revealed entities: {0}", count)); } return(true); }
private void Restart() { EntityManagement.ClearEntities(); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
public override bool HandleCommand(ulong userId, string[] words) { bool force = words.FirstOrDefault(x => x.ToLower( ) == "force") != null; bool now = false; if (words.Count( ) > 1 && words[1] == "now") { now = true; } if (force && !now) { EntityManagement.RevealAll( ); } else { HashSet <IMyEntity> entities = new HashSet <IMyEntity>( ); Wrapper.GameAction(() => MyAPIGateway.Entities.GetEntities(entities)); List <MyObjectBuilder_EntityBase> addList = new List <MyObjectBuilder_EntityBase>( ); int count = 0; if (!now) { Wrapper.GameAction(() => { foreach (IMyEntity entity in entities) { if (entity.InScene) { continue; } if (!(entity is IMyCubeGrid)) { continue; } MyObjectBuilder_CubeGrid builder = CubeGrids.SafeGetObjectBuilder((IMyCubeGrid)entity); if (builder == null) { continue; } //if ( now ) // EntityManagement.RevealEntity( new KeyValuePair<IMyEntity, string>( entity, "Immediate force reveal" ) ); count++; } }); } if (now) { Wrapper.GameAction(() => { foreach (IMyEntity entity in entities) { if (entity.InScene) { continue; } if (!(entity is IMyCubeGrid)) { continue; } MyObjectBuilder_CubeGrid builder = CubeGrids.SafeGetObjectBuilder((IMyCubeGrid)entity); if (builder == null) { continue; } count++; IMyCubeGrid grid = (IMyCubeGrid)entity; long ownerId = 0; string ownerName = ""; if (grid.BigOwners.Count > 0) { ownerId = grid.BigOwners.First( ); ownerName = PlayerMap.Instance.GetPlayerItemFromPlayerId(ownerId).Name; } builder.PersistentFlags = (MyPersistentEntityFlags2.InScene | MyPersistentEntityFlags2.CastShadows); MyAPIGateway.Entities.RemapObjectBuilder(builder); //Log.Info("Conceal", string.Format("Force Revealing - Id: {0} -> {4} Display: {1} OwnerId: {2} OwnerName: {3}", entity.EntityId, entity.DisplayName.Replace("\r", "").Replace("\n", ""), ownerId, ownerName, builder.EntityId)); Log.Info("Revealing"); IMyEntity newEntity = MyAPIGateway.Entities.CreateFromObjectBuilder(builder); entity.InScene = true; entity.OnAddedToScene(entity); BaseEntityNetworkManager.BroadcastRemoveEntity(entity, false); MyAPIGateway.Entities.AddEntity(newEntity); MyMultiplayer.ReplicateImmediatelly(MyExternalReplicable.FindByObject(newEntity)); entity.Physics.LinearVelocity = Vector3.Zero; entity.Physics.AngularVelocity = Vector3.Zero; } }); } if (!now) { Log.Info(string.Format("Command would reveal {0} grids. Type /admin reveal force to reveal them.", count)); } else { Log.Info(string.Format("Command revealed {0} grids.", count)); } } return(true); }