[Mod] usergroups

Post Reply
cedric
New member
Posts: 1
Joined: Sun Dec 17, 2017 13:53
GitHub: cedrichaase
In-game: ced

[Mod] usergroups

by cedric » Post

Hey everyone,

so I just started out playing minetest a couple of weeks ago and I've already fallen in love with the ease of modding and configuration as well as the outstanding community that has built so many amazing mods. So, first of all, to those involved: thank you!

I recently wanted to protect areas of the map on the server I'm hosting without revoking interact privileges from new players per se. I came across the areas mod by ShadowNinja, which restricts interaction in configurable areas on a per-user basis. Great! However, I would like to be able to assign areas to groups of users, rather than users individually. As indicated by this rather old github issue, I'm not alone with this!

Sadly, I didn't find a way of managing groups of users from within the minetest API. This seems like a pretty universal and useful feature to me, so I was kind of surprised not to find anything. I wasn't sure if I was missing something, but I wanted to get my hands dirty and develop a minetest mod anyway, so I started throwing together this usergroups mod.

github: https://github.com/cedrichaase/usergroups

Right now, this mod is only used in my fork of ShadowNinja's area mod.
Any feedback is greatly appreciated!



usergroups adds the following chatcommands:

Code: Select all

/groups_list [group]
If no group is provided, this will list all available groups. If a group name is provided, this will list all members of the group.

Code: Select all

/groups_add <group> <username>
Adds a user to a group. If the group does not exist, it will be created first.

Code: Select all

/groups_remove <group> <username>
Removes a user from a group.


usergroups exposes the following API methods to other mods via a global table called "usergroups":

Code: Select all

usergroups:get_users(group)
Returns an array-like table of users that belong to the given group.

Code: Select all

usergroups:group_exists(group)
Returns true if the group exists, false if it doesn't.

Code: Select all

usergroups:user_is_in_group(user, group)
Returns true if given user is a member of the group and false if not.

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests