Plugins

The servers have different plugins. Each plugin is an independent entity. The plugin can track various server events, and also somehow respond to them using a list of commands defined by the server.

How to install plugin

  1. First way. Edit plugins_list table in plugins_manager.lua

  2. The same as the first one, but you can not specify the data field there, but only order, and throw the plugin itself with the .lua extension into plugins folder

  3. The third way is the most convenient. Just drop plugin into plugins folder with the .lua extension, and it will automatically pick up. You no longer need to add them manually in a text editor, just move them to a folder. If you need to adjust the order of calling plugins (first one, then the other), then see the second method of application.

All use cases are in the plugin manager

API

  • call_function - call some function. This can be either a server-side function or a function of another plugin registered in the shared space.

  • register_function - register a function, it can then be called using call_function. Useful to enable other plugins to get some info. For example, the system plugin defines a kick function with an appropriate message. And this ready-made function can be used by any other plugin

  • register_command - register a command. For example, we want the player to receive the message abrakadabra when they enter the command /test

  • set_data - set data (required for interaction between plugins)

  • get_data - get data (needed for interaction between plugins). For example, you need to find out the player's nickname

  • remove_data - remove data

  • send_data - send data. You can send data to the client. True, the client will only respond to the data whose list is defined on its side. For example, you can use this plugin to force the player to update map data

  • set_server_state - set the state of the server (ready, off, starting)

  • start - start the server

What events does the plugin track?

  • init - server start

  • verify_registration - player verification (the server checks whether to let the player into the game or not)

  • on_player_registered - player registration on the server (when a player connects, he is given a country, he is added to the list of players)

  • on_player_joined - moment when the player loaded the map (for example, sending him a request to display the rules before this moment does not make sense, because the player is in the menu)

  • on_player_disconnected - player is disconnected

  • on_data - receive data from client

  • before_next - event before next turn

  • game_over - game over

  • attribute_message - message formatting

Analyze standard afk plugin

Last updated

Was this helpful?