diff --git a/README.md b/README.md index 80cf185..b198ccc 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ MESECONS by Jeija and contributors Mezzee-what? ------------ -[Mesecons](http://mesecons.net/)! They're yellow, they're conductive, and they'll add a whole new dimension to Minetest's gameplay. +[Mesecons](https://mesecons.net/)! They're yellow, they're conductive, and they'll add a whole new dimension to Minetest's gameplay. -Mesecons is a mod for [Minetest](http://minetest.net/) that implements a ton of items related to digital circuitry, such as wires, buttons, lights, and even programmable controllers. Among other things, there are also pistons, solar panels, pressure plates, and note blocks. +Mesecons is a mod for [Minetest](https://www.minetest.net/) that implements a ton of items related to digital circuitry, such as wires, buttons, lights, and even programmable controllers. Among other things, there are also pistons, solar panels, pressure plates, and note blocks. Mesecons has a similar goal to Redstone in Minecraft, but works in its own way, with different rules and mechanics. @@ -74,8 +74,10 @@ There are also a whole bunch of other people helping with everything from code t Alright, how can I use it? -------------------------- -All textures in this project are licensed under the CC-BY-SA 3.0 (Creative Commons Attribution-ShareAlike 3.0 Generic). That means you can distribute and remix them as much as you want to, under the condition that you give credit to the authors and the project, and that if you remix and release them, they must be under the same or similar license to this one. +All textures in this project are licensed under the CC-BY-SA 3.0 (Creative Commons Attribution-ShareAlike 3.0 Generic). +That means you can distribute and remix them as much as you want to, under the condition that you give credit to the authors and the project, and that if you remix and release them, they must be under the same or similar license to this one. -All code in this project is licensed under the LGPL version 3 or later. That means you have unlimited freedom to distribute and modify the work however you see fit, provided that if you decide to distribute it or any modified versions of it, you must also use the same license. The LGPL also grants the additional freedom to write extensions for the software and distribute them without the extensions being subject to the terms of the LGPL, although the software itself retains its license. +All code in this project is licensed under the LGPL version 3. +That means you have unlimited freedom to distribute and modify the work however you see fit, provided that if you decide to distribute it or any modified versions of it, you must also use the same license. The LGPL also grants the additional freedom to write extensions for the software and distribute them without the extensions being subject to the terms of the LGPL, although the software itself retains its license. No warranty is provided, express or implied, for any part of the project. diff --git a/bower.json b/bower.json index 1d94e61..8c850f5 100644 --- a/bower.json +++ b/bower.json @@ -1,9 +1,9 @@ { "name": "mesecons", "description": "Mesecons is a mod for Minetest that implements items related to digital circuitry: wires, buttons, lights, and programmable controllers.", - "homepage": "http://mesecons.net", - "authors": "Jeija", - "license": "LGPL-3.0+", + "homepage": "https://mesecons.net", + "authors": ["Jeija"], + "license": "LGPL-3.0", "keywords": [ "mesecons", "minetest", diff --git a/mesecons/mod.conf b/mesecons/mod.conf index 61b628e..b49e9a8 100644 --- a/mesecons/mod.conf +++ b/mesecons/mod.conf @@ -1,2 +1,4 @@ name = mesecons -depends = default +# default is an optional dependency as some mods may expect it as a transitory +# dependency when they depend on mesecons. +optional_depends = default diff --git a/mesecons/util.lua b/mesecons/util.lua index 5215e8c..80afd09 100644 --- a/mesecons/util.lua +++ b/mesecons/util.lua @@ -326,6 +326,9 @@ end -- Nil if no VM-based transaction is in progress. local vm_cache = nil +-- Whether the current transaction will need a light update afterward. +local vm_update_light = false + -- Starts a VoxelManipulator-based transaction. -- -- During a VM transaction, calls to vm_get_node and vm_swap_node operate on a @@ -334,6 +337,7 @@ local vm_cache = nil -- vm_abort. function mesecon.vm_begin() vm_cache = {} + vm_update_light = false end -- Finishes a VoxelManipulator-based transaction, freeing the VMs and map data @@ -343,7 +347,7 @@ function mesecon.vm_commit() if tbl.dirty then local vm = tbl.vm vm:set_data(tbl.data) - vm:write_to_map(tbl.update_light) + vm:write_to_map(vm_update_light) vm:update_map() end end @@ -364,7 +368,7 @@ local function vm_get_or_create_entry(pos) local vm = minetest.get_voxel_manip(pos, pos) local min_pos, max_pos = vm:get_emerged_area() local va = VoxelArea:new{MinEdge = min_pos, MaxEdge = max_pos} - tbl = {vm = vm, va = va, data = vm:get_data(), param1 = vm:get_light_data(), param2 = vm:get_param2_data(), dirty = false, update_light = false} + tbl = {vm = vm, va = va, data = vm:get_data(), param1 = vm:get_light_data(), param2 = vm:get_param2_data(), dirty = false} vm_cache[hash] = tbl end return tbl @@ -391,8 +395,11 @@ end -- -- The swap will necessitate a light update unless update_light equals false. function mesecon.vm_swap_node(pos, name, update_light) + -- If one node needs a light update, all VMs should use light updates to + -- prevent newly calculated light from being overwritten by other VMs. + vm_update_light = vm_update_light or update_light ~= false + local tbl = vm_get_or_create_entry(pos) - tbl.update_light = update_light ~= false or tbl.update_light local index = tbl.va:indexp(pos) tbl.data[index] = minetest.get_content_id(name) tbl.dirty = true diff --git a/mesecons_blinkyplant/mod.conf b/mesecons_blinkyplant/mod.conf index 04997b9..8332c95 100644 --- a/mesecons_blinkyplant/mod.conf +++ b/mesecons_blinkyplant/mod.conf @@ -1,2 +1,2 @@ name = mesecons_blinkyplant -depends = mesecons +depends = default, mesecons diff --git a/mesecons_button/mod.conf b/mesecons_button/mod.conf index b98afd1..62c1e40 100644 --- a/mesecons_button/mod.conf +++ b/mesecons_button/mod.conf @@ -1,2 +1,2 @@ name = mesecons_button -depends = mesecons, mesecons_receiver +depends = default, mesecons, mesecons_receiver diff --git a/mesecons_commandblock/mod.conf b/mesecons_commandblock/mod.conf index 750a6e7..66f847d 100644 --- a/mesecons_commandblock/mod.conf +++ b/mesecons_commandblock/mod.conf @@ -1,2 +1,2 @@ name = mesecons_commandblock -depends = mesecons +depends = default, mesecons diff --git a/mesecons_delayer/mod.conf b/mesecons_delayer/mod.conf index b9b96d0..a6604ed 100644 --- a/mesecons_delayer/mod.conf +++ b/mesecons_delayer/mod.conf @@ -1,2 +1,2 @@ name = mesecons_delayer -depends = mesecons +depends = default, mesecons diff --git a/mesecons_detector/mod.conf b/mesecons_detector/mod.conf index 75456b3..0a43985 100644 --- a/mesecons_detector/mod.conf +++ b/mesecons_detector/mod.conf @@ -1,2 +1,2 @@ name = mesecons_detector -depends = mesecons, mesecons_materials +depends = default, mesecons, mesecons_materials diff --git a/mesecons_fpga/mod.conf b/mesecons_fpga/mod.conf index 707f7c7..c2e3a25 100644 --- a/mesecons_fpga/mod.conf +++ b/mesecons_fpga/mod.conf @@ -1,3 +1,3 @@ name = mesecons_fpga -depends = mesecons +depends = default, mesecons optional_depends = screwdriver diff --git a/mesecons_gates/mod.conf b/mesecons_gates/mod.conf index c57336f..399d832 100644 --- a/mesecons_gates/mod.conf +++ b/mesecons_gates/mod.conf @@ -1,2 +1,2 @@ name = mesecons_gates -depends = mesecons, mesecons_microcontroller, mesecons_delayer, mesecons_torch, mesecons_materials +depends = default, mesecons, mesecons_microcontroller, mesecons_delayer, mesecons_torch, mesecons_materials diff --git a/mesecons_hydroturbine/mod.conf b/mesecons_hydroturbine/mod.conf index ce221ea..2d1cfd8 100644 --- a/mesecons_hydroturbine/mod.conf +++ b/mesecons_hydroturbine/mod.conf @@ -1,2 +1,2 @@ name = mesecons_hydroturbine -depends = mesecons +depends = default, mesecons diff --git a/mesecons_insulated/mod.conf b/mesecons_insulated/mod.conf index d5965f0..7b33fe9 100644 --- a/mesecons_insulated/mod.conf +++ b/mesecons_insulated/mod.conf @@ -1,3 +1,3 @@ name = mesecons_insulated -depends = mesecons +depends = default, mesecons optional_depends = screwdriver diff --git a/mesecons_lamp/mod.conf b/mesecons_lamp/mod.conf index b469619..4312b8f 100644 --- a/mesecons_lamp/mod.conf +++ b/mesecons_lamp/mod.conf @@ -1,2 +1,2 @@ name = mesecons_lamp -depends = mesecons +depends = default, mesecons diff --git a/mesecons_lightstone/mod.conf b/mesecons_lightstone/mod.conf index 421f58d..e7a55c2 100644 --- a/mesecons_lightstone/mod.conf +++ b/mesecons_lightstone/mod.conf @@ -1,2 +1,2 @@ name = mesecons_lightstone -depends = mesecons, dye +depends = default, mesecons, dye diff --git a/mesecons_luacontroller/mod.conf b/mesecons_luacontroller/mod.conf index 0db7d72..0d95253 100644 --- a/mesecons_luacontroller/mod.conf +++ b/mesecons_luacontroller/mod.conf @@ -1,2 +1,2 @@ name = mesecons_luacontroller -depends = mesecons +depends = default, mesecons diff --git a/mesecons_materials/mod.conf b/mesecons_materials/mod.conf index 53d1e1d..827423a 100644 --- a/mesecons_materials/mod.conf +++ b/mesecons_materials/mod.conf @@ -1,2 +1,2 @@ name = mesecons_materials -depends = mesecons +depends = default, mesecons diff --git a/mesecons_microcontroller/mod.conf b/mesecons_microcontroller/mod.conf index 6a18b2c..2d72941 100644 --- a/mesecons_microcontroller/mod.conf +++ b/mesecons_microcontroller/mod.conf @@ -1,2 +1,2 @@ name = mesecons_microcontroller -depends = mesecons +depends = default, mesecons diff --git a/mesecons_movestones/mod.conf b/mesecons_movestones/mod.conf index 9e0cbc1..6583448 100644 --- a/mesecons_movestones/mod.conf +++ b/mesecons_movestones/mod.conf @@ -1,2 +1,2 @@ name = mesecons_movestones -depends = mesecons, mesecons_materials, mesecons_mvps +depends = default, mesecons, mesecons_materials, mesecons_mvps diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index 81795c6..e3038a6 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -46,9 +46,9 @@ local function on_mvps_move(moved_nodes) end end -function mesecon.mvps_process_stack(stack) +function mesecon.mvps_process_stack() -- This function is kept for compatibility. - -- It used to call on_placenode on the moved nodes, but that is now done automatically. + -- It used to call on_placenode on moved nodes, but that is now done automatically. end -- tests if the node can be pushed into, e.g. air, water, grass @@ -328,11 +328,31 @@ end -- TODO: load blocks instead, as with wires. mesecon.register_mvps_stopper("ignore") -mesecon.register_mvps_stopper("doors:door_steel_b_1") -mesecon.register_mvps_stopper("doors:door_steel_t_1") -mesecon.register_mvps_stopper("doors:door_steel_b_2") -mesecon.register_mvps_stopper("doors:door_steel_t_2") -mesecon.register_mvps_stopper("default:chest_locked") +-- All of the locked and internal nodes in Minetest Game +for _, name in ipairs({ + "default:chest_locked", + "default:chest_locked_open", + "doors:door_steel_b_1", -- old style doors + "doors:door_steel_b_2", -- + "doors:door_steel_t_1", -- + "doors:door_steel_t_2", -- + "doors:door_steel_a", -- new style doors + "doors:door_steel_b", -- + "doors:door_steel_c", -- + "doors:door_steel_d", -- + "doors:hidden", + "doors:trapdoor_steel", + "doors:trapdoor_steel_open", + "xpanes:door_steel_bar_a", + "xpanes:door_steel_bar_b", + "xpanes:door_steel_bar_c", + "xpanes:door_steel_bar_d", + "xpanes:trapdoor_steel_bar", + "xpanes:trapdoor_steel_bar_open", +}) do + mesecon.register_mvps_stopper(name) +end + mesecon.register_on_mvps_move(mesecon.move_hot_nodes) mesecon.register_on_mvps_move(function(moved_nodes) for i = 1, #moved_nodes do diff --git a/mesecons_noteblock/mod.conf b/mesecons_noteblock/mod.conf index 1288ca3..ad0b4c7 100644 --- a/mesecons_noteblock/mod.conf +++ b/mesecons_noteblock/mod.conf @@ -1,2 +1,2 @@ name = mesecons_noteblock -depends = mesecons +depends = default, mesecons diff --git a/mesecons_pistons/mod.conf b/mesecons_pistons/mod.conf index db118fe..c7399a9 100644 --- a/mesecons_pistons/mod.conf +++ b/mesecons_pistons/mod.conf @@ -1,2 +1,2 @@ name = mesecons_pistons -depends = mesecons, mesecons_mvps +depends = default, mesecons, mesecons_mvps diff --git a/mesecons_powerplant/mod.conf b/mesecons_powerplant/mod.conf index 1f0024f..a0949a3 100644 --- a/mesecons_powerplant/mod.conf +++ b/mesecons_powerplant/mod.conf @@ -1,2 +1,2 @@ name = mesecons_powerplant -depends = mesecons +depends = default, mesecons diff --git a/mesecons_pressureplates/mod.conf b/mesecons_pressureplates/mod.conf index 21ed926..99b8745 100644 --- a/mesecons_pressureplates/mod.conf +++ b/mesecons_pressureplates/mod.conf @@ -1,2 +1,2 @@ name = mesecons_pressureplates -depends = mesecons +depends = default, mesecons diff --git a/mesecons_random/mod.conf b/mesecons_random/mod.conf index 2d94c08..8d233f0 100644 --- a/mesecons_random/mod.conf +++ b/mesecons_random/mod.conf @@ -1,2 +1,2 @@ name = mesecons_random -depends = mesecons +depends = default, mesecons diff --git a/mesecons_receiver/mod.conf b/mesecons_receiver/mod.conf index c1200af..0bda4f6 100644 --- a/mesecons_receiver/mod.conf +++ b/mesecons_receiver/mod.conf @@ -1,2 +1,2 @@ name = mesecons_receiver -depends = mesecons +depends = default, mesecons diff --git a/mesecons_solarpanel/mod.conf b/mesecons_solarpanel/mod.conf index 399d904..2c6f98c 100644 --- a/mesecons_solarpanel/mod.conf +++ b/mesecons_solarpanel/mod.conf @@ -1,2 +1,2 @@ name = mesecons_solarpanel -depends = mesecons, mesecons_materials +depends = default, mesecons, mesecons_materials diff --git a/mesecons_stickyblocks/mod.conf b/mesecons_stickyblocks/mod.conf index c7da51a..5291e0a 100644 --- a/mesecons_stickyblocks/mod.conf +++ b/mesecons_stickyblocks/mod.conf @@ -1,2 +1,2 @@ name = mesecons_stickyblocks -depends = mesecons, mesecons_mvps +depends = default, mesecons, mesecons_mvps diff --git a/mesecons_switch/mod.conf b/mesecons_switch/mod.conf index f3b88d7..403fd22 100644 --- a/mesecons_switch/mod.conf +++ b/mesecons_switch/mod.conf @@ -1,2 +1,2 @@ name = mesecons_switch -depends = mesecons +depends = default, mesecons diff --git a/mesecons_torch/mod.conf b/mesecons_torch/mod.conf index 520a6ea..6b694a3 100644 --- a/mesecons_torch/mod.conf +++ b/mesecons_torch/mod.conf @@ -1,2 +1,2 @@ name = mesecons_torch -depends = mesecons +depends = default, mesecons diff --git a/mesecons_walllever/mod.conf b/mesecons_walllever/mod.conf index 3bf2e5c..d6ca0bc 100644 --- a/mesecons_walllever/mod.conf +++ b/mesecons_walllever/mod.conf @@ -1,2 +1,2 @@ name = mesecons_walllever -depends = mesecons, mesecons_receiver +depends = default, mesecons, mesecons_receiver diff --git a/mesecons_wires/mod.conf b/mesecons_wires/mod.conf index c537656..8e2c30b 100644 --- a/mesecons_wires/mod.conf +++ b/mesecons_wires/mod.conf @@ -1,2 +1,2 @@ name = mesecons_wires -depends = mesecons +depends = default, mesecons