incrementaltp: respect physics overrides
[waspsaliva.git] / clientmods / commands / init.lua
blob68f027006f2a9537fe7f3be3fdc60a1865d6befc
1 if INIT == "client" then
3 core.register_chatcommand("say", {
4         description = "Send raw text",
5         func = function(text)
6                 minetest.send_chat_message(text)
7                 return true
8         end,
9 })
11 core.register_chatcommand("teleport", {
12         params = "<X>,<Y>,<Z>",
13         description = "Teleport to relative coordinates.",
14         func = function(param)
15                 local success, pos = minetest.parse_relative_pos(param)
16                 if success then
17                         minetest.localplayer:set_pos(pos)
18                         return true, "Teleporting to " .. minetest.pos_to_string(pos)
19                 end
20                 return false, pos
21         end,
24 core.register_chatcommand("wielded", {
25         description = "Print itemstring of wieleded item",
26         func = function()
27                 return true, minetest.localplayer:get_wielded_item():get_name()
28         end
31 core.register_chatcommand("disconnect", {
32         description = "Exit to main menu",
33         func = function(param)
34                 minetest.disconnect()
35         end,
38 core.register_chatcommand("players", {
39         description = "List online players",
40         func = function(param)
41                 return true, "Online players: " .. table.concat(minetest.get_player_names(), ", ")
42         end
45 core.register_chatcommand("kill", {
46         description = "Kill yourself",
47         func = function()
48                 minetest.send_damage(minetest.localplayer:get_hp())
49         end,
52 core.register_chatcommand("hop", {
53         description = "Hop",
54         func = function()
55                 minetest.set_keypress("jump", true)
56         end,
59 core.register_chatcommand("set", {
60         params = "([-n] <name> <value>) | <name>",
61         description = "Set or read client configuration setting",
62         func = function(param)
63                 local arg, setname, setvalue = string.match(param, "(-[n]) ([^ ]+) (.+)")
64                 if arg and arg == "-n" and setname and setvalue then
65                         minetest.settings:set(setname, setvalue)
66                         return true, setname .. " = " .. setvalue
67                 end
69                 setname, setvalue = string.match(param, "([^ ]+) (.+)")
70                 if setname and setvalue then
71                         if not minetest.settings:get(setname) then
72                                 return false, "Failed. Use '.set -n <name> <value>' to create a new setting."
73                         end
74                         minetest.settings:set(setname, setvalue)
75                         return true, setname .. " = " .. setvalue
76                 end
78                 setname = string.match(param, "([^ ]+)")
79                 if setname then
80                         setvalue = minetest.settings:get(setname)
81                         if not setvalue then
82                                 setvalue = "<not set>"
83                         end
84                         return true, setname .. " = " .. setvalue
85                 end
87                 return false, "Invalid parameters (see .help set)."
88         end,
91 end