1- if minetest .raycast == nil then
2- error (
3- " worldedit_brush requires at least Minetest 5.0"
4- )
5- end
6-
71local S = minetest .get_translator (" worldedit_brush" )
82
93local BRUSH_MAX_DIST = 150
@@ -20,7 +14,8 @@ local brush_on_use = function(itemstack, placer)
2014 local cmd = meta :get_string (" command" )
2115 if cmd == " " then
2216 worldedit .player_notify (name ,
23- S (" This brush is not bound, use //brush to bind a command to it." ))
17+ S (" This brush is not bound, use @1 to bind a command to it." ,
18+ minetest .colorize (" #00ffff" , " //brush" )))
2419 return false
2520 end
2621
@@ -78,7 +73,7 @@ minetest.register_tool(":worldedit:brush", {
7873worldedit .register_command (" brush" , {
7974 privs = {worldedit = true },
8075 params = S (" none/<cmd> [parameters]" ),
81- description = S (" Assign command to WorldEdit brush item" ),
76+ description = S (" Assign command to WorldEdit brush item or clear assignment using 'none' " ),
8277 parse = function (param )
8378 local found , _ , cmd , params = param :find (" ^([^%s]+)%s+(.+)$" )
8479 if not found then
@@ -105,21 +100,22 @@ worldedit.register_command("brush", {
105100 else
106101 local cmddef = worldedit .registered_commands [cmd ]
107102 if cmddef == nil or cmddef .require_pos ~= 1 then
108- worldedit .player_notify (name , S (" @1 cannot be used with brushes" , minetest .colorize (" #00ffff" , " //" .. cmd )))
103+ worldedit .player_notify (name , S (" @1 cannot be used with brushes" ,
104+ minetest .colorize (" #00ffff" , " //" .. cmd )))
109105 return
110106 end
111107
112108 -- Try parsing command params so we can give the user feedback
113109 local ok , err = cmddef .parse (params )
114110 if not ok then
115- err = err or " invalid usage"
116- worldedit .player_notify (name , S (" Error with brush command: @1" , err ))
111+ err = err or S ( " invalid usage" )
112+ worldedit .player_notify (name , S (" Error with command: @1" , err ))
117113 return
118114 end
119115
120116 meta :set_string (" command" , cmd )
121117 meta :set_string (" params" , params )
122- local fullcmd = " //" .. cmd .. " " .. params
118+ local fullcmd = minetest . colorize ( " #00ffff " , " //" .. cmd ) .. " " .. params
123119 meta :set_string (" description" ,
124120 minetest .registered_tools [" worldedit:brush" ].description .. " : " .. fullcmd )
125121 worldedit .player_notify (name , S (" Brush assigned to command: @1" , fullcmd ))
0 commit comments