From 7a77f6cb0744592f6e02970b931a87958b70bb8a Mon Sep 17 00:00:00 2001 From: Alden Peeters Date: Sun, 8 Sep 2019 23:53:15 -0400 Subject: [PATCH] Added README.md --- .gitignore | 1 + README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ init.lua | 6 +++--- 3 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/.gitignore b/.gitignore index f540814..6812db9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ * !*.lua +!*.md !mod.conf !.gitignore diff --git a/README.md b/README.md new file mode 100644 index 0000000..5132072 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# Factions + +A simple mod which allows player created factions. Not very useful on its own, it becomes very powerful when combined with other mods. + +## Usage + +These commands can be used by anyone: + +- `/factions create `: Create a new faction +- `/factions list`: List available factions +- `/factions info `: See information on a faction +- `/factions join `: Join an existing faction +- `/factions leave`: Leave your faction + +These extra commands can only be used by faction owners: + +- `/factions kick `: Kick someone from your faction +- `/factions disband`: Disband your faction +- `/factions passwd`: Change your faction's password +- `/factions chown`: Transfer ownership of your faction + +## Translations + +As mentioned below, this mod has support for `intllib`! If you know English and another language, please submit a translation! It would be greatly appreciated, and your name will be added to the acknowledgements at the bottom of this page. Thanks! + +## Mod integration + +The following mods have optional support for `factions`: + +- `areas`: Protect faction territory using areas +- `beerchat`: Create private faction channels + +Additionally, `factions` can optionally depend on the following mods: + +- `protector_redo`: Protect faction territory using protection blocks +- `intllib`: Provide localizations for different languages + +### Using `factions` in your own mod + +I strongly recommend reading through the `init.lua` file; the functions at the top give you a pretty good idea of how to use it, but just in case you're short on time I'll list the most important functions below. + +- `get_player_faction(player)`: Get the faction a player belongs to, `nil` if they haven't joined a faction +- `get_owner(faction)`: Get the owner of a faction +- `register_faction(faction, player, password)`: Create a new faction +- `disband_faction(faction)`: Disband a faction +- `get_password(faction)`: Gets a faction's password +- `set_password(faction, password)`: Sets a faction's password +- `join_faction(faction, player)`: Sets the given player as belonging to this faction +- `leave_faction(player)`: Clears a player's faction + +Note that none of these functions have any sanity checks (e.g. making sure factions exist), so I strongly recommend you read `init.lua` to determine how they are used. Otherwise, you could end up getting some pretty strange errors. + +## Acknowledgements + +This mod is loosely based off of the (unmaintained) [factions mod made by Jonjeg](https://github.com/Jonjeg/factions). diff --git a/init.lua b/init.lua index 38b70f1..0213cbd 100644 --- a/init.lua +++ b/init.lua @@ -212,15 +212,15 @@ local function handle_command(name, param) end minetest.register_chatcommand("factions", { - params = "create : "..S("Found a new faction").."\n" + params = "create : "..S("Create a new faction").."\n" .."list: "..S("List available factions").."\n" .."info : "..S("See information on a faction").."\n" - .."join : "..S("Join an existing faction").."\n" + .."join : "..S("Join an existing faction").."\n" .."leave: "..S("Leave your faction").."\n" .."kick : "..S("Kick someone from your faction").."\n" .."disband: "..S("Disband your faction").."\n" .."passwd : "..S("Change your faction's password").."\n" - .."chown :"..S("Transfer ownership to someone else").."\n", + .."chown :"..S("Transfer ownership of your faction").."\n", description = "", privs = {},