CatStation/Content.Client/Entry/EntryPoint.cs
Pok 7a8fab78e3
Move Accents to Shared v2 (#44772)
* move-accents-to-shared

* Update AccentSystem.cs

* Update ListeningSystem.cs

* aaaaaa

* Update AccentSystem.cs

* oh god

* aaooao

* //

* review

* fix

* Update VocalSystem.cs
2026-07-25 22:29:39 +00:00

244 lines
11 KiB
C#

using Content.Client.Administration.Managers;
using Content.Client.Changelog;
using Content.Client.Chat.Managers;
using Content.Client.DebugMon;
using Content.Client.Eui;
using Content.Client.FeedbackPopup;
using Content.Client.Fullscreen;
using Content.Client.GameTicking.Managers;
using Content.Client.GhostKick;
using Content.Client.Guidebook;
using Content.Client.Input;
using Content.Client.IoC;
using Content.Client.Launcher;
using Content.Client.Lobby;
using Content.Client.MainMenu;
using Content.Client.Overlays;
using Content.Client.Parallax.Managers;
using Content.Client.Players.PlayTimeTracking;
using Content.Client.Playtime;
using Content.Client.Radiation.Overlays;
using Content.Client.Replay;
using Content.Client.Screenshot;
using Content.Client.Singularity;
using Content.Client.Stylesheets;
using Content.Client.UserInterface;
using Content.Client.Viewport;
using Content.Client.Voting;
using Content.Shared.Ame.Components;
using Content.Shared.FeedbackSystem;
using Content.Shared.Gravity;
using Content.Shared.Localizations;
using Robust.Client;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Replays.Loading;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;
using Robust.Shared.Replays;
using Robust.Shared.Timing;
namespace Content.Client.Entry
{
public sealed partial class EntryPoint : GameClient
{
[Dependency] private IBaseClient _baseClient = default!;
[Dependency] private IGameController _gameController = default!;
[Dependency] private IStateManager _stateManager = default!;
[Dependency] private IComponentFactory _componentFactory = default!;
[Dependency] private IPrototypeManager _prototypeManager = default!;
[Dependency] private IClientAdminManager _adminManager = default!;
[Dependency] private IParallaxManager _parallaxManager = default!;
[Dependency] private IConfigurationManager _configManager = default!;
[Dependency] private IStylesheetManager _stylesheetManager = default!;
[Dependency] private IScreenshotHook _screenshotHook = default!;
[Dependency] private FullscreenHook _fullscreenHook = default!;
[Dependency] private ChangelogManager _changelogManager = default!;
[Dependency] private ViewportManager _viewportManager = default!;
[Dependency] private IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private IInputManager _inputManager = default!;
[Dependency] private IOverlayManager _overlayManager = default!;
[Dependency] private IChatManager _chatManager = default!;
[Dependency] private IClientPreferencesManager _clientPreferencesManager = default!;
[Dependency] private EuiManager _euiManager = default!;
[Dependency] private IVoteManager _voteManager = default!;
[Dependency] private DocumentParsingManager _documentParsingManager = default!;
[Dependency] private GhostKickManager _ghostKick = default!;
[Dependency] private ExtendedDisconnectInformationManager _extendedDisconnectInformation = default!;
[Dependency] private JobRequirementsManager _jobRequirements = default!;
[Dependency] private ContentLocalizationManager _contentLoc = default!;
[Dependency] private ContentReplayPlaybackManager _playbackMan = default!;
[Dependency] private IResourceManager _resourceManager = default!;
[Dependency] private IReplayLoadManager _replayLoad = default!;
[Dependency] private ILogManager _logManager = default!;
[Dependency] private DebugMonitorManager _debugMonitorManager = default!;
[Dependency] private TitleWindowManager _titleWindowManager = default!;
[Dependency] private IEntitySystemManager _entitySystemManager = default!;
[Dependency] private ClientsidePlaytimeTrackingManager _clientsidePlaytimeManager = default!;
[Dependency] private ClientFeedbackManager _feedbackManager = null!;
public override void PreInit()
{
ClientContentIoC.Register(Dependencies);
foreach (var callback in TestingCallbacks)
{
var cast = (ClientModuleTestingCallbacks) callback;
cast.ClientBeforeIoC?.Invoke();
}
}
public override void Init()
{
Dependencies.BuildGraph();
Dependencies.InjectDependencies(this);
_contentLoc.Initialize();
_componentFactory.DoAutoRegistrations();
_componentFactory.IgnoreMissingComponents();
// Do not add to these, they are legacy.
_componentFactory.RegisterClass<SharedAmeControllerComponent>();
// Do not add to the above, they are legacy
_prototypeManager.RegisterIgnore("utilityQuery");
_prototypeManager.RegisterIgnore("utilityCurvePreset");
_prototypeManager.RegisterIgnore("gasReaction");
_prototypeManager.RegisterIgnore("seed"); // Seeds prototypes are server-only.
_prototypeManager.RegisterIgnore("objective");
_prototypeManager.RegisterIgnore("holiday");
_prototypeManager.RegisterIgnore("htnCompound");
_prototypeManager.RegisterIgnore("htnPrimitive");
_prototypeManager.RegisterIgnore("gameMap");
_prototypeManager.RegisterIgnore("gameMapPool");
_prototypeManager.RegisterIgnore("gamePreset");
_prototypeManager.RegisterIgnore("noiseChannel");
_prototypeManager.RegisterIgnore("playerConnectionWhitelist");
_prototypeManager.RegisterIgnore("spaceBiome");
_prototypeManager.RegisterIgnore("gameRule");
_prototypeManager.RegisterIgnore("worldSpell");
_prototypeManager.RegisterIgnore("entitySpell");
_prototypeManager.RegisterIgnore("instantSpell");
_prototypeManager.RegisterIgnore("roundAnnouncement");
_prototypeManager.RegisterIgnore("wireLayout");
_prototypeManager.RegisterIgnore("alertLevels");
_prototypeManager.RegisterIgnore("nukeopsRole");
_prototypeManager.RegisterIgnore("ghostRoleRaffleDecider");
_prototypeManager.RegisterIgnore("codewordGenerator");
_prototypeManager.RegisterIgnore("codewordFaction");
_componentFactory.GenerateNetIds();
_adminManager.Initialize();
_screenshotHook.Initialize();
_fullscreenHook.Initialize();
_changelogManager.Initialize();
_viewportManager.Initialize();
_ghostKick.Initialize();
_extendedDisconnectInformation.Initialize();
_jobRequirements.Initialize();
_playbackMan.Initialize();
_clientsidePlaytimeManager.Initialize();
//AUTOSCALING default Setup!
_configManager.SetCVar("interface.resolutionAutoScaleUpperCutoffX", 1080);
_configManager.SetCVar("interface.resolutionAutoScaleUpperCutoffY", 720);
_configManager.SetCVar("interface.resolutionAutoScaleLowerCutoffX", 520);
_configManager.SetCVar("interface.resolutionAutoScaleLowerCutoffY", 240);
_configManager.SetCVar("interface.resolutionAutoScaleMinimum", 0.5f);
}
public override void PostInit()
{
base.PostInit();
_stylesheetManager.Initialize();
// Setup key contexts
ContentContexts.SetupContexts(_inputManager.Contexts);
_parallaxManager.LoadDefaultParallax();
_overlayManager.AddOverlay(new SingularityOverlay());
_overlayManager.AddOverlay(new RadiationPulseOverlay());
_overlayManager.AddOverlay(new ScreechShockWaveOverlay());
_chatManager.Initialize();
_clientPreferencesManager.Initialize();
_euiManager.Initialize();
_voteManager.Initialize();
_userInterfaceManager.SetDefaultTheme("SS14DefaultTheme");
_userInterfaceManager.SetActiveTheme(_configManager.GetCVar(CVars.InterfaceTheme));
_documentParsingManager.Initialize();
_titleWindowManager.Initialize();
_feedbackManager.Initialize();
_baseClient.RunLevelChanged += (_, args) =>
{
if (args.NewLevel == ClientRunLevel.Initialize)
{
SwitchToDefaultState(args.OldLevel == ClientRunLevel.Connected ||
args.OldLevel == ClientRunLevel.InGame);
}
};
// Disable engine-default viewport since we use our own custom viewport control.
_userInterfaceManager.MainViewport.Visible = false;
SwitchToDefaultState();
}
private void SwitchToDefaultState(bool disconnected = false)
{
// Fire off into state dependent on launcher or not.
// Check if we're loading a replay via content bundle!
if (_configManager.GetCVar(CVars.LaunchContentBundle)
&& _resourceManager.ContentFileExists(
ReplayConstants.ReplayZipFolder.ToRootedPath() / ReplayConstants.FileMeta))
{
_logManager.GetSawmill("entry").Info("Loading content bundle replay from VFS!");
var reader = new ReplayFileReaderResources(
_resourceManager,
ReplayConstants.ReplayZipFolder.ToRootedPath());
_playbackMan.LastLoad = (null, ReplayConstants.ReplayZipFolder.ToRootedPath());
_replayLoad.LoadAndStartReplay(reader);
}
else if (_gameController.LaunchState.FromLauncher)
{
_stateManager.RequestStateChange<LauncherConnecting>();
var state = (LauncherConnecting) _stateManager.CurrentState;
if (disconnected)
{
state.SetDisconnected();
}
}
else
{
_stateManager.RequestStateChange<MainScreen>();
}
}
public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
{
if (level == ModUpdateLevel.FramePreEngine)
{
_debugMonitorManager.FrameUpdate();
}
if (level == ModUpdateLevel.PreEngine)
{
if (_baseClient.RunLevel is ClientRunLevel.InGame or ClientRunLevel.SinglePlayerGame)
{
var updateSystem = _entitySystemManager.GetEntitySystem<BuiPreTickUpdateSystem>();
updateSystem.RunUpdates();
}
}
}
}
}