Here's a straight forward set of steps for adding a new module to your NakedMud game engine.
- Hera of Athens (athensmud.com) p.s. NOM stands for Name of Module.
Edit Makefile in Src Directory:
In the area for optional Modules, Add:
Modules += (name of module)
In the Src Directory
type:
mkdir (name of module)
create files:
module.mk
module.mk:
# include all of the source files contained in this module
SRC += (nom)/(nom).c
nom.c:
// include all the header files we will need from the mud core
#include "../file.h"
// include headers from other modules that we require
#include "../mod/mod.h"
// include headers for this module
# include "nom.h"
// boot up the module
void init_nom(void)
{
}
nom.H:
#ifndef NOM_H
#define NOM_H
// this function should be called when the mud first boots up.
// calling it will initialize the module for use.
void init_nom(void);
#endif // NOM_H
In mud.h (main src directory): (this line can be commented out to shut the whole module off)
with the rest of the module definitions add:
#define MODULE_NOM
In gameloop.c, call the init fucntion:
In headers for optional modules:
#ifdef MODULE_NOM
#include "nom/nom.h"
#endif
Farther down in gameloop.c, where modules are initialized, in the main() function:
#indef MODULE_NOM
log_string("Initializing nom system.");
init_nom();
#endif