diff --git a/TODO.md b/TODO.md index 2a7ca6c..f820e2c 100644 --- a/TODO.md +++ b/TODO.md @@ -1,14 +1,14 @@ # To Do -_Note: Please use submit "New Issue" for each future feature requests as this will be easier to track and close as features are added. This list should be reserved for currently planned major features and phased out eventually._ -* Add command to remove areas from creative area list. -* Add support to automatically check for and remove areas from creative list which are no long defined by areas mod. -* Show list of created Areas (each area with unique ID) -* Give/take more than one priv (fly, interact, ...) +_Note: Please submit "New Issue" for each future feature requests as this will be easier to track and close as features are added. This list should be reserved for currently planned major features and phased out asap._ +* ~~Add command to remove areas from creative area list.~~ Done +* ~~Add support to automatically check for and remove areas from creative list which are no long defined by areas mod.~~ Done +* ~~Show list of created Areas (each area with unique ID)~~ +* Give/take more than one priv (fly, interact, ...) * This feature request needs more explanation * ~~delete Areas~~ This is handled by the Areas mod. * ~~edit Areas (change size / position? / change privs given-taken)~~ First 2 handled by Areas. 3rd already listed -* clear inventory once leaving a "creative area" -* save inventory entering an area and restore it once leaving this area +* ~~clear inventory once leaving a "creative area"~~ +* ~~save inventory entering an area and restore it once leaving this area~~ ~~Connection to different Mods~~ ~~connect to World-Edit Areas~~ diff --git a/init.lua b/init.lua index 267299b..e52628f 100644 --- a/init.lua +++ b/init.lua @@ -37,7 +37,7 @@ function check_cr_area(player) local pos = player:get_pos() local area_at_pos = areas:getAreasAtPos(pos) local status = false - if #cr_areas >= 1 then + if cr_areas ~= {} then for i = 1, #cr_areas do local areaID = cr_areas[i] -- Clean up creative areas which are have been deleted from Areas mod @@ -76,6 +76,23 @@ minetest.register_chatcommand("rm_creative_area", { rm_cr_area(name, param) end }) + +minetest.register_chatcommand("ls_creative_areas", { + description = "List creative areas and IDs", + params = "", + func = function(name, params) + local list = "" + if cr_areas ~= {} then + for i = 1, #cr_areas do + local id = tonumber(cr_areas[i]) + local area_name = areas.areas[ id ]["name"] + list = list .. " " .. area_name .. " (ID="..id..")" + end + minetest.chat_send_player(name, "Creative Area (ID): "..list) + else minetest.chat_send_player(name, "No creative areas found") + end + end +}) ------------------------------------------------- -- Check location and Grant/revoke creative priv ------------------------------------------------- diff --git a/readme.md b/readme.md index a9e2801..98c2d17 100644 --- a/readme.md +++ b/readme.md @@ -1,11 +1,16 @@ # Creative_areas -Creative Areas is a minetest mod allowing areas defined by the Areas mod to be designated as creative/sandbox areas adjusting players privliges and inventory formspecs appropriately as they leave or enter these areas. +Creative Areas is a minetest mod allowing areas defined by the Areas mod to be designated as creative/sandbox areas adjusting players privliges and inventory formspecs appropriately as they leave or enter these areas. Items mined or taken from creative inventory inside creative area will be removed from players inventories upon leaving creative areas. + +Players with the 'privs' priv will not have privileges or inventories affected moving in and out of these areas. * Use /creative_area to add area to list of areas where creative mode is enabled. * Use /rm_creative_areas to remove an area from the list. +* Use /ls_creative_areas to see a list of creative areas and respective area IDs. -Depends on Advanced Areas Mod by Shadow Ninja and the Creative mod included in Minetest Game. +Depends on [Advanced Areas Mod](https://github.com/ShadowNinja/areas) by Shadow Ninja and the [Creative](https://github.com/minetest/minetest_game/tree/master/mods/creative) mod included in Minetest Game. + +This mod is compatible with Minetest 0.4.16 and up. MIT License: Copyright 2018 kakalak-lumberJack