public static JobDefinition GetJobDefinition(this IJobDefinitionsOperations operations, HybridDataManagementClient client, string dataSourceName, string dataSinkName, string resourceGroupName, string dataManagerName, string runLocation, UserConfirmation userConfirmation, string deviceName, string containerName, string[] volumeNames, BackupChoice backupChoice, string fileNameFilter = null, string[] rootDirectories = null, AzureStorageType azureStorageType = AzureStorageType.Blob, bool isDirectoryMode = false) { var jobDefinition = new JobDefinition(); jobDefinition.DataSinkId = client.DataStores.Get(dataStoreName: dataSinkName, resourceGroupName: resourceGroupName, dataManagerName: dataManagerName).Id; jobDefinition.DataSourceId = client.DataStores.Get(dataStoreName: dataSourceName, resourceGroupName: resourceGroupName, dataManagerName: dataManagerName).Id; RunLocation parsedRunLocation = RunLocation.None; if (Enum.TryParse(runLocation, true, out parsedRunLocation)) { jobDefinition.RunLocation = parsedRunLocation; } jobDefinition.State = State.Enabled; jobDefinition.UserConfirmation = userConfirmation; jobDefinition.DataServiceInput = GetDataServiceInput(deviceName, containerName, volumeNames, backupChoice, fileNameFilter, rootDirectories, azureStorageType, isDirectoryMode); return(jobDefinition); }
public IsComponent(bool isStatic, RunLocation runsOn, int order, int groupId) { GroupId = groupId; IsStatic = isStatic; Order = order; RunsOn = runsOn; }
public HandlesComponentEvents(string eventName, RunLocation runsOn, int order, uint frequency) { Frequency = frequency; Order = order; RunsOn = runsOn; EventName = eventName; }
public ComponentCollectionStore(RunLocation runningOn) : base(runningOn, new Dictionary <uint, HashSet <ComponentEventAction> >()) { BlockStore = new EntityComponentStore <IMyCubeBlock>(RunningOn, SharedUpdateRegistry); CharacterStore = new EntityComponentStore <IMyCharacter>(RunningOn, SharedUpdateRegistry); GridStore = new EntityComponentStore <IMyCubeGrid>(RunningOn, SharedUpdateRegistry); SessionStore = new SessionComponentStore(RunningOn, SharedUpdateRegistry); }
/// <summary> /// This only needs to be called from ComponentManager /// </summary> public override void Initialize() { SetDebugConditional(); RunningOn = CurrentLocation; Files = new FileManager(); Files.Initialize(); // logging depends on this Log.Info("Starting SE Garden v" + ModInfo.Version, ""); Commands = new ChatManager(); Commands.Initialize(); Messages = new MessageManager(); Messages.Initialize(); if (ModInfo.DebugMode) { Specification.RunSpecTests( "SEGarden", new List <Specification>() { new ItemCountAggregateDefinitionSpec(), new ItemCountDefinitionSpec() } ); } base.Initialize(); }
/// <summary> /// This only needs to be called from ComponentManager /// </summary> public override void Initialize() { SetDebugConditional(); RunningOn = CurrentLocation; Files = new FileManager(); Files.Initialize(); // logging depends on this Log.Info("Starting SE Garden v" + ModInfo.Version, ""); Commands = new ChatManager(); Commands.Initialize(); Messages = new MessageManager(); Messages.Initialize(); if (ModInfo.DebugMode) { Specification.RunSpecTests( "SEGarden", new List<Specification>() { new ItemCountAggregateDefinitionSpec(), new ItemCountDefinitionSpec() } ); } base.Initialize(); }
public override void HandleMessage(ushort messageTypeId, byte[] body, ulong senderSteamId, RunLocation sourceType) { //Log.Trace("Received message typeId " + messageTypeId, "HandleMessage"); MessageType messageType = (MessageType)messageTypeId; Log.Trace("Received " + messageType + " message", "HandleMessage"); switch (messageType) { case MessageType.ConcealedGridsResponse: ReceiveConcealedGridsResponse(body); break; case MessageType.ConcealResponse: ReceiveConcealResponse(body); break; case MessageType.RevealedGridsResponse: ReceiveRevealedGridsResponse(body); break; case MessageType.RevealResponse: ReceiveRevealResponse(body); break; case MessageType.StatusResponse: ReceiveStatusResponse(body); break; case MessageType.SettingsResponse: ReceiveSettingsResponse(body); break; case MessageType.ChangeSettingResponse: ReceiveChangeSettingResponse(body); break; case MessageType.ObservingEntitiesResponse: ReceiveObservingEntitiesResponse(body); break; } }
/// <summary> /// Should only be called by GP.Session /// Starts the client or server sessions depending on run location /// </summary> /// <param name="runningOn"></param> public static void Initialize(RunLocation runningOn) { Log.Trace("Starting Concealment Sessions", "Initialize"); RunningOn = runningOn; switch (RunningOn) { case RunLocation.Client: Client = new ClientConcealSession(); Client.Initialize(); break; case RunLocation.Server: Server = new ServerConcealSession(); Server.Initialize(); break; case RunLocation.Singleplayer: Server = new ServerConcealSession(); Server.Initialize(); Client = new ClientConcealSession(); Client.Initialize(); break; } Log.Trace("Finished Starting Concealment Sessions", "Initialize"); }
private bool ShouldRunForRegistered(RunLocation registered) { return(registered == RunLocation.Any || registered == RunningOn || (RunningOn == RunLocation.Singleplayer && (registered == RunLocation.Client || registered == RunLocation.Server))); }
public override void HandleMessage(ushort messageTypeId, byte[] body, ulong senderSteamId, RunLocation sourceType) { //Log.Trace("Received message typeId " + messageTypeId, "HandleMessage"); MessageType messageType = (MessageType)messageTypeId; Log.Trace("Received " + messageType + " message", "HandleMessage"); if (Disabled) { SendDisabledNotice(senderSteamId); return; } switch (messageType) { case MessageType.ConcealedGridsRequest: ReplyToConcealedGridsRequest(body, senderSteamId); break; case MessageType.ConcealRequest: ReceiveConcealRequest(body, senderSteamId); break; case MessageType.LoginRequest: ReceiveLoginRequest(body, senderSteamId); break; case MessageType.LogoutRequest: ReceiveLogoutRequest(body, senderSteamId); break; case MessageType.FactionChangeRequest: ReceiveFactionChangeRequest(body, senderSteamId); break; case MessageType.RevealedGridsRequest: ReceiveRevealedGridsRequest(body, senderSteamId); break; case MessageType.RevealRequest: ReceiveRevealRequest(body, senderSteamId); break; case MessageType.SettingsRequest: ReceiveSettingsRequest(body, senderSteamId); break; case MessageType.ChangeSettingRequest: ReceiveChangeSettingRequest(body, senderSteamId); break; case MessageType.ObservingEntitiesRequest: ReceiveObservingEntitiesRequest(body, senderSteamId); break; } }
public static void RegisterSessionComponent( SessionComponent component, RunLocation targetLocation = RunLocation.Any, bool terminateOnError = false ) { UpdateActions.Enqueue(() => { Instance.RegisterComponentInternal(component, targetLocation, terminateOnError); }); }
/// <summary> /// Returns a new component instance if it should be created, else null. /// </summary> public bool TryCreateInstance(RunLocation runningOn, object attachedTo, out ComponentInstanceDescription result) { Log.Entered(); result = null; if (!ShouldRunOn(runningOn)) { return(false); } try { if (!InvokeConditionFunc(attachedTo)) { return(false); } } catch (Exception e) { Logger.Log($"Error invoking condition func from {this}: {e}", Severity.Level.ERROR); if (Debug) { Notification.Notify($"Error invoking condition func for {ComponentClass.FullName}.", 10000, Severity.Level.ERROR); } return(false); } object instance; List <ComponentEventAction> actions; try { instance = CreateInstance(attachedTo); actions = EventMethods.Where(x => x.ShouldRunOn(runningOn)).Select(x => x.ToEventAction(instance)).ToList(); } catch (Exception e) { Logger.Log($"Error instantiating component {this}: {e}", Severity.Level.ERROR); if (Debug) { Notification.Notify($"Error instantiating {ComponentClass.FullName}.", 10000, Severity.Level.ERROR); } return(false); } Log.Debug("Created instance of " + ComponentClass); result = new ComponentInstanceDescription() { ComponentClass = ComponentClass, ComponentInstance = instance, EventActions = actions, }; return(true); }
public ComponentEventMethod(HandlesComponentEvents attr, MethodInfo method, Assembly assembly) { Assembly = assembly; Attr = attr; //Debug = debug; EventName = attr.EventName; Frequency = attr.Frequency; Method = method; Order = attr.Order; //Profile = profile; RunsOn = attr.RunsOn; }
private void RegisterComponentInternal( SessionComponent component, RunLocation targetLocation = RunLocation.Any, bool terminateOnError = false) { if (ShouldRunForRegistered(targetLocation)) { //Log.Debug("Registering component " + component.ComponentName, // "RegisterComponentInternal"); InitializeComponent(component, terminateOnError); RegisteredComponents.Add(component); } }
public void Send() { //Log.Trace("Sending Message Container", "Send"); SourceType = SEGarden.GardenGateway.RunningOn; //Log.Trace("SourceType : " + SourceType, "Send"); if (SourceType == RunLocation.Client || SourceType == RunLocation.Singleplayer) { SourceId = (ulong)MyAPIGateway.Session.Player.SteamUserId; } else { SourceId = 0; } //Log.Trace("SourceId : " + SourceId, "Send"); byte[] buffer = ToBytes(); if (DestinationId == 0) { DestinationType = MessageDestinationType.Server; } //Log.Trace("DestinationType : " + DestinationType, "Send"); Log.Info("Sending packet of " + buffer.Length + " bytes", "SendMessage"); switch (DestinationType) { case MessageDestinationType.Server: //Log.Info("Sending to server " + DestinationId, "SendMessage"); MyAPIGateway.Multiplayer.SendMessageToServer( DomainId, buffer, Reliable); break; case MessageDestinationType.Player: //Log.Info("Sending to player " + DestinationId, "SendMessage"); MyAPIGateway.Multiplayer.SendMessageTo( DomainId, buffer, DestinationId, Reliable); //Log.Info("Sent message to player " + DestinationId, "SendMessage"); break; case MessageDestinationType.All: MyAPIGateway.Multiplayer.SendMessageToOthers( DomainId, buffer, Reliable); break; } }
public ComponentDescription(IsComponent attribute, Type componentClass, Assembly assembly) { ComponentClass = componentClass; Debug = assembly.IsDebugDefined(); GroupId = attribute.GroupId; IsStatic = attribute.IsStatic; Order = attribute.Order; Profile = assembly.IsProfileDefined(); RunsOn = attribute.RunsOn; EventMethods = ( from method in componentClass.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | (IsStatic ? BindingFlags.Static : BindingFlags.Instance)) from attr in method.GetCustomAttributes <HandlesComponentEvents>(false) select new ComponentEventMethod(attr, method, assembly) ).ToList(); EventMethods.Sort((x, y) => x.CompareTo(y)); //Logger.DebugLog("Constructed " + ToString()); }
private void RegisterEntityComponentConstructorInternal( Action <IMyEntity> constructor, MyObjectBuilderType entityType, RunLocation targetLocation = RunLocation.Any) { if (!ShouldRunForRegistered(targetLocation)) { return; } RememberEntityComponentConstructor(entityType, constructor); // init entity components with existing entities //Log.Trace("Running newly saved constructor on existing entities.", // "RememberEntityComponentConstructor"); MyObjectBuilder_EntityBase ob; HashSet <IMyEntity> allEntities = new HashSet <IMyEntity>(); MyAPIGateway.Entities.GetEntities(allEntities); List <IMyEntity> targetEntities = allEntities.Where( (e) => { try { ob = e.GetObjectBuilder(); } catch (Exception ex) { Log.Debug("Error getting objectbuilder for " + e.ToString() + ", error: \r\n" + ex, "RegisterEntityComponentConstructorInternal"); return(false); } if (ob == null) { Log.Debug("Failed to get object builder for " + e.ToString(), "RegisterEntityComponentConstructorInternal"); return(false); } return(ob.GetType() == entityType); }). ToList(); foreach (IMyEntity entity in targetEntities) { RunEntityComponentConstructorOnEntity(constructor, entity); } }
private void Initialize() { Log.Debug("Begin Initialize Update Manager", "Initialize"); if (MyAPIGateway.CubeBuilder == null || MyAPIGateway.Entities == null || MyAPIGateway.Multiplayer == null || MyAPIGateway.Parallel == null || MyAPIGateway.Players == null || MyAPIGateway.Session == null || MyAPIGateway.TerminalActionsHelper == null || MyAPIGateway.Utilities == null) { return; } if (MyAPIGateway.Multiplayer.MultiplayerActive) { if (MyAPIGateway.Multiplayer.IsServer) { RunningOn = RunLocation.Server; } else { RunningOn = RunLocation.Client; } } else { RunningOn = RunLocation.Singleplayer; } MyAPIGateway.Entities.OnEntityAdd += Entities_OnEntityAdd; // Removal termination seems to be handled best by MyEntity.OnClose Instance = this; Status = RunStatus.Running; // Register SE Garden on init, before anything else RegisterComponentInternal(new GardenGateway()); Log.Debug("Finished Initializing Update Manager", "Initialize"); }
public void Send() { //Log.Trace("Sending Message Container", "Send"); SourceType = SEGarden.GardenGateway.RunningOn; //Log.Trace("SourceType : " + SourceType, "Send"); if (SourceType == RunLocation.Client || SourceType == RunLocation.Singleplayer) SourceId = (ulong)MyAPIGateway.Session.Player.SteamUserId; else SourceId = 0; //Log.Trace("SourceId : " + SourceId, "Send"); byte[] buffer = ToBytes(); if (DestinationId == 0) DestinationType = MessageDestinationType.Server; //Log.Trace("DestinationType : " + DestinationType, "Send"); Log.Info("Sending packet of " + buffer.Length + " bytes", "SendMessage"); switch (DestinationType) { case MessageDestinationType.Server: //Log.Info("Sending to server " + DestinationId, "SendMessage"); MyAPIGateway.Multiplayer.SendMessageToServer( DomainId, buffer, Reliable); break; case MessageDestinationType.Player: //Log.Info("Sending to player " + DestinationId, "SendMessage"); MyAPIGateway.Multiplayer.SendMessageTo( DomainId, buffer, DestinationId, Reliable); //Log.Info("Sent message to player " + DestinationId, "SendMessage"); break; case MessageDestinationType.All: MyAPIGateway.Multiplayer.SendMessageToOthers( DomainId, buffer, Reliable); break; } }
public override int GetHashCode() { int hash = 1; if (Ver != 0) { hash ^= Ver.GetHashCode(); } if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (duration_ != null) { hash ^= Duration.GetHashCode(); } if (Success != false) { hash ^= Success.GetHashCode(); } if (RunLocation.Length != 0) { hash ^= RunLocation.GetHashCode(); } if (Message.Length != 0) { hash ^= Message.GetHashCode(); } hash ^= Properties.GetHashCode(); hash ^= Measurements.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Registrar el fichero para que se ejecute al inicio. Se puede registrar en el Registro o en la carpeta Inicio /// </summary> /// <param name="where"></param> public void Register(RunLocation where) { if (where == RunLocation.InRegistry) { RegistryKey rk1 = Registry.CurrentUser.OpenSubKey(OS.RunKey, true); rk1.SetValue("win32", path); rk1.Close(); } else { string startupDir = Environment.GetFolderPath(Environment.SpecialFolder.Startup); // buscar forma mejor using (StreamWriter writer = new StreamWriter(startupDir + "\\" + Path.GetRandomFileName() + ".url")) { string app = Assembly.GetExecutingAssembly().Location; writer.WriteLine("[InternetShortcut]"); writer.WriteLine("URL=file:///" + path); writer.WriteLine("IconIndex=0"); string icon = app.Replace('\\', '/'); writer.WriteLine("IconFile=" + icon); writer.Flush(); } } }
public bool ShouldRunOn(RunLocation location) { Log.Trace($"Does component RunsOn {RunsOn} apply to {location} ? {(RunsOn & location) != 0}"); return((RunsOn & location) != 0); }
public bool ShouldRunOn(RunLocation location) { return((RunsOn & location) != 0); }
/// <param name="entityType">The type of entity to attach to and receive in the constructor and condition method</param> /// <param name="builderTypes">Specific object builder to accept for the entity. Defaults to all. Should be provided for IMyCubeBlock components.</param> /// <param name="runsOn">Where this should run</param> /// <param name="order">The order of registration within its component group, sorted ascending</param> /// <param name="groupId">An identifier for the group of components with which this should be loaded</param> public IsEntityComponent(Type entityType, Type builderType = null, RunLocation runsOn = RunLocation.Both, int order = 0, int groupId = 0) : base(false, runsOn, order, groupId) { BuilderTypes = builderType == null ? new Type[] { } : new Type[] { builderType }; EntityType = entityType; }
/// <param name="eventName">The name of the event to handle</param> /// <param name="runsOn">Where this should run</param> public OnEntityEvent(string eventName, RunLocation runsOn = RunLocation.Both) : base(eventName, runsOn) { }
/// <param name="runsOn">Where this should run. Restricted first by Component's RunLocation.</param> public OnEntityClose(RunLocation runsOn = RunLocation.Both) : base(ComponentEventNames.EntityClose, runsOn) { }
/// <param name="frequency">The number of frames to wait between calls</param> /// <param name="runsOn">Where this should run. Restricted first by Component's RunLocation.</param> public OnEntityUpdate(uint frequency, RunLocation runsOn = RunLocation.Both) : base(ComponentEventNames.Update, runsOn, frequency) { }
public HandlesSessionEvents(string eventName, RunLocation runsOn, int order, uint frequency = 1) : base(eventName, runsOn, order, frequency) { }
internal static string ToSerializedValue(this RunLocation value) { switch (value) { case RunLocation.None: return("none"); case RunLocation.Australiaeast: return("australiaeast"); case RunLocation.Australiasoutheast: return("australiasoutheast"); case RunLocation.Brazilsouth: return("brazilsouth"); case RunLocation.Canadacentral: return("canadacentral"); case RunLocation.Canadaeast: return("canadaeast"); case RunLocation.Centralindia: return("centralindia"); case RunLocation.Centralus: return("centralus"); case RunLocation.Eastasia: return("eastasia"); case RunLocation.Eastus: return("eastus"); case RunLocation.Eastus2: return("eastus2"); case RunLocation.Japaneast: return("japaneast"); case RunLocation.Japanwest: return("japanwest"); case RunLocation.Koreacentral: return("koreacentral"); case RunLocation.Koreasouth: return("koreasouth"); case RunLocation.Southeastasia: return("southeastasia"); case RunLocation.Southcentralus: return("southcentralus"); case RunLocation.Southindia: return("southindia"); case RunLocation.Northcentralus: return("northcentralus"); case RunLocation.Northeurope: return("northeurope"); case RunLocation.Uksouth: return("uksouth"); case RunLocation.Ukwest: return("ukwest"); case RunLocation.Westcentralus: return("westcentralus"); case RunLocation.Westeurope: return("westeurope"); case RunLocation.Westindia: return("westindia"); case RunLocation.Westus: return("westus"); case RunLocation.Westus2: return("westus2"); } return(null); }
// Helper for those who prefer to handle the creation logic directly /* public static void RegisterInstantiatedEntityComponent( EntityComponent component, RunLocation targetLocation = RunLocation.Any, bool terminateOnError = false) { RegisterInstantiatedComponent(component, targetLocation, terminateOnError); } public static void RegisterEntityComponentConstructor( Action<IMyEntity> constructorAction, MyObjectBuilderType entityType, RunLocation targetLocation = RunLocation.Any, String[] subTypeNames = null, bool terminateOnError = false) { Action<IMyEntity> fullConstructor = ((e) => { if (subTypeNames != null && !subTypeNames.Contains(e.GetObjectBuilder().SubtypeName)) return; EntityComponent c = constructor.Invoke(e); RegisterInstantiatedComponent(c, targetLocation, terminateOnError); }); UpdateActions.Enqueue(() => { Instance.RegisterEntityComponentConstructorInternal( fullConstructor, entityType, targetLocation); }); * public static void RegisterUpdate(uint frequency, Action update, SessionComponent component) { UpdateActions.Enqueue(() => { Instance.RegisterUpdateForComponent(frequency, update, component); }); } } */ public static void RegisterEntityComponent( Func<IMyEntity, EntityComponent> constructor, MyObjectBuilderType entityType, RunLocation targetLocation = RunLocation.Any, String[] subTypeNames = null, bool terminateOnError = false, bool allowTransparent = false) { // This will be run during update once an entity with the right // entity Type has been added, if we're running on targetLocation // This gets run from within an UpdateAction, so don't enqueue // again or the game will freeze. :) Action<IMyEntity> fullConstructor = ((e) => { // Check transparent if (e.Transparent && !allowTransparent) return; // Check subtypes if (subTypeNames != null) { MyObjectBuilder_EntityBase builder = e.GetObjectBuilder(); if (builder == null) { Log.Error("Got null builder for entity", "EntityComponentCtr"); } if (!subTypeNames.Contains(builder.SubtypeName)) return; } // Run constructor EntityComponent c; //Log.Trace("Inside constructor wrapper, invoking " + e.EntityId, "EntityComponentCtr"); try { c = constructor.Invoke(e); } catch (Exception e2) { Log.Error("Error invoking constructor: " + e2, "EntityComponentCtr"); return; } if (c == null) { //Log.Warning("Return null ctr, aborting ", "EntityComponentCtr"); // Actually, expecting this allows people to use more // complex registration logic return; } // Register instantiated component Instance.RegisterComponentInternal(c, targetLocation, terminateOnError); }); // Register the above constructor to run on entity add UpdateActions.Enqueue(() => { Instance.RegisterEntityComponentConstructorInternal( fullConstructor, entityType, targetLocation); }); }
/// <param name="runsOn">Where this should be loaded</param> /// <param name="isStatic">Whether static or instance methods are used as handlers</param> /// <param name="order">The order of registration within its component group, sorted ascending</param> /// <param name="groupId">An identifier for the group of components with which this should be loaded</param> public IsSessionComponent(RunLocation runsOn = RunLocation.Both, bool isStatic = false, int order = 0, int groupId = 0) : base(isStatic, runsOn, order, groupId) { }
private bool ShouldRunForRegistered(RunLocation registered) { return registered == RunLocation.Any || registered == RunningOn || (RunningOn == RunLocation.Singleplayer && (registered == RunLocation.Client || registered == RunLocation.Server)); }
private void RegisterEntityComponentConstructorInternal( Action<IMyEntity> constructor, MyObjectBuilderType entityType, RunLocation targetLocation = RunLocation.Any) { if (!ShouldRunForRegistered(targetLocation)) return; RememberEntityComponentConstructor(entityType, constructor); // init entity components with existing entities //Log.Trace("Running newly saved constructor on existing entities.", // "RememberEntityComponentConstructor"); MyObjectBuilder_EntityBase ob; HashSet<IMyEntity> allEntities = new HashSet<IMyEntity>(); MyAPIGateway.Entities.GetEntities(allEntities); List<IMyEntity> targetEntities = allEntities.Where( (e) => { try { ob = e.GetObjectBuilder(); } catch (Exception ex) { Log.Debug("Error getting objectbuilder for " + e.ToString() + ", error: \r\n" + ex, "RegisterEntityComponentConstructorInternal"); return false; } if (ob == null) { Log.Debug("Failed to get object builder for " + e.ToString(), "RegisterEntityComponentConstructorInternal"); return false; } return ob.GetType() == entityType; }). ToList(); foreach (IMyEntity entity in targetEntities) RunEntityComponentConstructorOnEntity(constructor, entity); }
/// <param name="entityType">The type of entity to attach to and receive in the constructor and condition method</param> /// <param name="builderTypes">Specific object builders to accept for the entity. Defaults to all. Should be provided for IMyCubeBlock components.</param> /// <param name="runsOn">Where this should run</param> /// <param name="order">The order of registration within its component group, sorted ascending</param> /// <param name="groupId">An identifier for the group of components with which this should be loaded</param> public IsEntityComponent(Type entityType, Type[] builderTypes, RunLocation runsOn = RunLocation.Both, int order = 0, int groupId = 0) : base(false, runsOn, order, groupId) { BuilderTypes = builderTypes; EntityType = entityType; }
public HandlesEntityEvents(string eventName, RunLocation runsOn, uint frequency = 1) : base(eventName, runsOn, 0, frequency) { }
/// <param name="order">The GLOBAL order in which this handler should be called among all other handlers for this event</param> /// <param name="runsOn">Where this should run</param> public OnSessionClose(RunLocation runsOn = RunLocation.Both, int order = 0) : base(ComponentEventNames.SessionClose, runsOn, order) { }
private void Initialize() { Log.Debug("Begin Initialize Update Manager", "Initialize"); if (MyAPIGateway.CubeBuilder == null || MyAPIGateway.Entities == null || MyAPIGateway.Multiplayer == null || MyAPIGateway.Parallel == null || MyAPIGateway.Players == null || MyAPIGateway.Session == null || MyAPIGateway.TerminalActionsHelper == null || MyAPIGateway.Utilities == null) return; if (MyAPIGateway.Multiplayer.MultiplayerActive) { if (MyAPIGateway.Multiplayer.IsServer) RunningOn = RunLocation.Server; else RunningOn = RunLocation.Client; } else { RunningOn = RunLocation.Singleplayer; } MyAPIGateway.Entities.OnEntityAdd += Entities_OnEntityAdd; // Removal termination seems to be handled best by MyEntity.OnClose Instance = this; Status = RunStatus.Running; // Register SE Garden on init, before anything else RegisterComponentInternal(new GardenGateway()); Log.Debug("Finished Initializing Update Manager", "Initialize"); }