Killer Monkey here, I am taking over Anthony's blog for today since I just made a significant step in coding. I have FULLY implemented LUA game modes! Thats correct, it has been extremely difficult, but with the help of Scott's base code I was able to do it over the past 5 days. In order to achieve this, I employed the following schematic:
As you can see, the classes at the top are CGERules, CGEPlayer, and Gameinterface. These three classes are what the server uses to define the playing of a game.
CGERules are logical functions and events that are called and can be acted on. In these calls, CGERules calls functions from CGELUAGamePlay that interfaces with LUA. In the absence of any defined LUA functions, it happily goes about what it would do normally (IE NO GAMEPLAY). When the rules are created at map load, the LUA classes are also loaded into memory using the helper classes CGEGameModeSystem and CGEGameMode. These classes store the various LUA gamemodes that are detected in the 'scripts/gameplay/' folder. During a course of play any gamemode can be loaded at any time and it will restart the round and start every player on a clean slate!
CGEPlayer calls CGELUAGamePlay to get definitions that affect the player, such as whether or not he should respawn, his current armor/health level, and how many times he died (in this case for YOLT).
GameInterface is where all the magic begins. This is called upon initialization of the server dll and calls the CGELUAGamePlay's init() function that loads LUA. That means LUA remains loaded until the server is shutdown making level loads highly efficient and also maintains stability between map sessions by remembering your last Game Mode and reloading it for you.
Finally, all you, the server owner, has to do is create a .lua file and .txt file that defines the gameplay for the parser. The LUA file will contain the functions called by CGELUAGameplay, you will also have access to a plethora of Call Back functions defined to set and retrieve data necessary to modify the gameplay. All of this code is server side, the only thing the client will see are UserMessages to update their HUD/VGUI windows!