Files
OldThink/Content.Client/Entry/EntryPoint.cs

251 lines
11 KiB
C#
Raw Normal View History

2024-07-11 19:38:35 +03:00
using Content.Client._White.Chat;
using Content.Client._White.JoinQueue;
using Content.Client._White.Jukebox;
using Content.Client._White.Reputation;
using Content.Client._White.Sponsors;
using Content.Client._White.Stalin;
using Content.Client._White.TTS;
2021-06-09 22:19:39 +02:00
using Content.Client.Administration.Managers;
2021-02-25 09:50:45 +01:00
using Content.Client.Changelog;
2021-06-09 22:19:39 +02:00
using Content.Client.Chat.Managers;
2020-11-10 16:50:28 +01:00
using Content.Client.Eui;
using Content.Client.Fullscreen;
using Content.Client.GhostKick;
using Content.Client.Guidebook;
using Content.Client.Info;
using Content.Client.Input;
2021-06-09 22:19:39 +02:00
using Content.Client.IoC;
using Content.Client.Launcher;
using Content.Client.MainMenu;
using Content.Client.Parallax.Managers;
using Content.Client.Players.PlayTimeTracking;
2021-06-09 22:19:39 +02:00
using Content.Client.Preferences;
2022-10-11 05:09:10 +02:00
using Content.Client.Radiation.Overlays;
2023-06-05 16:44:09 +12:00
using Content.Client.Replay;
2021-06-09 22:19:39 +02:00
using Content.Client.Screenshot;
using Content.Client.Singularity;
using Content.Client._White.Explosion;
2021-06-09 22:19:39 +02:00
using Content.Client.Stylesheets;
using Content.Client.Viewport;
using Content.Client.Voting;
using Content.Shared.Ame.Components;
2021-06-09 22:19:39 +02:00
using Content.Shared.Gravity;
2022-10-21 01:54:18 -07:00
using Content.Shared.Localizations;
using Robust.Client;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Replays.Loading;
using Robust.Client.State;
2021-04-19 09:52:40 +02:00
using Robust.Client.UserInterface;
using Robust.Shared;
2022-09-14 20:42:35 -07:00
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;
using Robust.Shared.Replays;
namespace Content.Client.Entry
{
public sealed class EntryPoint : GameClient
{
[Dependency] private readonly IBaseClient _baseClient = default!;
[Dependency] private readonly IGameController _gameController = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
2022-09-14 20:42:35 -07:00
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly IParallaxManager _parallaxManager = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IStylesheetManager _stylesheetManager = default!;
[Dependency] private readonly IScreenshotHook _screenshotHook = default!;
[Dependency] private readonly FullscreenHook _fullscreenHook = default!;
2022-09-14 20:42:35 -07:00
[Dependency] private readonly ChangelogManager _changelogManager = default!;
[Dependency] private readonly RulesManager _rulesManager = default!;
[Dependency] private readonly ViewportManager _viewportManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IOverlayManager _overlayManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IClientPreferencesManager _clientPreferencesManager = default!;
[Dependency] private readonly EuiManager _euiManager = default!;
[Dependency] private readonly IVoteManager _voteManager = default!;
[Dependency] private readonly DocumentParsingManager _documentParsingManager = default!;
2022-09-14 20:42:35 -07:00
[Dependency] private readonly GhostKickManager _ghostKick = default!;
[Dependency] private readonly ExtendedDisconnectInformationManager _extendedDisconnectInformation = default!;
2023-05-27 14:22:22 +10:00
[Dependency] private readonly JobRequirementsManager _jobRequirements = default!;
2022-10-21 01:54:18 -07:00
[Dependency] private readonly ContentLocalizationManager _contentLoc = default!;
2023-06-05 16:44:09 +12:00
[Dependency] private readonly ContentReplayPlaybackManager _playbackMan = default!;
[Dependency] private readonly IResourceManager _resourceManager = default!;
[Dependency] private readonly IReplayLoadManager _replayLoad = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!;
2019-04-29 12:53:09 +02:00
//WD-EDIT
[Dependency] private readonly SponsorsManager _sponsorsManager = default!;
[Dependency] private readonly JoinQueueManager _queueManager = default!;
[Dependency] private readonly StalinManager _stalinManager = default!;
2023-05-04 13:43:03 +06:00
[Dependency] private readonly ClientJukeboxSongsSyncManager _jukeboxSyncManager = default!;
2023-05-04 17:51:53 +03:00
[Dependency] private readonly TTSManager _ttsManager = default!;
[Dependency] private readonly ReputationManager _reputationManager = default!;
2024-07-11 19:38:35 +03:00
[Dependency] private readonly IChatAbbreviationManager _chatAbbreviationManager = default!;
//WD-EDIT
public override void Init()
{
ClientContentIoC.Register();
2019-10-02 10:45:06 +02:00
foreach (var callback in TestingCallbacks)
2019-06-29 01:58:16 +02:00
{
var cast = (ClientModuleTestingCallbacks) callback;
2019-06-29 01:58:16 +02:00
cast.ClientBeforeIoC?.Invoke();
}
IoCManager.BuildGraph();
2019-04-29 12:53:09 +02:00
IoCManager.InjectDependencies(this);
2022-08-21 11:42:57 +12:00
2022-10-21 01:54:18 -07:00
_contentLoc.Initialize();
2022-09-14 20:42:35 -07:00
_componentFactory.DoAutoRegistrations();
_componentFactory.IgnoreMissingComponents();
2022-09-14 20:42:35 -07:00
// Do not add to these, they are legacy.
_componentFactory.RegisterClass<SharedGravityGeneratorComponent>();
2023-06-28 05:02:06 -07:00
_componentFactory.RegisterClass<SharedAmeControllerComponent>();
2022-09-14 20:42:35 -07:00
// Do not add to the above, they are legacy
2023-05-02 04:57:11 +10:00
_prototypeManager.RegisterIgnore("utilityQuery");
_prototypeManager.RegisterIgnore("utilityCurvePreset");
2022-09-14 20:42:35 -07:00
_prototypeManager.RegisterIgnore("accent");
_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");
2022-09-14 20:42:35 -07:00
_prototypeManager.RegisterIgnore("lobbyBackground");
_prototypeManager.RegisterIgnore("gamePreset");
_prototypeManager.RegisterIgnore("noiseChannel");
_prototypeManager.RegisterIgnore("spaceBiome");
_prototypeManager.RegisterIgnore("worldgenConfig");
2022-09-14 20:42:35 -07:00
_prototypeManager.RegisterIgnore("gameRule");
_prototypeManager.RegisterIgnore("worldSpell");
_prototypeManager.RegisterIgnore("entitySpell");
_prototypeManager.RegisterIgnore("instantSpell");
_prototypeManager.RegisterIgnore("roundAnnouncement");
_prototypeManager.RegisterIgnore("wireLayout");
_prototypeManager.RegisterIgnore("alertLevels");
_prototypeManager.RegisterIgnore("nukeopsRole");
Cherrypicks 4 (#393) * Immovable Rod changes (#26757) * Adds non randomized rod velocity (#27123) * adds non randomized rod velocity * Adds despawn suffix to despawn rod * make fire spreading scale with mass (#27202) * make fire spreading scale with mass * realer --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * lower max firestacks to 10, refactor flammable (#27159) * lower max firestacks to 10, refactor flammable * fix * uncap fire stack damage, lower fire stack damage * fix fire spread round removal (#27986) * fix a resolve debug assert * rewrite fire spread --------- Co-authored-by: deltanedas <@deltanedas:kde.org> * fire troll fix (#28034) Co-authored-by: deltanedas <@deltanedas:kde.org> * Hide doafters if you're in a container (#29487) * Hide doafters if you're in a container * Out of the loop --------- Co-authored-by: plykiya <plykiya@protonmail.com> * Add ghost role raffles (#26629) * Add ghost role raffles * GRR: Fix dialogue sizing, fix merge * GRR: Add raffle deciders (winner picker) * GRR: Make settings prototype based with option to override * GRR: Use Raffles folder and namespace * GRR: DataFieldify and TimeSpanify * GRR: Don't actually DataFieldify HashSet<ICommonSession>s * GRR: add GetGhostRoleCount() + docs * update engine on branch * Ghost role raffles: docs, fix window size, cleanup, etc * GRR: Admin UI * GRR: Admin UI: Display initial/max/ext of selected raffle settings proto * GRR: Make a ton of roles raffled * Make ERT use short raffle timer (#27830) Co-authored-by: plykiya <plykiya@protonmail.com> * gives loneops a proper ghost role raffle (#27841) * shorten short raffle (#28685) * - fix: Conflicts. * - fix. --------- Co-authored-by: keronshb <54602815+keronshb@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com> Co-authored-by: Plykiya <58439124+Plykiya@users.noreply.github.com> Co-authored-by: plykiya <plykiya@protonmail.com> Co-authored-by: no <165581243+pissdemon@users.noreply.github.com> Co-authored-by: Boaz1111 <149967078+Boaz1111@users.noreply.github.com> Co-authored-by: HS <81934438+HolySSSS@users.noreply.github.com>
2024-06-29 20:02:26 +00:00
_prototypeManager.RegisterIgnore("ghostRoleRaffleDecider");
2022-09-14 20:42:35 -07:00
//WD-EDIT
_prototypeManager.RegisterIgnore("loadout");
//WD-EDIT
2022-09-14 20:42:35 -07:00
_componentFactory.GenerateNetIds();
_adminManager.Initialize();
_screenshotHook.Initialize();
_fullscreenHook.Initialize();
2022-09-14 20:42:35 -07:00
_changelogManager.Initialize();
_rulesManager.Initialize();
_viewportManager.Initialize();
_ghostKick.Initialize();
_extendedDisconnectInformation.Initialize();
2023-05-27 14:22:22 +10:00
_jobRequirements.Initialize();
2023-06-05 16:44:09 +12:00
_playbackMan.Initialize();
2022-09-14 20:42:35 -07:00
//WD-EDIT
_stalinManager.Initialize();
2024-07-11 19:38:35 +03:00
_chatAbbreviationManager.Initialize();
//WD-EDIT
2022-09-14 20:42:35 -07:00
//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
2022-09-14 20:42:35 -07:00
ContentContexts.SetupContexts(_inputManager.Contexts);
2022-09-14 20:42:35 -07:00
_parallaxManager.LoadDefaultParallax();
2022-09-14 20:42:35 -07:00
_overlayManager.AddOverlay(new SingularityOverlay());
_overlayManager.AddOverlay(new ExplosionShockWaveOverlay());
2022-09-14 20:42:35 -07:00
_overlayManager.AddOverlay(new RadiationPulseOverlay());
2024-02-01 02:43:57 +06:00
// _overlayManager.AddOverlay(new GrainOverlay());
// _overlayManager.AddOverlay(new AtmOverlay());
2022-09-14 20:42:35 -07:00
_chatManager.Initialize();
_clientPreferencesManager.Initialize();
_euiManager.Initialize();
_voteManager.Initialize();
_userInterfaceManager.SetDefaultTheme("SS14DefaultTheme");
_userInterfaceManager.SetActiveTheme(_configManager.GetCVar(CVars.InterfaceTheme));
_documentParsingManager.Initialize();
//WD-EDIT
_sponsorsManager.Initialize();
_queueManager.Initialize();
2023-05-04 13:43:03 +06:00
_jukeboxSyncManager.Initialize();
2023-05-04 17:51:53 +03:00
_ttsManager.Initialize();
_reputationManager.Initialize();
//WD-EDIT
_baseClient.RunLevelChanged += (_, args) =>
{
if (args.NewLevel == ClientRunLevel.Initialize)
{
SwitchToDefaultState(args.OldLevel == ClientRunLevel.Connected ||
args.OldLevel == ClientRunLevel.InGame);
}
};
2021-04-19 09:52:40 +02:00
// Disable engine-default viewport since we use our own custom viewport control.
2022-09-14 20:42:35 -07:00
_userInterfaceManager.MainViewport.Visible = false;
2021-04-19 09:52:40 +02:00
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());
_replayMan.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>();
}
}
}
}