-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
97 lines (71 loc) · 2.38 KB
/
init.lua
File metadata and controls
97 lines (71 loc) · 2.38 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
local version = "0.1.13"
lwcreative_tools = { }
function lwcreative_tools.version ()
return version
end
local utils = { }
local modpath = minetest.get_modpath ("lwcreative_tools")
loadfile (modpath.."/settings.lua") (utils)
loadfile (modpath.."/utils.lua") (utils)
loadfile (modpath.."/deserializer.lua") (utils)
loadfile (modpath.."/long_process.lua") (utils)
loadfile (modpath.."/undo.lua") (utils)
loadfile (modpath.."/area_fill.lua") (utils)
loadfile (modpath.."/area_replace.lua") (utils)
loadfile (modpath.."/area_substitute.lua") (utils)
loadfile (modpath.."/linear_fill.lua") (utils)
loadfile (modpath.."/linear_replace.lua") (utils)
loadfile (modpath.."/linear_substitute.lua") (utils)
loadfile (modpath.."/copy_cube.lua") (utils)
loadfile (modpath.."/copy.lua") (utils)
loadfile (modpath.."/paste_replace.lua") (utils)
loadfile (modpath.."/paste_fill.lua") (utils)
loadfile (modpath.."/measure.lua") (utils)
if utils.settings.use_storage then
loadfile (modpath.."/save.lua") (utils)
loadfile (modpath.."/load.lua") (utils)
loadfile (modpath.."/copy_buffer.lua") (utils)
end
minetest.register_privilege ("lwcreative_tools", {
description = "Allow creative tool usage.",
give_to_singleplayer = true,
give_to_admin = true,
on_grant = function (name, granter_name)
return false
end,
on_revoke = function (name, revoker_name)
return false
end,
})
local function undo_runner (player_name)
if not utils.undo_action (player_name) then
utils.player_error_message (player_name, "Nothing to undo!")
end
end
minetest.register_chatcommand ("lwctundo", {
params = "", -- Short parameter description
description = "Undo last creative tool action.", -- Full description
privs = { lwcreative_tools = true }, -- Require the "privs" privilege to run
func = function (name, param)
if name then
if not utils.add_long_process (name, undo_runner, nil, name) then
utils.player_error_message (name, "An operation is already in progress!")
end
end
return true
end,
})
minetest.register_chatcommand ("lwctclear", {
params = "", -- Short parameter description
description = "Clear last creative tool action (free memory).", -- Full description
privs = { lwcreative_tools = true }, -- Require the "privs" privilege to run
func = function (name, param)
if name then
if not utils.clear_action (name) then
return false, "Nothing to clear."
end
end
return true
end,
})
--