Merge pull request #246 from diamante0018/fix-lan
Fix lanonly for dedis
This commit is contained in:
commit
31f1dd2d55
@ -3,7 +3,9 @@
|
||||
namespace Components
|
||||
{
|
||||
SteamID Dedicated::PlayerGuids[18][2];
|
||||
|
||||
Dvar::Var Dedicated::SVRandomMapRotation;
|
||||
Dvar::Var Dedicated::SVLanOnly;
|
||||
|
||||
bool Dedicated::IsEnabled()
|
||||
{
|
||||
@ -250,9 +252,15 @@ namespace Components
|
||||
}
|
||||
|
||||
void Dedicated::Heartbeat()
|
||||
{
|
||||
int masterPort = Dvar::Var("masterPort").get<int>();
|
||||
const char* masterServerName = Dvar::Var("masterServerName").get<const char*>();
|
||||
{
|
||||
// Do not send a heartbeat if sv_lanOnly is set to true
|
||||
if (Dedicated::SVLanOnly.get<bool>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto masterPort = Dvar::Var("masterPort").get<int>();
|
||||
const auto* masterServerName = Dvar::Var("masterServerName").get<const char*>();
|
||||
|
||||
Network::Address master(Utils::String::VA("%s:%u", masterServerName, masterPort));
|
||||
|
||||
@ -290,7 +298,11 @@ namespace Components
|
||||
// Make sure all callbacks are handled
|
||||
Scheduler::OnFrame(Steam::SteamAPI_RunCallbacks);
|
||||
|
||||
Dvar::Register<bool>("sv_lanOnly", false, Game::dvar_flag::DVAR_NONE, "Don't act as node");
|
||||
Dvar::OnInit([]
|
||||
{
|
||||
Dedicated::SVLanOnly = Dvar::Register<bool>("sv_lanOnly", false,
|
||||
Game::dvar_flag::DVAR_NONE, "Don't act as node");
|
||||
});
|
||||
|
||||
Utils::Hook(0x60BE98, Dedicated::InitDedicatedServer, HOOK_CALL).install()->quick();
|
||||
|
||||
|
@ -8,6 +8,7 @@ namespace Components
|
||||
Dedicated();
|
||||
|
||||
static SteamID PlayerGuids[18][2];
|
||||
static Dvar::Var SVLanOnly;
|
||||
|
||||
static bool IsEnabled();
|
||||
|
||||
|
@ -114,7 +114,7 @@ namespace Components
|
||||
|
||||
void Node::StoreNodes(bool force)
|
||||
{
|
||||
if (Dedicated::IsEnabled() && Dvar::Var("sv_lanOnly").get<bool>()) return;
|
||||
if (Dedicated::IsEnabled() && Dedicated::SVLanOnly.get<bool>()) return;
|
||||
|
||||
static Utils::Time::Interval interval;
|
||||
if (!force && !interval.elapsed(1min)) return;
|
||||
@ -168,7 +168,7 @@ namespace Components
|
||||
void Node::RunFrame()
|
||||
{
|
||||
if (ServerList::useMasterServer) return;
|
||||
if (Dedicated::IsEnabled() && Dvar::Var("sv_lanOnly").get<bool>()) return;
|
||||
if (Dedicated::IsEnabled() && Dedicated::SVLanOnly.get<bool>()) return;
|
||||
|
||||
if (!Dedicated::IsEnabled() && *Game::clcState > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user