-
Notifications
You must be signed in to change notification settings - Fork 2
/
chatcommands.lua
43 lines (37 loc) · 1.1 KB
/
chatcommands.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
minetest.register_privilege("langton_ant","Can use langton_ant commands");
minetest.register_privilege("langton_ant_global","Can use langton_ant commands");
minetest.register_chatcommand("lant_start", {
params = "",
description = "Start langton_ant process",
privs = {langton_ant=true},
func = function(name,params)
local player = minetest.get_player_by_name(name)
if not player then
return false, "Player not found"
end
langton_ant.register_new_ant(player)
end
})
minetest.register_chatcommand("lant_stop", {
params = "",
description = "Stop langton_ant process",
privs = {langton_ant=true},
func = function(name,params)
local player = minetest.get_player_by_name(name)
if not player then
return false, "Player not found"
end
langton_ant.unregister_ant(player)
end
})
minetest.register_chatcommand("lant_set", {
params = "",
description = "",
privs = {langton_ant_global=true},
func = function(name,params)
local name,value = string.match(params,"([^ ]+) (.+)")
if name and value then
langton_ant.setvar(name,value)
end
end
})