2015-06-16 09:40:54 -07:00
|
|
|
# Central Message
|
|
|
|
## Overview
|
2017-02-09 03:43:57 -08:00
|
|
|
* Description: Simple API and server command to display short messages at the center of the screen
|
2015-06-16 09:40:54 -07:00
|
|
|
* Author: Wuzzy
|
2019-03-20 07:14:17 -07:00
|
|
|
* License of everything: MIT License
|
2015-06-16 09:40:54 -07:00
|
|
|
* Shortname: `central_message`
|
2016-11-12 10:18:58 -08:00
|
|
|
* Version: 0.3.0 (using Semantic Versioning 2.0.0, see [SemVer](http://semver.org/))
|
2015-06-16 09:40:54 -07:00
|
|
|
|
|
|
|
## Longer description
|
|
|
|
This Minetest mod allows other mods to display a short message at the center of the screen.
|
2016-11-03 20:09:40 -07:00
|
|
|
Each message is displayed for a few seconds, then it is removed.
|
2015-06-16 09:40:54 -07:00
|
|
|
When multiple messages are pushed quickly in succession, the messages will be “stacked”
|
|
|
|
on the screen.
|
|
|
|
|
2017-02-09 03:43:57 -08:00
|
|
|
This mod adds the server command “cmsg” as well as an API for mods to display messages.
|
|
|
|
The syntax is “`/cmsg <player> <text>`”. If `<player>` is “*”, the message is sent to all players.
|
|
|
|
|
2015-06-16 09:40:54 -07:00
|
|
|
This mod can be useful to inform about all sorts of events and is an alternative to use the chat log
|
|
|
|
to display special events.
|
|
|
|
|
|
|
|
Some usage examples:
|
2016-11-08 19:49:00 -08:00
|
|
|
|
2015-06-16 09:40:54 -07:00
|
|
|
* Messages about game events, like victory, defeat, next round starting, etc.
|
|
|
|
* Error message directed to a single player
|
|
|
|
* Informational messages
|
|
|
|
* Administational messages to warn players about a coming server shutdown
|
2017-02-09 03:43:57 -08:00
|
|
|
* Show messages by using a command block from Mesecons
|
2015-06-16 09:40:54 -07:00
|
|
|
|
2015-07-01 14:59:49 -07:00
|
|
|
## Settings
|
|
|
|
This mod can be configured via `minetest.conf`.
|
|
|
|
|
2015-07-14 21:37:32 -07:00
|
|
|
Currently, these settings are recognized:
|
2015-07-01 14:59:49 -07:00
|
|
|
|
2016-11-03 19:55:09 -07:00
|
|
|
* `central_message_max`: Limit the number of messages displayed at once, by providing a number. Use `0` for no limit. Default: `7`
|
2016-11-12 10:17:12 -08:00
|
|
|
* `central_message_time`: How long (in seconds) a message is shown. Default: `5`
|
2016-11-03 18:08:30 -07:00
|
|
|
* `central_message_color`: Set the message color of all messages. Value must be of format `(R,G,B)`. Default: `(255,255,255)` (white).
|
2015-07-01 14:59:49 -07:00
|
|
|
|
2015-06-16 09:40:54 -07:00
|
|
|
|
|
|
|
## API
|
2015-07-14 21:37:32 -07:00
|
|
|
### `cmsg.push_message_player(player, message)`
|
2015-06-16 09:40:54 -07:00
|
|
|
Display a new message to one player only.
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
* `player`: An `ObjectRef` to the player to which to send the message
|
|
|
|
* `message`: A `string` containing the message to be displayed to the player
|
|
|
|
|
|
|
|
#### Return value
|
|
|
|
Always `nil`.
|
|
|
|
|
|
|
|
|
2015-07-14 21:37:32 -07:00
|
|
|
### `cmsg.push_message_all(message)`
|
2015-06-16 09:40:54 -07:00
|
|
|
Display a new message to all connected players.
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
* `player`: An `ObjectRef` to the player to which to send the message
|
|
|
|
* `message`: A `string` containing the message to be displayed to all players
|
|
|
|
|
|
|
|
#### Return value
|
|
|
|
Always `nil`.
|