public override void Initialize(IServiceProvider serviceProvider) { ServiceProvider = serviceProvider; Engine.Server = ServiceProvider.GetRequiredService <IEngineServer>(); Engine.Globals = ServiceProvider.GetRequiredService <IGlobalVars>(); Engine.FileSystem = ServiceProvider.GetRequiredService <IFileSystem>(); Server.Game.Engine.Trace.EngineTrace = ServiceProvider.GetRequiredService <ITrace>(); Engine.EntityDictionary = ServiceProvider.GetRequiredService <IEntityDictionary>(); Engine.EntityRegistry = ServiceProvider.GetRequiredService <IEntityRegistry>(); Engine.Entities = ServiceProvider.GetRequiredService <IEngineEntities>(); Engine.Sound = ServiceProvider.GetRequiredService <ISoundSystem>(); CVar.EngineCVar = ServiceProvider.GetRequiredService <ICVar>(); NetMessage.EngineNetworking = ServiceProvider.GetRequiredService <IEngineNetworking>(); NetMessage.NetworkMessages = ServiceProvider.GetRequiredService <INetworkMessages>(); EntUtils.Initialize(ServiceProvider.GetRequiredService <IEntityDictionary>()); SetupFileSystem(); Globals.g_psv_gravity = CVar.GetCVar("sv_gravity"); Globals.g_psv_aim = CVar.GetCVar("sv_aim"); Globals.g_footsteps = CVar.GetCVar("mp_footsteps"); //Set up our own entities var entities = EntityRegistryUtils.CollectEntityClasses(Assembly.GetExecutingAssembly()); entities.ForEach(i => Engine.EntityRegistry.AddEntityClass(i)); //Link messages now so it gets done LinkUserMessages(); }
public bool Init( IVoiceGameManagerHelper helper, int maxClients ) { Helper = helper; MaxPlayers = VOICE_MAX_PLAYERS < maxClients ? VOICE_MAX_PLAYERS : maxClients; Engine.Server.PrecacheModel("sprites/voiceicon.spr"); // register voice_serverdebug if it hasn't been registered already if (CVar.GetCVar(VoiceServerDebug.Name) == null) { CVar.EngineCVar.Register(VoiceServerDebug); } if (CVar.GetCVar(ServerAllTalk.Name) == null) { CVar.EngineCVar.Register(ServerAllTalk); } return(true); }