The online racing simulator
#1 - Krayy
How about we go modular for 6.014+?
Hi guys,

Have you ever tried to upgrade your installation of Lapper only to find that it's blown away a bunch of your settings and customisations?

Well here's a possible answer that I want to run by you all...

The LFSLapper.lpr file is the heart of a Lapper installation and contains variable definitions, Event code, languages etc. What I would propose (and have done in a couple of tests) is to break that up into separate modules that can be modified independently which will make it easier to either update an instance of Lapper while keeping your modified content, or allow us to push out smaller updates to specific parts of Lapper.

Instead of having all of the code inside the main LFSLapper.lpr file, I move parts of it into different files in different directories, e.g. create a file called ./events/OnConnect.lpr that has this in it:

<?php 
#################################################
#Connect messages when a player joins the server#
#################################################

Event OnConnect$userName # Player event
    
$NickName GetCurrentPlayerVar("NickName");
    
$Posabs GetCurrentPlayerVar("PosAbs");
    
$Groupqual GetCurrentPlayerVar("GroupQual");

    
openPrivButton"welc",25,50,150,15,12,-1,ISB_NONElangEngine("%{main_welc1}%"$NickName ) );
    
openPrivButton"pos",25,80,150,10,8,-1,ISB_NONE,langEngine("%{main_welc2}%",$Posabs,$Posqual,$Groupqual  ) );
    
openPrivButton"clos",78,120,20,10,10,-1,ISB_DARK,langEngine("%{main_accept}%"),OnConnectClose );
    
openPrivButton"ref",103,120,20,10,10,-1,ISB_DARK,langEngine("%{main_deny}%"),OnConnectCloseKick );
    
http("http://www.frh-team.net/reglapper/getserver2.php" );
EndEvent

Sub OnConnectClose
$KeyFlags,$id )
    
closePrivButton("welc&pos&clos&ref");
EndSub

Sub OnConnectCloseKick
$KeyFlags,$id )
    
closePrivButton("welc&pos&clos&ref");
    
cmdLFS("/kick " GetCurrentPlayerVar("UserName") );
EndSub
?>


and then in LFSLapper.lpr file, comment out those Subs and the Event and put this:

<?php 
include("./events/OnConnect.lpr");
?>

Now if I want to update the OnConnect event code, I edit that external file instead of the main Lapper file which may break something else.

Do the same with languages by moving all of the language specific content into ./langs/en.lpr or ./langs/fr.lpr or whatever the language is.

What are your thoughts on this, as for mine I think it would make life a lot easier when upgrading Lapper or making your own mods.
I support to you. New updates, will in form patchs.
+1+1+1
Sounds like a great idea Krayy. Would make updating a breeze!

How about we go modular for 6.014+?
(3 posts, started )
FGED GREDG RDFGDR GSFDG