2015-06-16 18:40:54 +02:00
|
|
|
# Central Message
|
|
|
|
## Overview
|
|
|
|
* Description: Simple API to display short messages at the center of the screen
|
|
|
|
* Author: Wuzzy
|
|
|
|
* License of everything: WTFPL
|
|
|
|
* Shortname: `central_message`
|
2015-07-03 23:55:25 +02:00
|
|
|
* Version: 0.1.1 (using Semantic Versioning 2.0.0, see [SemVer](http://semver.org/))
|
2015-06-16 18:40:54 +02:00
|
|
|
|
|
|
|
## Longer description
|
|
|
|
This Minetest mod allows other mods to display a short message at the center of the screen.
|
|
|
|
Each message is displayed for 5 seconds, then it is removed.
|
|
|
|
When multiple messages are pushed quickly in succession, the messages will be “stacked”
|
|
|
|
on the screen.
|
|
|
|
|
|
|
|
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:
|
|
|
|
* 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
|
|
|
|
|
2015-07-01 23:59:49 +02:00
|
|
|
## Settings
|
|
|
|
This mod can be configured via `minetest.conf`.
|
|
|
|
|
|
|
|
Currently, one setting is recognized:
|
|
|
|
|
|
|
|
* `central_message_max`: Limit the number of messages displayed at once, by providing a number. Use `inf` here for no limit. Default: 7
|
|
|
|
|
2015-06-16 18:40:54 +02:00
|
|
|
|
|
|
|
## API
|
|
|
|
### `cmsg.push_message_player(player, message, color)`
|
|
|
|
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
|
|
|
|
* `color`: Optional. A `ColorString` for the color of the text. Default: `0xFFFFFF` (white)
|
|
|
|
|
|
|
|
#### Return value
|
|
|
|
Always `nil`.
|
|
|
|
|
|
|
|
|
|
|
|
### `cmsg.push_message_all(message, color)`
|
|
|
|
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
|
|
|
|
* `color`: Optional. A `ColorString` for the color of the text. Default: `0xFFFFFF` (white)
|
|
|
|
|
|
|
|
#### Return value
|
|
|
|
Always `nil`.
|