mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-09 05:00:56 +00:00
Fixed grammar and 'craftyjs'
This commit is contained in:
parent
02e6258e25
commit
470e956c4c
1 changed files with 12 additions and 14 deletions
|
|
@ -9,8 +9,7 @@ Directory architecture :
|
||||||
* lib/: contain the classes and functions used in the plugins
|
* lib/: contain the classes and functions used in the plugins
|
||||||
* serverPlugins/: server plugins that do things general to the server,
|
* serverPlugins/: server plugins that do things general to the server,
|
||||||
properties and method are added to the server object in them
|
properties and method are added to the server object in them
|
||||||
* playerPlugins/ : player plugins that do things for each player,
|
* playerPlugins/: player plugins that do things for each player, properties and method are added to the player object in them
|
||||||
properties and method are added to the player object in them
|
|
||||||
|
|
||||||
Structure of a server plugin:
|
Structure of a server plugin:
|
||||||
|
|
||||||
|
|
@ -50,7 +49,7 @@ Create a file in which you put an inject function like this :
|
||||||
```js
|
```js
|
||||||
module.exports=init;
|
module.exports=init;
|
||||||
|
|
||||||
function init(craftyjs) {
|
function init(flying-squid) {
|
||||||
return inject;
|
return inject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,10 +59,10 @@ function inject(serv)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
In the init function, you can use anything craftyjs provide
|
In the init function, you can use anything flying-squid provide
|
||||||
(see [index.js](https://github.com/mhsjlw/flying-squid/blob/master/index.js#L11)).
|
(see [index.js](https://github.com/mhsjlw/flying-squid/blob/master/index.js#L11)).
|
||||||
|
|
||||||
In the inject function you can use everything documented in the [api.md](api.md) to add functionnalities to the serv object.
|
In the inject function you can use everything documented in the [api.md](api.md) to add functionalities to the serv object.
|
||||||
|
|
||||||
Let's say you called your module flying-horses and you published it to npm.
|
Let's say you called your module flying-horses and you published it to npm.
|
||||||
|
|
||||||
|
|
@ -95,5 +94,4 @@ function injectPlayer(serv,player)
|
||||||
```
|
```
|
||||||
|
|
||||||
In this document, we explained how to create a simple plugin with just one file, but you can cut your code
|
In this document, we explained how to create a simple plugin with just one file, but you can cut your code
|
||||||
in several files by having several inject function and putting them in different files, just like flying-squid does
|
in several files by having several inject function and putting them in different files, just like flying-squid does for its internal plugins.
|
||||||
for its internal plugins.
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue