|
|
@ -77,3 +77,31 @@ minetest.register_chatcommand("creative_region_rm", { |
|
|
|
return true, "Done." |
|
|
|
end, |
|
|
|
}) |
|
|
|
|
|
|
|
minetest.register_chatcommand("creative_region_rn", { |
|
|
|
params = "<id>, <text>", |
|
|
|
description = "Rename a creative region", |
|
|
|
privs = {server = true}, |
|
|
|
func = function(name, param) |
|
|
|
local player = minetest.get_player_by_name(name) |
|
|
|
if not player then |
|
|
|
return false, "Player not found" |
|
|
|
end |
|
|
|
local found, _, region_id, region_name = param:find("^(r%d+)%s*,%s*(.+)$") |
|
|
|
if not found or not region_id or not region_name then |
|
|
|
return false, "Syntax error" |
|
|
|
end |
|
|
|
local astore_id = tonumber(string.sub(region_id, 2)) |
|
|
|
local astore_area = creative_regions.astore:get_area(astore_id, false, true) |
|
|
|
if astore_area then |
|
|
|
astore_area.data = tostring(region_name) |
|
|
|
minetest.chat_send_player(name, "[creative_regions] Region " .. region_id .. "updated") |
|
|
|
creative_regions.save_regions() |
|
|
|
else |
|
|
|
minetest.chat_send_player(name, "Failed to update region " .. region_id) |
|
|
|
return false, "Region not found" |
|
|
|
end |
|
|
|
|
|
|
|
return true, "Done." |
|
|
|
end, |
|
|
|
}) |
|
|
|