@@ -209,23 +209,26 @@ worldedit.register_command("mtschemplace", {
209
209
privs = {worldedit = true },
210
210
require_pos = 1 ,
211
211
parse = function (param )
212
- if param == " " then
213
- return false
212
+ local found , _ , filename , rotation = param :find (" ^(.+)%s+([012789]+)$" )
213
+ if found == nil then
214
+ filename = param
215
+ elseif rotation ~= " 0" and rotation ~= " 90" and rotation ~= " 180" and rotation ~= " 270" then
216
+ return false , S (" Invalid rotation: @1" , rotation )
214
217
end
215
- if not check_filename (param ) then
216
- return false , S (" Disallowed file name: @1" , param )
218
+ if not check_filename (filename ) then
219
+ return false , S (" Disallowed file name: @1" , filename )
217
220
end
218
- return true , param
221
+ return true , filename , rotation
219
222
end ,
220
- func = function (name , param )
223
+ func = function (name , filename , rotation )
221
224
local pos = worldedit .pos1 [name ]
222
225
223
- local path = minetest .get_worldpath () .. " /schems/" .. param .. " .mts"
224
- if minetest .place_schematic (pos , path ) == nil then
226
+ local path = minetest .get_worldpath () .. " /schems/" .. filename .. " .mts"
227
+ if minetest .place_schematic (pos , path , rotation ) == nil then
225
228
return false , S (" failed to place Minetest schematic" )
226
229
end
227
230
return true , S (" placed Minetest schematic @1 at @2" ,
228
- param , minetest .pos_to_string (pos ))
231
+ filename , minetest .pos_to_string (pos ))
229
232
end ,
230
233
})
231
234
0 commit comments