Added README.md

This commit is contained in:
Alden Peeters 2019-09-08 23:53:15 -04:00
parent a757cd1362
commit 7a77f6cb07
No known key found for this signature in database
GPG Key ID: CDAD63AE9DA934BE
3 changed files with 59 additions and 3 deletions

1
.gitignore vendored

@ -1,4 +1,5 @@
*
!*.lua
!*.md
!mod.conf
!.gitignore

55
README.md Normal file

@ -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 <faction> <password>`: Create a new faction
- `/factions list`: List available factions
- `/factions info <faction>`: See information on a faction
- `/factions join <faction> <password>`: Join an existing faction
- `/factions leave`: Leave your faction
These extra commands can only be used by faction owners:
- `/factions kick <player>`: 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).

@ -212,15 +212,15 @@ local function handle_command(name, param)
end
minetest.register_chatcommand("factions", {
params = "create <faction>: "..S("Found a new faction").."\n"
params = "create <faction> <password>: "..S("Create a new faction").."\n"
.."list: "..S("List available factions").."\n"
.."info <faction>: "..S("See information on a faction").."\n"
.."join <faction>: "..S("Join an existing faction").."\n"
.."join <faction> <password>: "..S("Join an existing faction").."\n"
.."leave: "..S("Leave your faction").."\n"
.."kick <player>: "..S("Kick someone from your faction").."\n"
.."disband: "..S("Disband your faction").."\n"
.."passwd <password>: "..S("Change your faction's password").."\n"
.."chown <player>:"..S("Transfer ownership to someone else").."\n",
.."chown <player>:"..S("Transfer ownership of your faction").."\n",
description = "",
privs = {},