Send server rules over the network (#10847)
Add a new InfoSystem that sends SharedInfo from the server to client when requested. Currently, only the rule header and rule text is sent. Previously, the rule header and rule text was bundled in the client, which means that the client would only display rules that it was built with, even if the server has different rules. This allows servers all running the same build to send different rules. This could be useful, for example, for servers running the official builds to send different rulesets without a client rebuild.
This commit is contained in:
@@ -13,6 +13,8 @@ namespace Content.Client.Info
|
||||
{
|
||||
[Dependency] private readonly IResourceCache _resourceManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfgManager = default!;
|
||||
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
|
||||
[Dependency] private readonly RulesManager _rules = default!;
|
||||
|
||||
private OptionsMenu optionsMenu;
|
||||
|
||||
@@ -35,7 +37,7 @@ namespace Content.Client.Info
|
||||
TabContainer.SetTabTitle(rulesList, Loc.GetString("ui-info-tab-rules"));
|
||||
TabContainer.SetTabTitle(tutorialList, Loc.GetString("ui-info-tab-tutorial"));
|
||||
|
||||
PopulateRules(rulesList);
|
||||
AddSection(rulesList, _rules.RulesSection());
|
||||
PopulateTutorial(tutorialList);
|
||||
|
||||
Contents.AddChild(rootContainer);
|
||||
@@ -43,11 +45,6 @@ namespace Content.Client.Info
|
||||
SetSize = (650, 650);
|
||||
}
|
||||
|
||||
private void PopulateRules(Info rulesList)
|
||||
{
|
||||
AddSection(rulesList, MakeRules(_cfgManager, _resourceManager));
|
||||
}
|
||||
|
||||
private void PopulateTutorial(Info tutorialList)
|
||||
{
|
||||
AddSection(tutorialList, Loc.GetString("ui-info-header-intro"), "Intro.txt");
|
||||
@@ -74,9 +71,5 @@ namespace Content.Client.Info
|
||||
return new InfoSection(title, res.ContentFileReadAllText($"/Server Info/{path}"), markup);
|
||||
}
|
||||
|
||||
public static Control MakeRules(IConfigurationManager cfg, IResourceManager res)
|
||||
{
|
||||
return MakeSection(Loc.GetString(cfg.GetCVar(CCVars.RulesHeader)), cfg.GetCVar(CCVars.RulesFile), true, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user