Go to file
rubenwardy 1e7b11f824 Relicense to MIT 2022-09-03 15:32:59 +01:00
locale Add french translation and template 2019-11-28 23:43:02 +01:00
tests Make mod translatable 2019-11-24 14:55:59 +00:00
utils Redesign sfinv page using FS version 3 2019-11-24 15:58:44 +00:00
.editorconfig Add .editorconfig 2019-12-19 21:45:56 +00:00
.gitignore Initial commit 2019-07-09 23:55:56 +01:00
.gitlab-ci.yml Add Gitlab CI support 2019-11-30 17:46:22 +00:00
.luacheckrc Add unified inventory support and chatcommand 2019-12-10 19:50:37 +00:00
LICENSE.txt Relicense to MIT 2022-09-03 15:32:59 +01:00
README.md Relicense to MIT 2022-09-03 15:32:59 +01:00
actions.lua Fix broken action buttons 2019-12-19 21:27:49 +00:00
api.lua Fix crash on user that has left the game 2020-01-06 19:20:23 +00:00
freeze.lua Improve frozen code 2019-12-19 21:38:55 +00:00
gui_dash.lua Fix crash on user that has left the game 2020-01-06 19:20:23 +00:00
gui_group.lua Fix unit test failure due to lack of string.trim() function 2019-12-10 20:14:58 +00:00
init.lua Add freeze feature 2019-12-19 21:27:58 +00:00
mod.conf Add unified inventory support and chatcommand 2019-12-10 19:50:37 +00:00

README.md

Classroom Manager

An easy way to manage students in-game, with support for bulk actions and macros.

An action is something that can be performed on a selection of students. You can use actions to move players, grant/revoke privs, and more. A list of built-in actions can be found below, however, you can add more actions using the API for this mod.

This mod requires Minetest 5.1 or later.

Author: rubenwardy
License: MIT

Usage

First, make sure that you grant the teacher priv to any teachers like so:

/grant username teacher

This allows them to access the classroom control panel, and exempts them from being included in actions.

Open the Inventory and switch to the classroom tab. Only sfinv is supported currently.

  • The set of students that an action works on depends on the toggle bar at the top.
    • All: apply the action to all students, but not teachers.
    • Group: apply the action to all students in the currently selected group.
    • Selected: apply the action only to the student that is currently selected.
  • You can changed the selected group using the tab header to the left.
  • You can manage groups using the New/Edit Group buttons in the top-right.
    • Use > to add the selected player to the group, < to remove.

Actions

Name Behaviour
Bring Teleports users to your position
Look Rotates the users to look at the teacher
Mute/Unmute Grants or revokes the ability to use chat
Fly/No fly Grants or revokes the ability to fly (key: K)
Kick Remove from the server
Ban Permanently exclude from the server
Audience Move to the crosshair location, spread out and facing you

API

WARNING: This API is unstable, and breaking changes may be introduced before 1.0 is released.

Selectors

A selector is a string which represents a selection of students.

  • * - All students
  • group:<name> - All students in group <name>
  • user:<name> - The user <name>

Actions

classroom.register_action("mymod:bring", {
	-- Button text
	title = "Bring",

	-- Button tooltip
	description = "Teleport players to your location",

	-- Whether this should be restricted to online players
	--  TODO: false isn't supported yet
	online_required = true,

	-- Function to perform the action
	func = function(runner, names)
		local pos = runner:get_pos()
		for i=1, #names do
			local player = minetest.get_player_by_name(names[i])
			player:set_pos(pos)
		end
	end,

	-- Custom keys are allowed
})

Group

{
	-- Human-readable group name
	name = name,

	-- List of student names
	students = {},

	-- Custom keys are allowed
}

Methods

  • classroom.get_students()
    • Get online students
    • Returns list of player names
  • classroom.get_group_students(name)
    • Get students in group, some students may be offline
    • Returns list of player names
  • classroom.get_students_except(excluded_students)
    • Get online students not in the list excluded_students
    • Returns list of player names
  • classroom.get_all_groups()
    • Returns table of groupname -> group
  • classroom.get_group(name)
    • Returns group
  • classroom.create_group(name)
    • Creates a group
    • Returns the newly created group or nil if the name already exists
  • classroom.add_student_to_group(group_name, student_name)
  • classroom.remove_student_from_group(group_name, student_name)
  • classroom.register_action(name, action_def)
  • classroom.get_actions()
    • Returns list of action defs
  • classroom.get_students_by_selector(selector)
    • Gets online students using a selector.
    • Returns list of player names