Page 1 of 1

Lan Mode

Posted: 09 Jul 2011, 11:54
by jonthekiller
I have modify manialive for add a lan mode. I have tested with manialive r239, MLEPP r394 and Oliverde8 HudMenu.

I have add this :

ManiaLive\bootstrapper.php Line 63

Code: Select all

echo 'Internet              -> optionnal -> ';
if (!$sock = @fsockopen('www.maniaplanet.com', 80, $num, $error, 5)) 
{
        echo '[ No ]'. PHP_EOL; 
        $internet=0;
}else{ 
        echo '[ Yes ]'. PHP_EOL; 
        $internet=1;
}
ManiaLive\libraries\ManiaLive\Features\Updater.php Line 47

Code: Select all

			
if ($internet=1)
{
        $this->checkUpdate();
        $this->lastDisplayed = time() + 3600;
}
ManiaLive\libraries\ManiaLive\PluginHandler\PluginHandler.php Line 158

Code: Select all

			
if ($internet=1)
{
	     $plugin->onReady();
}

Re: Lan Mode

Posted: 09 Jul 2011, 12:49
by svens
The last if clauses smell a bit. Did you mean to use '=='?

Re: Lan Mode

Posted: 09 Jul 2011, 13:03
by jonthekiller
No, only one =

I have test with == and it don't work.

Re: Lan Mode

Posted: 09 Jul 2011, 13:54
by TheM
jonthekiller wrote:No, only one =

I have test with == and it don't work.
It is wrong to not execute the isReady() function of the plugins.
In that function many important things are executed.

Re: Lan Mode

Posted: 09 Jul 2011, 15:04
by jonthekiller
It's the only solution I have found actually.

We need to desactivate the function onTick on Updater.php.

After when I launch manialive, MLEPP try to verify the version on internet and it don't have a timeout. When a player connect to the server manialive crash.

You have an other solution?

Re: Lan Mode

Posted: 09 Jul 2011, 16:16
by TheM
jonthekiller wrote:It's the only solution I have found actually.

We need to desactivate the function onTick on Updater.php.

After when I launch manialive, MLEPP try to verify the version on internet and it don't have a timeout. When a player connect to the server manialive crash.

You have an other solution?
I'll try to add an offline mode configoption into MLEPP's upcomming release.

Re: Lan Mode

Posted: 11 Jul 2011, 09:09
by farfa
I added a LAN mod couple of moth ago, to disable the updater. I'll go dig the code to find out how it works to enable it ;)

I dived in the code and I find this:

Code: Select all

if(!Loader::$config->lanMode)
{
	Updater::getInstance();
}
so to enable lanMode in your server just add this in your config.ini

Code: Select all

lanMode = true
Maybe I'll add, this as an option in the command line at startup

Re: Lan Mode

Posted: 11 Jul 2011, 11:24
by jonthekiller
Ok, it's better to add this in config.ini with quote for all people who search to launch manialive in lan mode.

Maybe it's good if you make this option on PluginHandler or other file for make updates for all plugins.

All plugins can use the same system for updates like this

Code: Select all

name_plugin =
url_update = http://....
version = ...
url_checkversion = http://....
And if lanMode is true, any plugin check a new version.

Re: Lan Mode

Posted: 11 Jul 2011, 13:31
by farfa
You can load this option from the config in any plugin you want ;)