mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-19 14:38:36 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description the adding AI is now up to y'all because i'm not touching loadout code for name datasets, but it shouldn't be too bad from here --------- Signed-off-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com> Signed-off-by: SolStar <44028047+ewokswagger@users.noreply.github.com> Signed-off-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: themias <89101928+themias@users.noreply.github.com> Co-authored-by: Verm <32827189+Vermidia@users.noreply.github.com> Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Co-authored-by: Sphiral <145869023+SphiraI@users.noreply.github.com> Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com> Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: Alzore <140123969+Blackern5000@users.noreply.github.com> Co-authored-by: ravage <142820619+ravage123321@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: Intoxicating-Innocence <188202277+Intoxicating-Innocence@users.noreply.github.com> Co-authored-by: Saphire <lattice@saphi.re> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Errant <35878406+Errant-4@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: CaasGit <87243814+CaasGit@users.noreply.github.com> Co-authored-by: BramvanZijp <56019239+BramvanZijp@users.noreply.github.com> Co-authored-by: Boaz1111 <149967078+Boaz1111@users.noreply.github.com> Co-authored-by: NakataRin <45946146+NakataRin@users.noreply.github.com> Co-authored-by: Kara <lunarautomaton6@gmail.com> Co-authored-by: Plykiya <58439124+Plykiya@users.noreply.github.com> Co-authored-by: SlamBamActionman <slambamactionman@gmail.com> Co-authored-by: Doomsdrayk <robotdoughnut@comcast.net> Co-authored-by: Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com> Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> Co-authored-by: ElectroJr <leonsfriedrich@gmail.com> Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: Julian Giebel <juliangiebel@live.de> Co-authored-by: nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com> Co-authored-by: Repo <47093363+Titian3@users.noreply.github.com> Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> Co-authored-by: icekot8 <93311212+icekot8@users.noreply.github.com> Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: no <165581243+pissdemon@users.noreply.github.com> Co-authored-by: Tornado Tech <54727692+Tornado-Technology@users.noreply.github.com> Co-authored-by: osjarw <62134478+osjarw@users.noreply.github.com> Co-authored-by: Simon <63975668+Simyon264@users.noreply.github.com> Co-authored-by: TGRCDev <tgrc@tgrc.dev> Co-authored-by: Milon <milonpl.git@proton.me> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Co-authored-by: Fildrance <fildrance@gmail.com> Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru> Co-authored-by: chavonadelal <156101927+chavonadelal@users.noreply.github.com> Co-authored-by: SolStar <44028047+ewokswagger@users.noreply.github.com> Co-authored-by: K-Dynamic <20566341+K-Dynamic@users.noreply.github.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: ArchRBX <5040911+ArchRBX@users.noreply.github.com> Co-authored-by: archrbx <punk.gear5260@fastmail.com> Co-authored-by: Radezolid <snappednexus@gmail.com> Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Co-authored-by: EmoGarbage404 <retron404@gmail.com> Co-authored-by: MilenVolf <63782763+MilenVolf@users.noreply.github.com> Co-authored-by: Velcroboy <107660393+IamVelcroboy@users.noreply.github.com> Co-authored-by: Velcroboy <velcroboy333@hotmail.com> Co-authored-by: neuPanda <chriseparton@gmail.com> Co-authored-by: neuPanda <spainman0@yahoo.com> Co-authored-by: Dvir <39403717+dvir001@users.noreply.github.com> Co-authored-by: Whatstone <whatston3@gmail.com> Co-authored-by: VideoKompany <135313844+VlaDOS1408@users.noreply.github.com> (cherry picked from commit 93ed70acfeda357133a701f637d3faeec02749bb)
230 lines
8.9 KiB
C#
230 lines
8.9 KiB
C#
using Content.Server._White.TTS;
|
|
using Content.Server.Acz;
|
|
using Content.Server.Administration;
|
|
using Content.Server.Administration.Logs;
|
|
using Content.Server.Administration.Managers;
|
|
using Content.Server.Afk;
|
|
using Content.Server.Chat.Managers;
|
|
using Content.Server.Connection;
|
|
using Content.Server.JoinQueue;
|
|
using Content.Server.Database;
|
|
using Content.Server.DiscordAuth;
|
|
using Content.Server.EUI;
|
|
using Content.Server.GameTicking;
|
|
using Content.Server.GhostKick;
|
|
using Content.Server.GuideGenerator;
|
|
using Content.Server.Info;
|
|
using Content.Server.IoC;
|
|
using Content.Server.Players.JobWhitelist;
|
|
using Content.Server.Maps;
|
|
using Content.Server.NodeContainer.NodeGroups;
|
|
using Content.Server.Players;
|
|
using Content.Server.Players.JobWhitelist;
|
|
using Content.Server.Players.PlayTimeTracking;
|
|
using Content.Server.Players.RateLimiting;
|
|
using Content.Server.Preferences.Managers;
|
|
using Content.Server.ServerInfo;
|
|
using Content.Server.ServerUpdates;
|
|
using Content.Server.Voting.Managers;
|
|
using Content.Shared.CCVar;
|
|
using Content.Shared.Kitchen;
|
|
using Content.Shared.Localizations;
|
|
using Robust.Server;
|
|
using Robust.Server.ServerStatus;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.ContentPack;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Timing;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Entry
|
|
{
|
|
public sealed class EntryPoint : GameServer
|
|
{
|
|
internal const string ConfigPresetsDir = "/ConfigPresets/";
|
|
private const string ConfigPresetsDirBuild = $"{ConfigPresetsDir}Build/";
|
|
|
|
private EuiManager _euiManager = default!;
|
|
private IVoteManager _voteManager = default!;
|
|
private ServerUpdateManager _updateManager = default!;
|
|
private PlayTimeTrackingManager? _playTimeTracking;
|
|
private IEntitySystemManager? _sysMan;
|
|
private IServerDbManager? _dbManager;
|
|
|
|
/// <inheritdoc />
|
|
public override void Init()
|
|
{
|
|
base.Init();
|
|
|
|
var cfg = IoCManager.Resolve<IConfigurationManager>();
|
|
var res = IoCManager.Resolve<IResourceManager>();
|
|
var logManager = IoCManager.Resolve<ILogManager>();
|
|
|
|
LoadConfigPresets(cfg, res, logManager.GetSawmill("configpreset"));
|
|
|
|
var aczProvider = new ContentMagicAczProvider(IoCManager.Resolve<IDependencyCollection>());
|
|
IoCManager.Resolve<IStatusHost>().SetMagicAczProvider(aczProvider);
|
|
|
|
var factory = IoCManager.Resolve<IComponentFactory>();
|
|
var prototypes = IoCManager.Resolve<IPrototypeManager>();
|
|
|
|
factory.DoAutoRegistrations();
|
|
factory.IgnoreMissingComponents("Visuals");
|
|
|
|
factory.RegisterIgnore(IgnoredComponents.List);
|
|
|
|
prototypes.RegisterIgnore("parallax");
|
|
prototypes.RegisterIgnore("guideEntry");
|
|
|
|
ServerContentIoC.Register();
|
|
|
|
foreach (var callback in TestingCallbacks)
|
|
{
|
|
var cast = (ServerModuleTestingCallbacks) callback;
|
|
cast.ServerBeforeIoC?.Invoke();
|
|
}
|
|
|
|
IoCManager.BuildGraph();
|
|
factory.GenerateNetIds();
|
|
var configManager = IoCManager.Resolve<IConfigurationManager>();
|
|
var dest = configManager.GetCVar(CCVars.DestinationFile);
|
|
IoCManager.Resolve<ContentLocalizationManager>().Initialize();
|
|
if (string.IsNullOrEmpty(dest)) //hacky but it keeps load times for the generator down.
|
|
{
|
|
_euiManager = IoCManager.Resolve<EuiManager>();
|
|
_voteManager = IoCManager.Resolve<IVoteManager>();
|
|
_updateManager = IoCManager.Resolve<ServerUpdateManager>();
|
|
_playTimeTracking = IoCManager.Resolve<PlayTimeTrackingManager>();
|
|
_sysMan = IoCManager.Resolve<IEntitySystemManager>();
|
|
_dbManager = IoCManager.Resolve<IServerDbManager>();
|
|
|
|
logManager.GetSawmill("Storage").Level = LogLevel.Info;
|
|
logManager.GetSawmill("db.ef").Level = LogLevel.Info;
|
|
|
|
IoCManager.Resolve<IAdminLogManager>().Initialize();
|
|
IoCManager.Resolve<IConnectionManager>().Initialize();
|
|
_dbManager.Init();
|
|
IoCManager.Resolve<IServerPreferencesManager>().Init();
|
|
IoCManager.Resolve<INodeGroupFactory>().Initialize();
|
|
IoCManager.Resolve<ContentNetworkResourceManager>().Initialize();
|
|
IoCManager.Resolve<GhostKickManager>().Initialize();
|
|
IoCManager.Resolve<ServerInfoManager>().Initialize();
|
|
IoCManager.Resolve<JoinQueueManager>().Initialize();
|
|
IoCManager.Resolve<DiscordAuthManager>().Initialize();
|
|
IoCManager.Resolve<ServerApi>().Initialize();
|
|
IoCManager.Resolve<TTSManager>().Initialize(); // WD EDIT
|
|
|
|
_voteManager.Initialize();
|
|
_updateManager.Initialize();
|
|
_playTimeTracking.Initialize();
|
|
IoCManager.Resolve<JobWhitelistManager>().Initialize();
|
|
IoCManager.Resolve<PlayerRateLimitManager>().Initialize();
|
|
}
|
|
}
|
|
|
|
public override void PostInit()
|
|
{
|
|
base.PostInit();
|
|
|
|
IoCManager.Resolve<IChatSanitizationManager>().Initialize();
|
|
IoCManager.Resolve<IChatManager>().Initialize();
|
|
var configManager = IoCManager.Resolve<IConfigurationManager>();
|
|
var resourceManager = IoCManager.Resolve<IResourceManager>();
|
|
var dest = configManager.GetCVar(CCVars.DestinationFile);
|
|
if (!string.IsNullOrEmpty(dest))
|
|
{
|
|
var resPath = new ResPath(dest).ToRootedPath();
|
|
var file = resourceManager.UserData.OpenWriteText(resPath.WithName("chem_" + dest));
|
|
ChemistryJsonGenerator.PublishJson(file);
|
|
file.Flush();
|
|
file = resourceManager.UserData.OpenWriteText(resPath.WithName("react_" + dest));
|
|
ReactionJsonGenerator.PublishJson(file);
|
|
file.Flush();
|
|
IoCManager.Resolve<IBaseServer>().Shutdown("Data generation done");
|
|
}
|
|
else
|
|
{
|
|
IoCManager.Resolve<RecipeManager>().Initialize();
|
|
IoCManager.Resolve<IAdminManager>().Initialize();
|
|
IoCManager.Resolve<IAfkManager>().Initialize();
|
|
IoCManager.Resolve<RulesManager>().Initialize();
|
|
_euiManager.Initialize();
|
|
|
|
IoCManager.Resolve<IGameMapManager>().Initialize();
|
|
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<GameTicker>().PostInitialize();
|
|
IoCManager.Resolve<IBanManager>().Initialize();
|
|
IoCManager.Resolve<IConnectionManager>().PostInit();
|
|
}
|
|
}
|
|
|
|
public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
|
|
{
|
|
base.Update(level, frameEventArgs);
|
|
|
|
switch (level)
|
|
{
|
|
case ModUpdateLevel.PostEngine:
|
|
{
|
|
_euiManager.SendUpdates();
|
|
_voteManager.Update();
|
|
break;
|
|
}
|
|
|
|
case ModUpdateLevel.FramePostEngine:
|
|
_updateManager.Update();
|
|
_playTimeTracking?.Update();
|
|
break;
|
|
}
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
_playTimeTracking?.Shutdown();
|
|
_dbManager?.Shutdown();
|
|
IoCManager.Resolve<ServerApi>().Shutdown();
|
|
}
|
|
|
|
private static void LoadConfigPresets(IConfigurationManager cfg, IResourceManager res, ISawmill sawmill)
|
|
{
|
|
LoadBuildConfigPresets(cfg, res, sawmill);
|
|
|
|
var presets = cfg.GetCVar(CCVars.ConfigPresets);
|
|
if (presets == "")
|
|
return;
|
|
|
|
foreach (var preset in presets.Split(','))
|
|
{
|
|
var path = $"{ConfigPresetsDir}{preset}.toml";
|
|
if (!res.TryContentFileRead(path, out var file))
|
|
{
|
|
sawmill.Error("Unable to load config preset {Preset}!", path);
|
|
continue;
|
|
}
|
|
|
|
cfg.LoadDefaultsFromTomlStream(file);
|
|
sawmill.Info("Loaded config preset: {Preset}", path);
|
|
}
|
|
}
|
|
|
|
private static void LoadBuildConfigPresets(IConfigurationManager cfg, IResourceManager res, ISawmill sawmill)
|
|
{
|
|
#if TOOLS
|
|
Load(CCVars.ConfigPresetDevelopment, "development");
|
|
#endif
|
|
#if DEBUG
|
|
Load(CCVars.ConfigPresetDebug, "debug");
|
|
#endif
|
|
|
|
void Load(CVarDef<bool> cVar, string name)
|
|
{
|
|
var path = $"{ConfigPresetsDirBuild}{name}.toml";
|
|
if (cfg.GetCVar(cVar) && res.TryContentFileRead(path, out var file))
|
|
{
|
|
cfg.LoadDefaultsFromTomlStream(file);
|
|
sawmill.Info("Loaded config preset: {Preset}", path);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|