public void initialize() { if (Dedicator.isDedicated) { rocketGameObject = new GameObject("Rocket"); DontDestroyOnLoad(rocketGameObject); if (System.Environment.OSVersion.Platform == PlatformID.Unix || System.Environment.OSVersion.Platform == PlatformID.MacOSX) #pragma warning disable CS0618 { Console = rocketGameObject.AddComponent <UnturnedConsole>(); } #pragma warning restore CS0618 CommandWindow.Log("Rocket Unturned v" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " for Unturned v" + Provider.APP_VERSION); IPluginAdvertising pluginAdvertising = PluginAdvertising.Get(); pluginAdvertising.PluginFrameworkName = "rocket"; R.OnRockedInitialized += () => { Instance.Initialize(); }; Provider.onServerHosted += () => { rocketGameObject.TryAddComponent <U>(); rocketGameObject.TryAddComponent <R>(); }; } }
private void BroadcastPlugins() { var pluginAdvertising = PluginAdvertising.Get(); pluginAdvertising.PluginFrameworkName = "openmod"; pluginAdvertising.AddPlugins(from plugin in m_PluginActivator.ActivatedPlugins where plugin.IsComponentAlive select plugin.DisplayName); }
Task IEventListener <PluginLoadedEvent> .HandleEventAsync(object?sender, PluginLoadedEvent @event) { var advertisePlugins = m_UnturnedConfiguration.Configuration.GetSection("advertisePlugins").Get <bool>(); if (advertisePlugins) { PluginAdvertising.Get().AddPlugin(@event.Plugin.DisplayName); } return(Task.CompletedTask); }
public OpenModPluginsBroadcaster(IPluginActivator pluginActivator) { var pluginAdvertising = PluginAdvertising.Get(); pluginAdvertising.PluginFrameworkName = "openmod"; pluginAdvertising.AddPlugins( from plugin in pluginActivator.ActivatedPlugins where plugin.IsComponentAlive select plugin.DisplayName); }
public OpenModPluginsBroadcaster( IPluginActivator pluginActivator, IOpenModUnturnedConfiguration unturnedConfiguration) { m_UnturnedConfiguration = unturnedConfiguration; var pluginAdvertising = PluginAdvertising.Get(); pluginAdvertising.PluginFrameworkName = "openmod"; pluginAdvertising.AddPlugins( from plugin in pluginActivator.ActivatedPlugins where plugin.IsComponentAlive select plugin.DisplayName); }
internal static void Init() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => { if (Libraries.TryGetValue(args.Name, out var file)) { return(Assembly.LoadFrom(file)); } Logger.LogError($"Could not find dependency: {args.Name}"); return(null); }; RegisterPlugins(); var advertising = PluginAdvertising.Get(); advertising.PluginFrameworkName = "rocket"; advertising.AddPlugins(Plugins.Select(p => p.Name)); SteamGameServer.SetKeyValue("unturned", Provider.APP_VERSION); SteamGameServer.SetKeyValue("rocket", "4.9.3.6"); }
internal void Initialize() { try { Settings = new XMLFileAsset <UnturnedSettings>(Environment.SettingsFile); Translation = new XMLFileAsset <TranslationList>(String.Format(Environment.TranslationFile, Core.R.Settings.Instance.LanguageCode), new Type[] { typeof(TranslationList), typeof(TranslationListEntry) }, defaultTranslations); defaultTranslations.AddUnknownEntries(Translation); Events = gameObject.TryAddComponent <UnturnedEvents>(); gameObject.TryAddComponent <UnturnedPermissions>(); gameObject.TryAddComponent <UnturnedChat>(); gameObject.TryAddComponent <UnturnedCommands>(); gameObject.TryAddComponent <AutomaticSaveWatchdog>(); bindDelegates(); RocketPlugin.OnPluginLoading += (IRocketPlugin plugin, ref bool cancelLoading) => { try { plugin.TryAddComponent <PluginUnturnedPlayerComponentManager>(); } catch (Exception ex) { Core.Logging.Logger.LogException(ex, "Failed to load plugin " + plugin.Name + "."); cancelLoading = true; } }; RocketPlugin.OnPluginUnloading += (IRocketPlugin plugin) => { plugin.TryRemoveComponent <PluginUnturnedPlayerComponentManager>(); }; R.Commands.RegisterFromAssembly(Assembly.GetExecutingAssembly()); try { R.Plugins.OnPluginsLoaded += () => { IPluginAdvertising pluginAdvertising = PluginAdvertising.Get(); List <IRocketPlugin> rocketPlugins = R.Plugins.GetPlugins(); List <string> pluginNames = new List <string>(rocketPlugins.Count); foreach (IRocketPlugin plugin in rocketPlugins) { if (plugin != null && !string.IsNullOrEmpty(plugin.Name)) { pluginNames.Add(plugin.Name); } } pluginAdvertising.AddPlugins(pluginNames); }; SteamGameServer.SetKeyValue("unturned", Provider.APP_VERSION); SteamGameServer.SetKeyValue("rocket", Assembly.GetExecutingAssembly().GetName().Version.ToString()); } catch (Exception ex) { Core.Logging.Logger.LogError("Steam can not be initialized: " + ex.Message); } OnRocketImplementationInitialized.TryInvoke(); } catch (Exception ex) { Core.Logging.Logger.LogException(ex); } }
Task IEventListener <PluginUnloadedEvent> .HandleEventAsync(object?sender, PluginUnloadedEvent @event) { PluginAdvertising.Get().RemovePlugin(@event.Plugin.DisplayName); return(Task.CompletedTask); }