dev | ||
.luacheckrc | ||
api.lua | ||
chatcommand_add.lua | ||
chatcommand_copy.lua | ||
chatcommand_delete.lua | ||
chatcommand_help.lua | ||
chatcommand_list_all.lua | ||
chatcommand_list.lua | ||
chatcommand_say_all.lua | ||
chatcommand_say.lua | ||
chatcommands.lua | ||
config.lua | ||
globalsteps.lua | ||
init.lua | ||
initialize.lua | ||
internal.lua | ||
LICENSE | ||
mod.conf | ||
README.md | ||
screenshot.png | ||
settingtypes.txt | ||
setup.lua |
yl_announcements
Purpose
This mod allows you to send messages to your players in an interval.
Download
Get it from https://gitea.your-land.de/your-land/yl_announcements
Installation
- Copy the "yl_announcements" folder to your mod directory.
- Enable the mod in your world.mt file.
Configuration
yl_announcements.debug = false
Set to true to enable debug mode
yl_announcements.save_path
Set this to where in the worldfolder you want the JSON files stored.
yl_announcements.colour
Set this to the colour you want the announcements have in chat
yl_announcements.frequency
Set this to the default repeat timer you want the announcements have in chat. 3600 means "once per hour"
yl_announcements.user_privs
yl_announcements.admin_privs
Set those to the list of privs you want to allow the execution of the corresponding commands:
yl_announcements.user_privs allows
- listing single announcement
- copy single announcement
- listing all announcements
yl_announcements.admin_privs allows
- listing single announcement
- copy single announcement
- listing all announcements
- add announcement
- delete announcement
- say announcement to main chat
- say all announcements to main chat
Usage
This mod targets servers, but should work in singleplayer, too. It comes with no direct content but exposes functions you can use in your mod.
Data structure
One announcement consists of an id, a message, an owner, a runtime and a frequency. Example:
{
id = 1,
creation_date = os.time(),
message = "[EVENT] Don't forget to join the event tonight!",
owner = "Admin",
runtime = 1000000,
frequency = 3600
}
Those announcements sit in a table with id
as index:
{
1 = {announcement},
2 = {announcement},
["5"] = {announcement}
}
Chatcommands
/announcement_add message$frequency in seconds$runtime in seconds
Sends the message each frequency seconds for a maximum number of runtime seconds.
/announcement_copy announcement_id
Open the announcement with ID in a formspec, so it can be copied.
/announcement_delete announcement_id
Delete the announcement ID.
/announcement_list
List announcement with ID to you.
/announcement_list_all
Lists all announcements to you.
/announcement_say announcement_id
Say the announcement with ID in main chat.
/announcement_say_all
Say all announcements in main chat.
Modmakers
Use the following public functions to get, set, list and remove announcements
yl_announcements.get(announcement_id)
Returns a table with the values of this announcement_id. Returns nil
, if it does not exist. Returns false, "errormessage"
if an error occurred.
yl_announcements.set(message, frequency, runtime, owner)
Adds this announcement to the list and returns true, announcement_id
if accepted, false, "errormessage"
if not.
yl_announcements.formspec(announcement_id)
Returns true, formspecstring
if an announcement was found, with formspecstring including the /announcement_add
string, so it can be easily copied from. Returns false, errormessage
if an error occurred.
yl_announcements.delete(announcement_id)
Returns true, {announcement}
if one task was successfully removed, false, "errormessage"
otherwise.
yl_announcements.list()
Returns true, { id = {announcement}, ... }
if one or more announcements were found or false, {}
if none were found.
yl_announcements.say(announcement_id)
Returns true, {announcement}
if one announcement was found or false, {}
if none were found.
Limitations
- No colours
- No tags like [EVENT]
Alternatives
- For immediate one-time announcements, use the notification mod
- For future one-time announcements, use the yl_scheduler mod
Supported versions
If you run yl_announcements, but something is wrong, please file a bug. PRs also welcome.
There is no reason to believe it doesn't work anywhere, but you never know.
Allied projects
If you know a project that uses this mod tell us and we will add it to the list.
Uninstall
Remove it from your mod folder or deactivate it in your world.mt
Mods that depend on it will cease to work, if the mod is removed without proper replacement.
License
- Code MIT AliasAlreadyTaken
- Screenshot CC0 Styxcolor
Thank you
- Styxcolor