-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev_chatcommands.lua
50 lines (46 loc) · 1.18 KB
/
dev_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
44
45
46
47
48
49
50
core.register_chatcommand("forceduel", {
params = "<player name>",
description = "Force a player to duel",
func = function(caller, param)
local player = minetest.get_player_by_name(param)
if not player then
return false, "Player:"..param.." not found."
end
if duel.challenge(caller, param) then
duel.accept(param)
return true, "You have challenged "..param.." to a duel"
else
return false, "Duel already in progres"
end
end,
})
core.register_chatcommand("setstate", {
description = "set duel state",
func = function(caller, param)
duel_data.state = param
return true, "done"
end,
})
core.register_chatcommand("restore", {
description = "restore inventory",
func = function(caller, param)
local player = minetest.get_player_by_name(caller)
restore_player_inv(player)
return true, "done"
end,
})
core.register_chatcommand("save", {
description = "save inventory",
func = function(caller, param)
local player = minetest.get_player_by_name(caller)
save_player_inv(player)
return true, "done"
end,
})
core.register_chatcommand("dump", {
description = "dump data",
func = function(caller, param)
print(dump(duel_data))
return true, "done"
end,
})