diff --git a/README.md b/README.md index d1711a6..3c912af 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,10 @@ Based on Mesecons by Jeija By @paly2 and @HybridDog With the participation of @LeMagnesium (bugfix), @Ataron (textures), @JAPP (texture). -Dependencies: [Mesecons](https://github.com/Jeija/minetest-mod-mesecons/), [vector_extras](https://github.com/HybridDog/vector_extras/), [digilines](https://github.com/minetest-mods/digilines) (optional). +Dependencies: [Mesecons](https://github.com/Jeija/minetest-mod-mesecons/) +Optional dependencies: [vector_extras](https://github.com/HybridDog/vector_extras/) [digilines](https://github.com/minetest-mods/digilines) -This mod is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0 as published by the Free Software Foundation. You should have received a copy of the GNU General Public License along with this mod. - -MoreMesecons is a mod for minetest wich adds some mesecons items. +MoreMesecons is a mod for minetest which adds some mesecons items. [Here](http://github.com/minetest-mods/MoreMesecons/wiki)'s the wiki ! diff --git a/moremesecons_jammer/depends.txt b/moremesecons_jammer/depends.txt index b6d53b6..a259a42 100644 --- a/moremesecons_jammer/depends.txt +++ b/moremesecons_jammer/depends.txt @@ -1,3 +1,2 @@ mesecons -vector_extras moremesecons_utils diff --git a/moremesecons_luacontroller_tool/depends.txt b/moremesecons_luacontroller_tool/depends.txt index 9408116..a259a42 100644 --- a/moremesecons_luacontroller_tool/depends.txt +++ b/moremesecons_luacontroller_tool/depends.txt @@ -1,2 +1,2 @@ mesecons -vector_extras +moremesecons_utils diff --git a/moremesecons_luacontroller_tool/init.lua b/moremesecons_luacontroller_tool/init.lua index 15e9259..f7001de 100644 --- a/moremesecons_luacontroller_tool/init.lua +++ b/moremesecons_luacontroller_tool/init.lua @@ -255,7 +255,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) local code = get_code_or_nil(pname, fields.player_name, fields.template_name) if code then set_luacontroller_code(pos, code) - minetest.chat_send_player(pname, "code set to template at "..vector.pos_to_string(pos)) + minetest.chat_send_player(pname, "code set to template at "..minetest.pos_to_string(pos)) end return end @@ -265,7 +265,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) local code = get_code_or_nil(pname, fields.player_name, fields.template_name) if code then set_luacontroller_code(pos, meta:get_string("code").."\r"..code) - minetest.chat_send_player(pname, "code added to luacontroller at "..vector.pos_to_string(pos)) + minetest.chat_send_player(pname, "code added to luacontroller at "..minetest.pos_to_string(pos)) end return end diff --git a/moremesecons_teleporter/depends.txt b/moremesecons_teleporter/depends.txt index b6d53b6..a259a42 100644 --- a/moremesecons_teleporter/depends.txt +++ b/moremesecons_teleporter/depends.txt @@ -1,3 +1,2 @@ mesecons -vector_extras moremesecons_utils diff --git a/moremesecons_utils/depends.txt b/moremesecons_utils/depends.txt index e69de29..926e802 100644 --- a/moremesecons_utils/depends.txt +++ b/moremesecons_utils/depends.txt @@ -0,0 +1 @@ +vector_extras? diff --git a/moremesecons_utils/init.lua b/moremesecons_utils/init.lua index 687c8aa..0f83dab 100644 --- a/moremesecons_utils/init.lua +++ b/moremesecons_utils/init.lua @@ -24,3 +24,54 @@ function moremesecons.setting(modname, settingname, default, min) return ret end end + +-- Vector helpers +-- All the following functions are from the vector_extras mod (https://github.com/HybridDog/vector_extras). +-- If you enable that mod, its functions will be used instead of the ones defined below + +if not vector.get_data_from_pos then + function vector.get_data_from_pos(tab, z,y,x) + local data = tab[z] + if data then + data = data[y] + if data then + return data[x] + end + end + end +end + +if not vector.set_data_to_pos then + function vector.set_data_to_pos(tab, z,y,x, data) + if tab[z] then + if tab[z][y] then + tab[z][y][x] = data + return + end + tab[z][y] = {[x] = data} + return + end + tab[z] = {[y] = {[x] = data}} + end +end + +if not vector.remove_data_from_pos then + function vector.remove_data_from_pos(tab, z,y,x) + if vector.get_data_from_pos(tab, z,y,x) == nil then + return + end + tab[z][y][x] = nil + if not next(tab[z][y]) then + tab[z][y] = nil + end + if not next(tab[z]) then + tab[z] = nil + end + end +end + +if not vector.unpack then + function vector.unpack(pos) + return pos.z, pos.y, pos.x + end +end diff --git a/moremesecons_wireless/depends.txt b/moremesecons_wireless/depends.txt index 8da9e25..79129cd 100644 --- a/moremesecons_wireless/depends.txt +++ b/moremesecons_wireless/depends.txt @@ -1,4 +1,3 @@ mesecons -vector_extras moremesecons_utils digilines?