From 0022f59d8c2f4038350acab7aed9ae1fe3093068 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Thu, 27 Aug 2015 02:06:29 +0200 Subject: [PATCH] add contribute file --- README.md | 2 +- doc/contribute.md | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 doc/contribute.md diff --git a/README.md b/README.md index 588bd6d..e05c684 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Before running or building it is recommended that you configure the server in co Documentation for how to operate and how to customize your server are coming soon! ## Dev Documentation -For development see [api.md](doc/api.md) +For development see [api.md](doc/api.md) and [contribute.md](doc/contribute.md) ## Contributors diff --git a/doc/contribute.md b/doc/contribute.md new file mode 100644 index 0000000..2cdb8d3 --- /dev/null +++ b/doc/contribute.md @@ -0,0 +1,36 @@ +# Contribute + +## Architecture of the project + +Directory architecture : + +* app.js : specific settings and actually start the server +* index.js : contain the generic server implementation +* lib/ : contain the classes and functions used in the plugins + * serverPlugins/ : server plugins that do things general to the server, + properties and method are added to the server object in them + * playerPlugins/ : player plugins that do things for each player, + properties and method are added to the player object in them + +Structure of a server plugin : + +```js +module.exports=inject; + +function inject(serv) +{ + // add methods and properties to serv +} +``` + +Structure of a player plugin : + +```js +module.exports=inject; + +function inject(serv,player) +{ + // add methods and properties to player + // you can use serv, but you shouldn't add things to it here +} +``` \ No newline at end of file