Move pencil into tools.lua
This commit is contained in:
parent
43dadcb706
commit
4f9e5a6434
@ -5,10 +5,10 @@ boilerplate = false
|
|||||||
style = true
|
style = true
|
||||||
|
|
||||||
file = {
|
file = {
|
||||||
"init.lua",
|
|
||||||
"settings.lua",
|
"settings.lua",
|
||||||
"api.lua",
|
"api.lua",
|
||||||
"chat.lua",
|
"chat.lua",
|
||||||
|
"tools.lua",
|
||||||
}
|
}
|
||||||
|
|
||||||
new_type("chatcmd", "Chat Commands")
|
new_type("chatcmd", "Chat Commands")
|
||||||
|
46
init.lua
46
init.lua
@ -1,9 +1,4 @@
|
|||||||
|
|
||||||
--- Cleaner
|
|
||||||
--
|
|
||||||
-- @topic tools
|
|
||||||
|
|
||||||
|
|
||||||
cleaner = {}
|
cleaner = {}
|
||||||
cleaner.modname = core.get_current_modname()
|
cleaner.modname = core.get_current_modname()
|
||||||
cleaner.modpath = core.get_modpath(cleaner.modname)
|
cleaner.modpath = core.get_modpath(cleaner.modname)
|
||||||
@ -41,6 +36,7 @@ local scripts = {
|
|||||||
"settings",
|
"settings",
|
||||||
"api",
|
"api",
|
||||||
"chat",
|
"chat",
|
||||||
|
"tools",
|
||||||
"entities",
|
"entities",
|
||||||
"nodes",
|
"nodes",
|
||||||
"items",
|
"items",
|
||||||
@ -50,43 +46,3 @@ local scripts = {
|
|||||||
for _, script in ipairs(scripts) do
|
for _, script in ipairs(scripts) do
|
||||||
dofile(cleaner.modpath .. "/" .. script .. ".lua")
|
dofile(cleaner.modpath .. "/" .. script .. ".lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local S = core.get_translator(cleaner.modname)
|
|
||||||
|
|
||||||
|
|
||||||
local sound_handle
|
|
||||||
|
|
||||||
--- Master Pencil
|
|
||||||
--
|
|
||||||
-- @tool cleaner:pencil
|
|
||||||
-- @img cleaner_pencil.png
|
|
||||||
-- @privs server
|
|
||||||
-- @usage
|
|
||||||
-- place (right-click):
|
|
||||||
-- - when not pointing at a node, changes modes
|
|
||||||
-- - when pointing at a node, sets node to be used
|
|
||||||
--
|
|
||||||
-- use (left-click):
|
|
||||||
-- - executes action for current mode:
|
|
||||||
-- - erase: erases pointed node
|
|
||||||
-- - write: adds node
|
|
||||||
-- - swap: replaces pointed node
|
|
||||||
core.register_tool(cleaner.modname .. ":pencil", {
|
|
||||||
description = S("Master Pencil"),
|
|
||||||
inventory_image = "cleaner_pencil.png",
|
|
||||||
liquids_pointable = true,
|
|
||||||
on_use = aux.tool.on_use,
|
|
||||||
on_secondary_use = aux.tool.on_secondary_use,
|
|
||||||
on_place = aux.tool.on_place,
|
|
||||||
})
|
|
||||||
|
|
||||||
core.register_tool(cleaner.modname .. ":pencil_1", {
|
|
||||||
description = S("Master Pencil"),
|
|
||||||
inventory_image = "cleaner_pencil.png^[transformFXFY",
|
|
||||||
liquids_pointable = true,
|
|
||||||
groups = {not_in_creative_inventory=1},
|
|
||||||
on_use = aux.tool.on_use,
|
|
||||||
on_secondary_use = aux.tool.on_secondary_use,
|
|
||||||
on_place = aux.tool.on_place,
|
|
||||||
})
|
|
||||||
|
46
tools.lua
Normal file
46
tools.lua
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
--- Cleaner Tools
|
||||||
|
--
|
||||||
|
-- @topic tools
|
||||||
|
|
||||||
|
|
||||||
|
local S = core.get_translator(cleaner.modname)
|
||||||
|
|
||||||
|
|
||||||
|
local aux = dofile(cleaner.modpath .. "/misc_functions.lua")
|
||||||
|
|
||||||
|
local sound_handle
|
||||||
|
|
||||||
|
--- Master Pencil
|
||||||
|
--
|
||||||
|
-- @tool cleaner:pencil
|
||||||
|
-- @img cleaner_pencil.png
|
||||||
|
-- @privs server
|
||||||
|
-- @usage
|
||||||
|
-- place (right-click):
|
||||||
|
-- - when not pointing at a node, changes modes
|
||||||
|
-- - when pointing at a node, sets node to be used
|
||||||
|
--
|
||||||
|
-- use (left-click):
|
||||||
|
-- - executes action for current mode:
|
||||||
|
-- - erase: erases pointed node
|
||||||
|
-- - write: adds node
|
||||||
|
-- - swap: replaces pointed node
|
||||||
|
core.register_tool(cleaner.modname .. ":pencil", {
|
||||||
|
description = S("Master Pencil"),
|
||||||
|
inventory_image = "cleaner_pencil.png",
|
||||||
|
liquids_pointable = true,
|
||||||
|
on_use = aux.tool.on_use,
|
||||||
|
on_secondary_use = aux.tool.on_secondary_use,
|
||||||
|
on_place = aux.tool.on_place,
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_tool(cleaner.modname .. ":pencil_1", {
|
||||||
|
description = S("Master Pencil"),
|
||||||
|
inventory_image = "cleaner_pencil.png^[transformFXFY",
|
||||||
|
liquids_pointable = true,
|
||||||
|
groups = {not_in_creative_inventory=1},
|
||||||
|
on_use = aux.tool.on_use,
|
||||||
|
on_secondary_use = aux.tool.on_secondary_use,
|
||||||
|
on_place = aux.tool.on_place,
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user