diff --git a/.github/workflows/check-release.yml b/.github/workflows/check.yml similarity index 94% rename from .github/workflows/check-release.yml rename to .github/workflows/check.yml index 616adb3..3353325 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check.yml @@ -1,10 +1,10 @@ on: [push, pull_request] -name: Check & Release +name: "Check" jobs: lint: runs-on: ubuntu-latest - + name: "Luacheck" steps: - uses: actions/checkout@main - name: apt @@ -14,9 +14,9 @@ jobs: - name: luacheck run run: $HOME/.luarocks/bin/luacheck ./ - test: + mineunit: runs-on: ubuntu-latest - + name: "Mineunit tests" steps: - uses: actions/checkout@main - name: apt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..300025e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +on: [push, pull_request] +name: "Test" + +jobs: + test: + name: "Smoke Test ${{ matrix.cfg.image }}" + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + matrix: + cfg: + - { image: 'registry.gitlab.com/minetest/minetest/server:5.0.1', mtg: false } + - { image: 'ghcr.io/minetest/minetest:5.9.0', mtg: true } + steps: + - uses: actions/checkout@main + + - uses: actions/checkout@main + with: + repository: 'minetest/minetest_game' + path: ./.test/minetest_game + if: ${{ matrix.cfg.mtg }} + + - name: Run tests + run: ./.test/run.sh + env: + DOCKER_IMAGE: "${{ matrix.cfg.image }}" diff --git a/.luacheckrc b/.luacheckrc index f2445a0..d079c76 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -27,6 +27,8 @@ read_globals = { "table.insert_all", "vector", "VoxelArea", + "mcl_dyes", + "mcl_sounds", } globals = {"mesecon"} diff --git a/.test/minetest.conf b/.test/minetest.conf new file mode 100644 index 0000000..7e7b767 --- /dev/null +++ b/.test/minetest.conf @@ -0,0 +1,3 @@ +mg_name = singlenode +mesecon.internal_test = true +random_mod_load_order = true diff --git a/.test/run.sh b/.test/run.sh new file mode 100755 index 0000000..eb8c198 --- /dev/null +++ b/.test/run.sh @@ -0,0 +1,31 @@ +#!/bin/bash +tempdir=$(mktemp -d) +confpath=$tempdir/minetest.conf +worldpath=$tempdir/world +trap 'rm -rf "$tempdir" || :' EXIT + +[ -f mesecons/mod.conf ] || { echo "Must be run in modpack root folder." >&2; exit 1; } + +command -v docker >/dev/null || { echo "Docker is not installed." >&2; exit 1; } +mtg=.test/minetest_game +[ -d $mtg ] || echo "A source checkout of minetest_game was not found. This can fail if your docker image does not ship a game." >&2 + +mkdir "$worldpath" +cp -v .test/minetest.conf "$confpath" +chmod -R 777 "$tempdir" + +args=( + -v "$confpath":/etc/minetest/minetest.conf + -v "$tempdir":/var/lib/minetest/.minetest + -v "$PWD":/var/lib/minetest/.minetest/world/worldmods/mesecons +) +[ -d $mtg ] && args+=( + -v "$(realpath $mtg)":/var/lib/minetest/.minetest/games/minetest_game +) +args+=("$DOCKER_IMAGE") +[ -d $mtg ] && args+=(--gameid minetest) +docker run --rm -i "${args[@]}" + +ls -la "$worldpath" +test -f "$worldpath/mesecon_actionqueue" || exit 1 +exit 0 diff --git a/README.md b/README.md index b198ccc..4e40e98 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ MESECONS by Jeija and contributors Mezzee-what? ------------ + [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](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. @@ -20,15 +21,18 @@ Mesecons has a similar goal to Redstone in Minecraft, but works in its own way, OK, I want in. -------------- + Go get it! -[DOWNLOAD IT NOW](https://github.com/minetest-mods/mesecons/archive/master.zip) +[![ContentDB](https://content.minetest.net/packages/Jeija/mesecons/shields/downloads/)](https://content.minetest.net/packages/Jeija/mesecons/) -Now go ahead and install it like any other Minetest mod. Don't know how? Check out [the wonderful page about it](https://wiki.minetest.net/Mods) over at the official Minetest Wiki. For your convenience, here's a quick summary: +Install it directly from your client by searching it in the Online Content tab. + +**Or** if you've downloaded a ZIP file check out [this page](https://wiki.minetest.net/Mods) over at the official Minetest Wiki. For your convenience, here's a quick summary: 1. If Mesecons is still in a ZIP file, extract the folder inside to somewhere on the computer. 2. Make sure that when you open the folder, you can directly find `README.md` in the listing. If you just see another folder, move that folder up one level and delete the old one. -3. Open up the Minetest mods folder - usually `/mods/`. If you see the `minetest` or folder inside of that, that is your mod folder instead. +3. Open up the Minetest mods folder - called `mods`. 4. Copy the Mesecons folder into the mods folder. Don't like some parts of Mesecons? Open up the Mesecons folder and delete the subfolder containing the mod you don't want. If you didn't want movestones, for example, all you have to do is delete the `mesecons_movestones` folder and they will no longer be available. @@ -37,21 +41,21 @@ There are no dependencies - it will work right after installing! How do I use this thing? ------------------------ + How about a [quick overview video](https://www.youtube.com/watch?v=6kmeQj6iW5k)? -Or maybe a [comprehensive reference](http://mesecons.net/items.html) is your style? +Or maybe a [comprehensive reference](https://mesecons.net/items.html) is your style? -An overview for the very newest of new beginners? How does [this one](http://uberi.mesecons.net/projects/MeseconsBasics/index.html) look? +An overview for the very newest of new beginners? How does [this one](https://uberi.mesecons.net/projects/MeseconsBasics/index.html) look? -There is also a [wiki page](https://wiki.minetest.net/Mods/Mesecons) dedicated to this mod. - -Want to get more into building? Why not check out the [Mesecons Laboratory](http://uberi.mesecons.net/), a website dedicated to advanced Mesecons builders? +Want to get more into building? Why not check out the [Mesecons Laboratory](https://uberi.mesecons.net/), a website dedicated to advanced Mesecons builders? Want to contribute to Mesecons itself? Check out the [source code](https://github.com/minetest-mods/mesecons)! Who wrote it anyways? --------------------- -These awesome people made Mesecons possible! + +These awesome people made Mesecons possible! (as of 2016) | Contributor | Contribution | | --------------- | -------------------------------- | @@ -72,8 +76,11 @@ These awesome people made Mesecons possible! There are also a whole bunch of other people helping with everything from code to testing and feedback. Mesecons would also not be possible without their help! +Check out the [entire contributor list](https://github.com/minetest-mods/mesecons/graphs/contributors) on GitHub. + 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. diff --git a/documentation.json b/documentation.json index f318501..b12dc6d 100644 --- a/documentation.json +++ b/documentation.json @@ -42,6 +42,7 @@ }, "Logic" : { "Luacontroller" : "mesecons_luacontroller/doc/luacontroller", + "Microcontroller" : "mesecons_microcontroller/doc/microcontroler", "FPGA" : "mesecons_fpga/doc/fpga", "FPGA Programmer" : "mesecons_fpga/doc/programmer", "Torch" : "mesecons_torch/doc/torch", diff --git a/mesecons/actionqueue.lua b/mesecons/actionqueue.lua index 72b464d..b3118f0 100644 --- a/mesecons/actionqueue.lua +++ b/mesecons/actionqueue.lua @@ -70,7 +70,17 @@ end -- However, even that does not work in some cases, that's why we delay the time the globalsteps -- start to be execute by 4 seconds +local m_time = 0 +local resumetime = mesecon.setting("resumetime", 4) + local function globalstep_func(dtime) + -- don't even try if server has not been running for XY seconds; resumetime = time to wait + -- after starting the server before processing the ActionQueue, don't set this too low + if m_time < resumetime then + m_time = m_time + dtime + return + end + local actions = queue.actions -- split into two categories: -- actions_now: actions to execute now @@ -112,23 +122,7 @@ local function globalstep_func(dtime) end end --- delay the time the globalsteps start to be execute by 4 seconds -do - local m_time = 0 - local resumetime = mesecon.setting("resumetime", 4) - local globalstep_func_index = #minetest.registered_globalsteps + 1 - - minetest.register_globalstep(function(dtime) - m_time = m_time + dtime - -- don't even try if server has not been running for XY seconds; resumetime = time to wait - -- after starting the server before processing the ActionQueue, don't set this too low - if m_time < resumetime then - return - end - -- replace this globalstep function - minetest.registered_globalsteps[globalstep_func_index] = globalstep_func - end) -end +minetest.register_globalstep(globalstep_func) function queue:execute(action) -- ignore if action queue function name doesn't exist, diff --git a/mesecons/init.lua b/mesecons/init.lua index 3446004..9a45a40 100644 --- a/mesecons/init.lua +++ b/mesecons/init.lua @@ -123,3 +123,11 @@ dofile(minetest.get_modpath("mesecons").."/legacy.lua"); --Services like turnoff receptor on dignode and so on dofile(minetest.get_modpath("mesecons").."/services.lua"); + +-- Automated test run +if mesecon.setting("internal_test", false) then + -- currently does nothing, we only fail if some error happens right on startup + minetest.after(5, function() + minetest.request_shutdown() + end) +end diff --git a/mesecons/internal.lua b/mesecons/internal.lua index a28c430..49690d9 100644 --- a/mesecons/internal.lua +++ b/mesecons/internal.lua @@ -51,27 +51,18 @@ mesecon.fifo_queue = dofile(minetest.get_modpath("mesecons").."/fifo_queue.lua") -- General function mesecon.get_effector(nodename) - if minetest.registered_nodes[nodename] - and minetest.registered_nodes[nodename].mesecons - and minetest.registered_nodes[nodename].mesecons.effector then - return minetest.registered_nodes[nodename].mesecons.effector - end + local def = minetest.registered_nodes[nodename] + return def and def.mesecons and def.mesecons.effector end function mesecon.get_receptor(nodename) - if minetest.registered_nodes[nodename] - and minetest.registered_nodes[nodename].mesecons - and minetest.registered_nodes[nodename].mesecons.receptor then - return minetest.registered_nodes[nodename].mesecons.receptor - end + local def = minetest.registered_nodes[nodename] + return def and def.mesecons and def.mesecons.receptor end function mesecon.get_conductor(nodename) - if minetest.registered_nodes[nodename] - and minetest.registered_nodes[nodename].mesecons - and minetest.registered_nodes[nodename].mesecons.conductor then - return minetest.registered_nodes[nodename].mesecons.conductor - end + local def = minetest.registered_nodes[nodename] + return def and def.mesecons and def.mesecons.conductor end function mesecon.get_any_outputrules(node) diff --git a/mesecons/locale/mesecons.fr.tr b/mesecons/locale/mesecons.fr.tr new file mode 100644 index 0000000..2b51d69 --- /dev/null +++ b/mesecons/locale/mesecons.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons + +### oldwires.lua ### +Mesecons=Mesecons diff --git a/mesecons/textures/jeija_microcontroller_LED_A.png b/mesecons/textures/jeija_luacontroller_LED_A.png similarity index 100% rename from mesecons/textures/jeija_microcontroller_LED_A.png rename to mesecons/textures/jeija_luacontroller_LED_A.png diff --git a/mesecons/textures/jeija_microcontroller_LED_B.png b/mesecons/textures/jeija_luacontroller_LED_B.png similarity index 100% rename from mesecons/textures/jeija_microcontroller_LED_B.png rename to mesecons/textures/jeija_luacontroller_LED_B.png diff --git a/mesecons/textures/jeija_microcontroller_LED_C.png b/mesecons/textures/jeija_luacontroller_LED_C.png similarity index 100% rename from mesecons/textures/jeija_microcontroller_LED_C.png rename to mesecons/textures/jeija_luacontroller_LED_C.png diff --git a/mesecons/textures/jeija_microcontroller_LED_D.png b/mesecons/textures/jeija_luacontroller_LED_D.png similarity index 100% rename from mesecons/textures/jeija_microcontroller_LED_D.png rename to mesecons/textures/jeija_luacontroller_LED_D.png diff --git a/mesecons_blinkyplant/locale/mesecons_blinkyplant.fr.tr b/mesecons_blinkyplant/locale/mesecons_blinkyplant.fr.tr new file mode 100644 index 0000000..410d744 --- /dev/null +++ b/mesecons_blinkyplant/locale/mesecons_blinkyplant.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_blinkyplant + +### init.lua ### +Blinky Plant=Plante clignotante diff --git a/mesecons_button/locale/mesecons_button.fr.tr b/mesecons_button/locale/mesecons_button.fr.tr new file mode 100644 index 0000000..9ef7de5 --- /dev/null +++ b/mesecons_button/locale/mesecons_button.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_button + +### init.lua ### +Button=Bouton diff --git a/mesecons_commandblock/locale/mesecons_commandblock.fr.tr b/mesecons_commandblock/locale/mesecons_commandblock.fr.tr new file mode 100644 index 0000000..fa97d76 --- /dev/null +++ b/mesecons_commandblock/locale/mesecons_commandblock.fr.tr @@ -0,0 +1,7 @@ +# textdomain: mesecons_commandblock + +### init.lua ### +Say as the server=Dire au serveur +Say to privately=Dire à en privé +Set health of to hitpoints=Définir la vie de sur cœurs +Command Block=Bloc de commandes diff --git a/mesecons_delayer/init.lua b/mesecons_delayer/init.lua index 2c4b0f4..ab0063e 100644 --- a/mesecons_delayer/init.lua +++ b/mesecons_delayer/init.lua @@ -27,20 +27,6 @@ local delaytime = { 0.1, 0.3, 0.5, 1.0 } for i = 1, 4 do -local boxes = { - { -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 }, -- the main slab - - { -2/16, -7/16, -4/16, 2/16, -26/64, -3/16 }, -- the jeweled "on" indicator - { -3/16, -7/16, -3/16, 3/16, -26/64, -2/16 }, - { -4/16, -7/16, -2/16, 4/16, -26/64, 2/16 }, - { -3/16, -7/16, 2/16, 3/16, -26/64, 3/16 }, - { -2/16, -7/16, 3/16, 2/16, -26/64, 4/16 }, - - { -6/16, -7/16, -6/16, -4/16, -27/64, -4/16 }, -- the timer indicator - { -8/16, -8/16, -1/16, -6/16, -7/16, 1/16 }, -- the two wire stubs - { 6/16, -8/16, -1/16, 8/16, -7/16, 1/16 } -} - -- Delayer definition defaults local def = { drawtype = "nodebox", @@ -48,11 +34,14 @@ local def = { walkable = true, selection_box = { type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, + fixed = { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, }, node_box = { type = "fixed", - fixed = boxes + fixed = { + { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab + { -6/16, -7/16, -6/16, 6/16, -6/16, 6/16 } + }, }, paramtype = "light", paramtype2 = "facedir", @@ -62,6 +51,8 @@ local def = { sounds = mesecon.node_sound.stone, on_blast = mesecon.on_blastnode, drop = "mesecons_delayer:delayer_off_1", + delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i), + delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i), } -- Deactivated delayer definition defaults @@ -72,16 +63,17 @@ end local off_state = { description = S("Delayer"), + inventory_image = "jeija_gate_off.png^jeija_delayer.png", + wield_image = "jeija_gate_off.png^jeija_delayer.png", tiles = { - "mesecons_delayer_off_"..tostring(i)..".png", - "mesecons_delayer_bottom.png", - "mesecons_delayer_ends_off.png", - "mesecons_delayer_ends_off.png", - "mesecons_delayer_sides_off.png", - "mesecons_delayer_sides_off.png" + "jeija_microcontroller_bottom.png^jeija_gate_output_off.png^jeija_gate_off.png^".. + "jeija_delayer.png^mesecons_delayer_"..tostring(i)..".png", + "jeija_microcontroller_bottom.png^jeija_gate_output_off.png", + "jeija_gate_side.png^jeija_gate_side_output_off.png", + "jeija_gate_side.png", + "jeija_gate_side.png", + "jeija_gate_side.png", }, - inventory_image = "mesecons_delayer_off_1.png", - wield_image = "mesecons_delayer_off_1.png", groups = off_groups, on_punch = function(pos, node, puncher) if minetest.is_protected(pos, puncher and puncher:get_player_name() or "") then @@ -93,7 +85,6 @@ local off_state = { param2 = node.param2 }) end, - delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i), mesecons = { receptor = { @@ -103,6 +94,7 @@ local off_state = { effector = { rules = delayer_get_input_rules, + action_off = delayer_deactivate, action_on = delayer_activate } }, @@ -115,13 +107,16 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), off_state) -- Activated delayer definition defaults local on_state = { description = S("You hacker you"), + inventory_image = "jeija_gate_on.png^jeija_delayer.png", + wield_image = "jeija_gate_on.png^jeija_delayer.png", tiles = { - "mesecons_delayer_on_"..tostring(i)..".png", - "mesecons_delayer_bottom.png", - "mesecons_delayer_ends_on.png", - "mesecons_delayer_ends_on.png", - "mesecons_delayer_sides_on.png", - "mesecons_delayer_sides_on.png" + "jeija_microcontroller_bottom.png^jeija_gate_output_on.png^jeija_gate_on.png^".. + "jeija_delayer.png^mesecons_delayer_"..tostring(i)..".png", + "jeija_microcontroller_bottom.png^jeija_gate_output_on.png", + "jeija_gate_side.png^jeija_gate_side_output_on.png", + "jeija_gate_side.png", + "jeija_gate_side.png", + "jeija_gate_side.png", }, groups = {bendy = 2, snappy = 1, dig_immediate = 2, not_in_creative_inventory = 1}, on_punch = function(pos, node, puncher) @@ -134,7 +129,6 @@ local on_state = { param2 = node.param2 }) end, - delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i), mesecons = { receptor = { @@ -144,7 +138,8 @@ local on_state = { effector = { rules = delayer_get_input_rules, - action_off = delayer_deactivate + action_off = delayer_deactivate, + action_on = delayer_activate } }, } diff --git a/mesecons_delayer/locale/mesecons_delayer.fr.tr b/mesecons_delayer/locale/mesecons_delayer.fr.tr new file mode 100644 index 0000000..c4ff30e --- /dev/null +++ b/mesecons_delayer/locale/mesecons_delayer.fr.tr @@ -0,0 +1,5 @@ +# textdomain: mesecons_delayer + +### init.lua ### +Delayer=Retardateur +You hacker you=Vous êtes un pirate informatique diff --git a/mesecons_delayer/textures/jeija_delayer.png b/mesecons_delayer/textures/jeija_delayer.png new file mode 100644 index 0000000..e33fe12 Binary files /dev/null and b/mesecons_delayer/textures/jeija_delayer.png differ diff --git a/mesecons_gates/textures/jeija_gate_off.png b/mesecons_delayer/textures/jeija_gate_off.png similarity index 100% rename from mesecons_gates/textures/jeija_gate_off.png rename to mesecons_delayer/textures/jeija_gate_off.png diff --git a/mesecons_gates/textures/jeija_gate_on.png b/mesecons_delayer/textures/jeija_gate_on.png similarity index 100% rename from mesecons_gates/textures/jeija_gate_on.png rename to mesecons_delayer/textures/jeija_gate_on.png diff --git a/mesecons_gates/textures/jeija_gate_output_off.png b/mesecons_delayer/textures/jeija_gate_output_off.png similarity index 100% rename from mesecons_gates/textures/jeija_gate_output_off.png rename to mesecons_delayer/textures/jeija_gate_output_off.png diff --git a/mesecons_gates/textures/jeija_gate_output_on.png b/mesecons_delayer/textures/jeija_gate_output_on.png similarity index 100% rename from mesecons_gates/textures/jeija_gate_output_on.png rename to mesecons_delayer/textures/jeija_gate_output_on.png diff --git a/mesecons_gates/textures/jeija_gate_side.png b/mesecons_delayer/textures/jeija_gate_side.png similarity index 100% rename from mesecons_gates/textures/jeija_gate_side.png rename to mesecons_delayer/textures/jeija_gate_side.png diff --git a/mesecons_gates/textures/jeija_gate_side_output_off.png b/mesecons_delayer/textures/jeija_gate_side_output_off.png similarity index 100% rename from mesecons_gates/textures/jeija_gate_side_output_off.png rename to mesecons_delayer/textures/jeija_gate_side_output_off.png diff --git a/mesecons_gates/textures/jeija_gate_side_output_on.png b/mesecons_delayer/textures/jeija_gate_side_output_on.png similarity index 100% rename from mesecons_gates/textures/jeija_gate_side_output_on.png rename to mesecons_delayer/textures/jeija_gate_side_output_on.png diff --git a/mesecons_delayer/textures/mesecons_delayer_1.png b/mesecons_delayer/textures/mesecons_delayer_1.png new file mode 100644 index 0000000..973d684 Binary files /dev/null and b/mesecons_delayer/textures/mesecons_delayer_1.png differ diff --git a/mesecons_delayer/textures/mesecons_delayer_2.png b/mesecons_delayer/textures/mesecons_delayer_2.png new file mode 100644 index 0000000..a5f0b9f Binary files /dev/null and b/mesecons_delayer/textures/mesecons_delayer_2.png differ diff --git a/mesecons_delayer/textures/mesecons_delayer_3.png b/mesecons_delayer/textures/mesecons_delayer_3.png new file mode 100644 index 0000000..c8bf24e Binary files /dev/null and b/mesecons_delayer/textures/mesecons_delayer_3.png differ diff --git a/mesecons_delayer/textures/mesecons_delayer_4.png b/mesecons_delayer/textures/mesecons_delayer_4.png new file mode 100644 index 0000000..74a5912 Binary files /dev/null and b/mesecons_delayer/textures/mesecons_delayer_4.png differ diff --git a/mesecons_delayer/textures/mesecons_delayer_bottom.png b/mesecons_delayer/textures/mesecons_delayer_bottom.png deleted file mode 100644 index 2307b39..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_bottom.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_ends_off.png b/mesecons_delayer/textures/mesecons_delayer_ends_off.png deleted file mode 100644 index 9cbeb39..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_ends_off.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_ends_on.png b/mesecons_delayer/textures/mesecons_delayer_ends_on.png deleted file mode 100644 index 446ef48..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_ends_on.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_off_1.png b/mesecons_delayer/textures/mesecons_delayer_off_1.png deleted file mode 100644 index 20d9efc..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_off_1.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_off_2.png b/mesecons_delayer/textures/mesecons_delayer_off_2.png deleted file mode 100644 index 590d62f..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_off_2.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_off_3.png b/mesecons_delayer/textures/mesecons_delayer_off_3.png deleted file mode 100644 index 57ac4c4..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_off_3.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_off_4.png b/mesecons_delayer/textures/mesecons_delayer_off_4.png deleted file mode 100644 index 94fc00c..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_off_4.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_on_1.png b/mesecons_delayer/textures/mesecons_delayer_on_1.png deleted file mode 100644 index 9369a4e..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_on_1.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_on_2.png b/mesecons_delayer/textures/mesecons_delayer_on_2.png deleted file mode 100644 index 7984ef4..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_on_2.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_on_3.png b/mesecons_delayer/textures/mesecons_delayer_on_3.png deleted file mode 100644 index 1799cad..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_on_3.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_on_4.png b/mesecons_delayer/textures/mesecons_delayer_on_4.png deleted file mode 100644 index 0386112..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_on_4.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_sides_off.png b/mesecons_delayer/textures/mesecons_delayer_sides_off.png deleted file mode 100644 index 2c60cbb..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_sides_off.png and /dev/null differ diff --git a/mesecons_delayer/textures/mesecons_delayer_sides_on.png b/mesecons_delayer/textures/mesecons_delayer_sides_on.png deleted file mode 100644 index 4927557..0000000 Binary files a/mesecons_delayer/textures/mesecons_delayer_sides_on.png and /dev/null differ diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua index d5e3c4f..a8d0300 100644 --- a/mesecons_detector/init.lua +++ b/mesecons_detector/init.lua @@ -4,6 +4,16 @@ local side_texture = mesecon.texture.steel_block or "mesecons_detector_side.png" local GET_COMMAND = "GET" + +local function comma_list_to_table(comma_list) + local tbl = {} + for _, str in ipairs(string.split(comma_list:gsub("%s", ""), ",")) do + tbl[str] = true + end + return tbl +end + + -- Object detector -- Detects players in a certain radius -- The radius can be specified in mesecons/settings.lua @@ -35,10 +45,7 @@ local function object_detector_scan(pos) if next(objs) == nil then return false end local scanname = minetest.get_meta(pos):get_string("scanname") - local scan_for = {} - for _, str in pairs(string.split(scanname:gsub(" ", ""), ",")) do - scan_for[str] = true - end + local scan_for = comma_list_to_table(scanname) local every_player = scanname == "" for _, obj in pairs(objs) do @@ -188,8 +195,9 @@ local function node_detector_scan(pos) vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance + 1)) ).name local scanname = meta:get_string("scanname") + local scan_for = comma_list_to_table(scanname) - return (frontname == scanname) or + return (scan_for[frontname]) or (frontname ~= "air" and frontname ~= "ignore" and scanname == "") end @@ -215,10 +223,10 @@ local node_detector_digiline = { if type(msg) == "table" then if msg.distance or msg.scanname then - if msg.distance then + if type(msg.distance) == "number" or type(msg.distance) == "string" then meta:set_string("distance", msg.distance) end - if msg.scanname then + if type(msg.scanname) == "string" then meta:set_string("scanname", msg.scanname) end node_detector_make_formspec(pos) @@ -232,7 +240,7 @@ local node_detector_digiline = { else if msg == GET_COMMAND then node_detector_send_node_name(pos, node, channel, meta) - else + elseif type(msg) == "string" then meta:set_string("scanname", msg) node_detector_make_formspec(pos) end diff --git a/mesecons_detector/locale/mesecons_detector.fr.tr b/mesecons_detector/locale/mesecons_detector.fr.tr new file mode 100644 index 0000000..dadfa90 --- /dev/null +++ b/mesecons_detector/locale/mesecons_detector.fr.tr @@ -0,0 +1,5 @@ +# textdomain: mesecons_detector + +### init.lua ### +Player Detector=Détecteur de joueur +Node Detector=Détecteur de bloc diff --git a/mesecons_doors/init.lua b/mesecons_doors/init.lua index 3228f03..18f5d3a 100644 --- a/mesecons_doors/init.lua +++ b/mesecons_doors/init.lua @@ -73,68 +73,67 @@ local function meseconify_door(name) end end -meseconify_door("doors:door_wood") -meseconify_door("doors:door_steel") -meseconify_door("doors:door_glass") -meseconify_door("doors:door_obsidian_glass") -meseconify_door("xpanes:door_steel_bar") +local doors_list = { + "doors:door_wood", + "doors:door_steel", + "doors:door_glass", + "doors:door_obsidian_glass", + "xpanes:door_steel_bar", +} +for i=1,#doors_list do meseconify_door(doors_list[i]) end -- Trapdoor -local function trapdoor_switch(pos, node) - local state = minetest.get_meta(pos):get_int("state") +local function trapdoor_switch(name) + return function(pos, node) + local state = minetest.get_meta(pos):get_int("state") + if state == 1 then + minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true) + minetest.set_node(pos, {name=name, param2 = node.param2}) + else + minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true) + minetest.set_node(pos, {name=name.."_open", param2 = node.param2}) + end + minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1) + end +end - if state == 1 then - minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true) - minetest.set_node(pos, {name="doors:trapdoor", param2 = node.param2}) +local function meseconify_trapdoor(name) + local override + if doors and doors.get then + override = { + mesecons = {effector = { + action_on = function(pos) + local door = doors.get(pos) + if door then + door:open() + end + end, + action_off = function(pos) + local door = doors.get(pos) + if door then + door:close() + end + end, + }}, + } else - minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true) - minetest.set_node(pos, {name="doors:trapdoor_open", param2 = node.param2}) + override = { + mesecons = {effector = { + action_on = trapdoor_switch(name), + action_off = trapdoor_switch(name) + }}, + } end - minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1) + if minetest.registered_items[name] then + minetest.override_item(name, override) + minetest.override_item(name.."_open", override) + end end -if doors and doors.get then - local override = { - mesecons = {effector = { - action_on = function(pos) - local door = doors.get(pos) - if door then - door:open() - end - end, - action_off = function(pos) - local door = doors.get(pos) - if door then - door:close() - end - end, - }}, - } - minetest.override_item("doors:trapdoor", override) - minetest.override_item("doors:trapdoor_open", override) - minetest.override_item("doors:trapdoor_steel", override) - minetest.override_item("doors:trapdoor_steel_open", override) - - if minetest.registered_items["xpanes:trapdoor_steel_bar"] then - minetest.override_item("xpanes:trapdoor_steel_bar", override) - minetest.override_item("xpanes:trapdoor_steel_bar_open", override) - end - -else - if minetest.registered_nodes["doors:trapdoor"] then - minetest.override_item("doors:trapdoor", { - mesecons = {effector = { - action_on = trapdoor_switch, - action_off = trapdoor_switch - }}, - }) - - minetest.override_item("doors:trapdoor_open", { - mesecons = {effector = { - action_on = trapdoor_switch, - action_off = trapdoor_switch - }}, - }) - end -end +local trapdoors_list = { + "doors:trapdoor", + "doors:trapdoor_steel", + "xpanes:trapdoor_steel_bar" +} +for i=1,#trapdoors_list do meseconify_trapdoor(trapdoors_list[i]) end diff --git a/mesecons_extrawires/locale/mesecons_extrawires.fr.tr b/mesecons_extrawires/locale/mesecons_extrawires.fr.tr new file mode 100644 index 0000000..46992a6 --- /dev/null +++ b/mesecons_extrawires/locale/mesecons_extrawires.fr.tr @@ -0,0 +1,20 @@ +# textdomain: mesecons_extrawires + +### corner.lua ### +Insulated Mesecon Corner=Coin de Mesecon isolé + +### crossover.lua ### +Insulated Mesecon Crossover=Croisement de Mesecon isolé +You hacker you!=Vous êtes un pirate informatique ! + +### doublecorner.lua ### +Insulated Mesecon Double Corner=Double coin de Mesecon isolé + +### mesewire.lua ### +Mese Wire=Câble de Mesecon + +### tjunction.lua ### +Insulated Mesecon T-junction=Croisement en T de Mesecon isolé + +### vertical.lua ### +Vertical Mesecon=Mesecon vertical diff --git a/mesecons_extrawires/vertical.lua b/mesecons_extrawires/vertical.lua index 9e132ac..636bb37 100644 --- a/mesecons_extrawires/vertical.lua +++ b/mesecons_extrawires/vertical.lua @@ -40,35 +40,39 @@ local bottom_rules = { {x=0, y=2, z=0} -- receive power from pressure plate / detector / ... 2 nodes above } +local function is_vertical_conductor(nodename) + local def = minetest.registered_nodes[nodename] + return def and def.is_vertical_conductor +end + local vertical_updatepos = function (pos) local node = minetest.get_node(pos) - if minetest.registered_nodes[node.name] - and minetest.registered_nodes[node.name].is_vertical_conductor then - local node_above = minetest.get_node(vector.add(pos, vertical_rules[1])) - local node_below = minetest.get_node(vector.add(pos, vertical_rules[2])) - - local above = minetest.registered_nodes[node_above.name] - and minetest.registered_nodes[node_above.name].is_vertical_conductor - local below = minetest.registered_nodes[node_below.name] - and minetest.registered_nodes[node_below.name].is_vertical_conductor - - mesecon.on_dignode(pos, node) - - -- Always place offstate conductor and let mesecon.on_placenode take care - local newname = "mesecons_extrawires:vertical_" - if above and below then -- above and below: vertical mesecon - newname = newname .. "off" - elseif above and not below then -- above only: bottom - newname = newname .. "bottom_off" - elseif not above and below then -- below only: top - newname = newname .. "top_off" - else -- no vertical wire above, no vertical wire below: use bottom - newname = newname .. "bottom_off" - end - - minetest.set_node(pos, {name = newname}) - mesecon.on_placenode(pos, {name = newname}) + if not is_vertical_conductor(node.name) then + return end + + local node_above = minetest.get_node(vector.add(pos, vertical_rules[1])) + local node_below = minetest.get_node(vector.add(pos, vertical_rules[2])) + + local above = is_vertical_conductor(node_above.name) + local below = is_vertical_conductor(node_below.name) + + mesecon.on_dignode(pos, node) + + -- Always place offstate conductor and let mesecon.on_placenode take care + local newname = "mesecons_extrawires:vertical_" + if above and below then -- above and below: vertical mesecon + newname = newname .. "off" + elseif above and not below then -- above only: bottom + newname = newname .. "bottom_off" + elseif not above and below then -- below only: top + newname = newname .. "top_off" + else -- no vertical wire above, no vertical wire below: use bottom + newname = newname .. "bottom_off" + end + + minetest.set_node(pos, {name = newname}) + mesecon.on_placenode(pos, {name = newname}) end local vertical_update = function (pos) diff --git a/mesecons_fpga/init.lua b/mesecons_fpga/init.lua index fe86ad4..0af9d1b 100644 --- a/mesecons_fpga/init.lua +++ b/mesecons_fpga/init.lua @@ -20,10 +20,10 @@ plg.register_nodes = function(template) -- build top texture string local texture = "jeija_fpga_top.png" - if a == 1 then texture = texture .. "^jeija_microcontroller_LED_A.png" end - if b == 1 then texture = texture .. "^jeija_microcontroller_LED_B.png" end - if c == 1 then texture = texture .. "^jeija_microcontroller_LED_C.png" end - if d == 1 then texture = texture .. "^jeija_microcontroller_LED_D.png" end + if a == 1 then texture = texture .. "^jeija_luacontroller_LED_A.png" end + if b == 1 then texture = texture .. "^jeija_luacontroller_LED_B.png" end + if c == 1 then texture = texture .. "^jeija_luacontroller_LED_C.png" end + if d == 1 then texture = texture .. "^jeija_luacontroller_LED_D.png" end ndef.tiles[1] = texture ndef.inventory_image = texture diff --git a/mesecons_fpga/locale/mesecons_fpga.fr.tr b/mesecons_fpga/locale/mesecons_fpga.fr.tr new file mode 100644 index 0000000..c0fccab --- /dev/null +++ b/mesecons_fpga/locale/mesecons_fpga.fr.tr @@ -0,0 +1,7 @@ +# textdomain: mesecons_fpga + +### init.lua ### +FPGA=Circuit logique programmable (FPGA) + +### tool.lua ### +FPGA Programmer=Programmateur de circuit logique diff --git a/mesecons_gamecompat/compat_mcl.lua b/mesecons_gamecompat/compat_mcl.lua new file mode 100644 index 0000000..10e1a8a --- /dev/null +++ b/mesecons_gamecompat/compat_mcl.lua @@ -0,0 +1,43 @@ + +--Aliases + +minetest.register_alias("mesecons_gamecompat:chest", "mcl_chests:chest") +minetest.register_alias("mesecons_gamecompat:chest_locked", "mcl_chests:chest") +minetest.register_alias("mesecons_gamecompat:coalblock", "mcl_core:coalblock") +minetest.register_alias("mesecons_gamecompat:cobble", "mcl_core:cobble") +minetest.register_alias("mesecons_gamecompat:glass", "mcl_core:glass") +minetest.register_alias("mesecons_gamecompat:lava_source", "mcl_core:lava_source") +minetest.register_alias("mesecons_gamecompat:mese", "mesecons:redstoneblock") +minetest.register_alias("mesecons_gamecompat:mese_crystal", "mesecoms:redstone") +minetest.register_alias("mesecons_gamecompat:mese_crystal_fragment", "mesecons:redstone") +minetest.register_alias("mesecons_gamecompat:obsidian_glass", "mcl_core:glass") +minetest.register_alias("mesecons_gamecompat:stone", "mcl_core:stone") +minetest.register_alias("mesecons_gamecompat:steel_ingot", "mcl_core:iron_ingot") +minetest.register_alias("mesecons_gamecompat:steelblock", "mcl_core:steelblock") +minetest.register_alias("mesecons_gamecompat:torch", "mcl_torches:torch") + +if minetest.get_modpath("mcl_dyes") then + for color, def in ipairs(mcl_dyes.colors) do + minetest.register_alias("mesecons_gamecompat:dye_" .. def.mcl2, "mcl_dyes:" .. color) + end +end + +-- Sounds + +mesecon.node_sound.default = mcl_sounds.node_sound_defaults() +mesecon.node_sound.glass = mcl_sounds.node_sound_glass_defaults() +mesecon.node_sound.leaves = mcl_sounds.node_sound_leaves_defaults() +mesecon.node_sound.stone = mcl_sounds.node_sound_stone_defaults() +mesecon.node_sound.wood = mcl_sounds.node_sound_wood_defaults() + +if minetest.get_modpath("mcl_fire") then + mesecon.sound_name.fire = "fire_fire" +end + +if minetest.get_modpath("mcl_tnt") then + mesecon.sound_name.explode = "tnt_explode" +end + +-- Textures + +mesecon.texture.steel_block = "default_steel_block.png" diff --git a/mesecons_gamecompat/compat_mtg.lua b/mesecons_gamecompat/compat_mtg.lua index 24af5e0..e658880 100644 --- a/mesecons_gamecompat/compat_mtg.lua +++ b/mesecons_gamecompat/compat_mtg.lua @@ -59,6 +59,10 @@ if minetest.get_modpath("mesecons_mvps") then "doors:hidden", "doors:trapdoor_steel", "doors:trapdoor_steel_open", + "beds:bed_bottom", + "beds:bed_top", + "beds:fancy_bed_bottom", + "beds:fancy_bed_top", "xpanes:door_steel_bar_a", "xpanes:door_steel_bar_b", "xpanes:door_steel_bar_c", diff --git a/mesecons_gamecompat/init.lua b/mesecons_gamecompat/init.lua index 2fc44d1..95c088e 100644 --- a/mesecons_gamecompat/init.lua +++ b/mesecons_gamecompat/init.lua @@ -13,3 +13,8 @@ if minetest.get_modpath("default") then minetest.log("info", "Mesecons: detected Minetest Game for game compatibility") dofile(minetest.get_modpath("mesecons_gamecompat").."/compat_mtg.lua") end + +if minetest.get_modpath("mcl_core") then + minetest.log("info", "Mesecons: detected MineClonia Game for game compatibility") + dofile(minetest.get_modpath("mesecons_gamecompat").."/compat_mcl.lua") +end diff --git a/mesecons_gamecompat/mod.conf b/mesecons_gamecompat/mod.conf index c683108..997f41f 100644 --- a/mesecons_gamecompat/mod.conf +++ b/mesecons_gamecompat/mod.conf @@ -1,3 +1,3 @@ name = mesecons_gamecompat depends = mesecons -optional_depends = fire, default, dye, mesecons_mvps, tnt +optional_depends = fire, default, dye, mesecons_mvps, tnt, mcl_fire, mcl_core, mcl_dye, mcl_tnt diff --git a/mesecons_hydroturbine/locale/mesecons_hydroturbine.fr.tr b/mesecons_hydroturbine/locale/mesecons_hydroturbine.fr.tr new file mode 100644 index 0000000..14e1267 --- /dev/null +++ b/mesecons_hydroturbine/locale/mesecons_hydroturbine.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_hydroturbine + +### init.lua ### +Water Turbine=Détecteur de courant diff --git a/mesecons_insulated/locale/mesecons_insulated.fr.tr b/mesecons_insulated/locale/mesecons_insulated.fr.tr new file mode 100644 index 0000000..82faee9 --- /dev/null +++ b/mesecons_insulated/locale/mesecons_insulated.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_insulated + +### init.lua ### +Straight Insulated Mesecon=Mesecon isolé droit diff --git a/mesecons_lamp/locale/mesecons_lamp.fr.tr b/mesecons_lamp/locale/mesecons_lamp.fr.tr new file mode 100644 index 0000000..a85896e --- /dev/null +++ b/mesecons_lamp/locale/mesecons_lamp.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_lamp + +### init.lua ### +Mesecon Lamp=Lampe de Mesecon diff --git a/mesecons_lightstone/locale/mesecons_lightstone.fr.tr b/mesecons_lightstone/locale/mesecons_lightstone.fr.tr new file mode 100644 index 0000000..6e44c57 --- /dev/null +++ b/mesecons_lightstone/locale/mesecons_lightstone.fr.tr @@ -0,0 +1,15 @@ +# textdomain: mesecons_lightstone + +### init.lua ### +Red Lightstone=Pierre lumineuse rouge +Green Lightstone=Pierre lumineuse verte +Blue Lightstone=Pierre lumineuse bleue +Grey Lightstone=Pierre lumineuse grise +Dark Grey Lightstone=Pierre lumineuse gris foncée +Yellow Lightstone=Pierre lumineuse jaune +Orange Lightstone=Pierre lumineuse orange +White Lightstone=Pierre lumineuse blanche +Pink Lightstone=Pierre lumineuse rose +Magenta Lightstone=Pierre lumineuse magenta +Cyan Lightstone=Pierre lumineuse bleu clair +Violet Lightstone=Pierre lumineuse violette diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index 0ee2def..90516c0 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -388,7 +388,10 @@ local function clean_and_weigh_digiline_message(msg, back_references) return msg, #msg + 25 elseif t == "number" then -- Numbers are passed by value so need not be touched, and cost 8 bytes - -- as all numbers in Lua are doubles. + -- as all numbers in Lua are doubles. NaN values are removed. + if msg ~= msg then + return nil, 0 + end return msg, 8 elseif t == "boolean" then -- Booleans are passed by value so need not be touched, and cost 1 diff --git a/mesecons_luacontroller/locale/mesecons_luacontroller.fr.tr b/mesecons_luacontroller/locale/mesecons_luacontroller.fr.tr new file mode 100644 index 0000000..30fabac --- /dev/null +++ b/mesecons_luacontroller/locale/mesecons_luacontroller.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_luacontroller + +### init.lua ### +Luacontroller=Programmateur LUA diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_A.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_A.png deleted file mode 100644 index c6182cc..0000000 Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_A.png and /dev/null differ diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_B.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_B.png deleted file mode 100644 index 04c2da0..0000000 Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_B.png and /dev/null differ diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_C.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_C.png deleted file mode 100644 index 01f6ae4..0000000 Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_C.png and /dev/null differ diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_D.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_D.png deleted file mode 100644 index 6c8a26f..0000000 Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_D.png and /dev/null differ diff --git a/mesecons_materials/locale/mesecons_materials.fr.tr b/mesecons_materials/locale/mesecons_materials.fr.tr new file mode 100644 index 0000000..ddec829 --- /dev/null +++ b/mesecons_materials/locale/mesecons_materials.fr.tr @@ -0,0 +1,6 @@ +# textdomain: mesecons_materials + +### init.lua ### +Glue=Colle +Fiber=Fibre +Silicon=Silicone diff --git a/mesecons_microcontroller/doc/microcontroller/description.html b/mesecons_microcontroller/doc/microcontroller/description.html new file mode 100644 index 0000000..af1e5c3 --- /dev/null +++ b/mesecons_microcontroller/doc/microcontroller/description.html @@ -0,0 +1,64 @@ + +

The Microcontroller is a semi-advanced programmable component with a persistent +256 bit EEPROM memory.

+

Warning: This device is largely considered deprecated and might contain bugs. It +is recommended to use a Luacontroller instead.

+

Detailed documentation can be found below:

+
    +
  • The Microcontroller's code is executed whenever any of the following events +happens:
      +
    • The Microcontroller is programmed. In this case the EEPROM and ports are all +reset to 0 before.
    • +
    • An incoming signal changes its state.
    • +
    • An after event happens (see command after below).
    • +
    +
  • +
  • There are 4 I/O ports (ABCD) and 256 EEPROM bits (1 to 256).
  • +
  • The code consists of a sequence of commands.
  • +
  • Everything after : is a comment.
  • +
  • Strings are enclosed in "s.
  • +
  • Spaces and tabs outside of strings are ignored.
  • +
  • Basic command syntax:
        command_name`(`param1`,` param2`,` ...`)`
    +
    +
  • +
  • Commands:
      +
    • if(condition) commands [> else_commands];: +Evaluates the given condition and takes the corresponding branch. +The else branch is optional (as indicated by the [ and ]). The > is part +of the syntax and indicates the start of the else branch. The ; marks the +end of the if command.
    • +
    • on(port1, port2, ...): +Sets the given ports to 1.
    • +
    • off(port1, port2, ...): +Sets the given ports to 0.
    • +
    • print("string" or codition, ...): +Evaluates the conditions and prints the concatenation of all params to stdout +(only useful in singleplayer).
    • +
    • after(time, "more commands"): +Executes the commands in the string after the given time in seconds. +There can only be one waiting after event at once. +Warning: This is not reliable, ie. minetest.after is used.
    • +
    • sbi(port_or_eeprom, condition): +Evaluates the condition and sets the port or EEPROM bit to the resulting value. +Note: EEPROM indices don't use # here, ie. it's sbi(1, #2), not sbi(#1, #2).
    • +
    +
  • +
  • Conditions (sorted by descending precedence; they are all evaluated from left +to right):
      +
    • 0, 1: constant
    • +
    • A, ..., D: value of a port. Takes writes that already happened during the +current execution into account.
    • +
    • #1, ..., #256: value of an EEPROM bit. Takes writes that already happened +during the current execution into account.
    • +
    • !condition: negation (can only be applied once, ie. not !!1)
    • +
    • condition1 = condition2: XNOR (equality)
    • +
    • condition1 op condition2 where op is one of:
        +
      • &: AND
      • +
      • |: OR
      • +
      • ~: XOR (inequality)
      • +
      +
    • +
    • Note: Explicit precedence using parentheses is not supported.
    • +
    +
  • +
diff --git a/mesecons_microcontroller/doc/microcontroller/description.md b/mesecons_microcontroller/doc/microcontroller/description.md new file mode 100644 index 0000000..a723537 --- /dev/null +++ b/mesecons_microcontroller/doc/microcontroller/description.md @@ -0,0 +1,59 @@ + + +The Microcontroller is a semi-advanced programmable component with a persistent +256 bit EEPROM memory. + +Warning: This device is largely considered deprecated and might contain bugs. It +is recommended to use a Luacontroller instead. + +Detailed documentation can be found below: + +* The Microcontroller's code is executed whenever any of the following events + happens: + * The Microcontroller is programmed. In this case the EEPROM and ports are all + reset to `0` before. + * An incoming signal changes its state. + * An `after` event happens (see command `after` below). +* There are 4 I/O ports (ABCD) and 256 EEPROM bits (1 to 256). +* The code consists of a sequence of commands. +* Everything after `:` is a comment. +* Strings are enclosed in `"`s. +* Spaces and tabs outside of strings are ignored. +* Basic command syntax: + ``` + command_name`(`param1`,` param2`,` ...`)` + ``` +* Commands: + * `if(condition) commands [> else_commands];`: + Evaluates the given condition and takes the corresponding branch. + The else branch is optional (as indicated by the `[` and `]`). The `>` is part + of the syntax and indicates the start of the else branch. The `;` marks the + end of the if command. + * `on(port1, port2, ...)`: + Sets the given ports to `1`. + * `off(port1, port2, ...)`: + Sets the given ports to `0`. + * `print("string" or codition, ...)`: + Evaluates the conditions and prints the concatenation of all params to stdout + (only useful in singleplayer). + * `after(time, "more commands")`: + Executes the commands in the string after the given time in seconds. + There can only be one waiting `after` event at once. + Warning: This is not reliable, ie. `minetest.after` is used. + * `sbi(port_or_eeprom, condition)`: + Evaluates the condition and sets the port or EEPROM bit to the resulting value. + Note: EEPROM indices don't use `#` here, ie. it's `sbi(1, #2)`, not `sbi(#1, #2)`. +* Conditions (sorted by descending precedence; they are all evaluated from left + to right): + * `0`, `1`: constant + * `A`, ..., `D`: value of a port. Takes writes that already happened during the + current execution into account. + * `#1`, ..., `#256`: value of an EEPROM bit. Takes writes that already happened + during the current execution into account. + * `!condition`: negation (can only be applied once, ie. not `!!1`) + * `condition1 = condition2`: XNOR (equality) + * `condition1 op condition2` where `op` is one of: + * `&`: AND + * `|`: OR + * `~`: XOR (inequality) + * Note: Explicit precedence using parentheses is not supported. diff --git a/mesecons_microcontroller/doc/microcontroller/preview.png b/mesecons_microcontroller/doc/microcontroller/preview.png new file mode 100644 index 0000000..cf15882 Binary files /dev/null and b/mesecons_microcontroller/doc/microcontroller/preview.png differ diff --git a/mesecons_microcontroller/doc/microcontroller/recipe.png b/mesecons_microcontroller/doc/microcontroller/recipe.png new file mode 100644 index 0000000..bf6ebd3 Binary files /dev/null and b/mesecons_microcontroller/doc/microcontroller/recipe.png differ diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index d28df2b..271b17d 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -12,16 +12,16 @@ for d = 0, 1 do local nodename = "mesecons_microcontroller:microcontroller"..tostring(d)..tostring(c)..tostring(b)..tostring(a) local top = "jeija_microcontroller_top.png" if tostring(a) == "1" then - top = top.."^jeija_microcontroller_LED_A.png" + top = top.."^jeija_luacontroller_LED_A.png" end if tostring(b) == "1" then - top = top.."^jeija_microcontroller_LED_B.png" + top = top.."^jeija_luacontroller_LED_B.png" end if tostring(c) == "1" then - top = top.."^jeija_microcontroller_LED_C.png" + top = top.."^jeija_luacontroller_LED_C.png" end if tostring(d) == "1" then - top = top.."^jeija_microcontroller_LED_D.png" + top = top.."^jeija_luacontroller_LED_D.png" end local groups if tostring(d)..tostring(c)..tostring(b)..tostring(a) ~= "0000" then @@ -122,7 +122,7 @@ minetest.register_node(nodename, { elseif fields.bnand then fields.code = "sbi(C, !A|!B) :A and B are inputs, C is output" elseif fields.btflop then - fields.code = "if(A)sbi(1,1);if(!A)sbi(B,!B)sbi(1,0); if(C)off(B,1); :A is input, B is output (Q), C is reset, toggles with falling edge" + fields.code = "if(A)sbi(1,1);if(!A)sbi(B,!B)sbi(1,0); if(C)off(B); :A is input, B is output (Q), C is reset, toggles with falling edge" elseif fields.brsflop then fields.code = "if(A)on(C);if(B)off(C); :A is S (Set), B is R (Reset), C is output (R dominates)" end diff --git a/mesecons_microcontroller/locale/mesecons_microcontroller.fr.tr b/mesecons_microcontroller/locale/mesecons_microcontroller.fr.tr new file mode 100644 index 0000000..c81a75b --- /dev/null +++ b/mesecons_microcontroller/locale/mesecons_microcontroller.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_microcontroller + +### init.lua ### +Microcontroller=Micro-controlleur diff --git a/mesecons_movestones/locale/mesecons_movestone.fr.tr b/mesecons_movestones/locale/mesecons_movestone.fr.tr new file mode 100644 index 0000000..3547c93 --- /dev/null +++ b/mesecons_movestones/locale/mesecons_movestone.fr.tr @@ -0,0 +1,7 @@ +# textdomain: mesecons_movestones + +### init.lua ### +Movestone=Pierre mouvante +Sticky Movestone=Pierre collante mouvante +Vertical Movestone=Pierre mouvante verticalement +Vertical Sticky Movestone=Pierre collante mouvante verticalement diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index 5cb9c8f..aacef33 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -81,9 +81,9 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky) if #nodes > maximum then return nil end -- add connected nodes to frontiers - if minetest.registered_nodes[nn.name] - and minetest.registered_nodes[nn.name].mvps_sticky then - local connected = minetest.registered_nodes[nn.name].mvps_sticky(np, nn) + local nndef = minetest.registered_nodes[nn.name] + if nndef and nndef.mvps_sticky then + local connected = nndef.mvps_sticky(np, nn) for _, cp in ipairs(connected) do frontiers:add(cp) end @@ -96,10 +96,9 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky) for _, r in ipairs(mesecon.rules.alldirs) do local adjpos = vector.add(np, r) local adjnode = minetest.get_node(adjpos) - if minetest.registered_nodes[adjnode.name] - and minetest.registered_nodes[adjnode.name].mvps_sticky then - local sticksto = minetest.registered_nodes[adjnode.name] - .mvps_sticky(adjpos, adjnode) + local adjdef = minetest.registered_nodes[adjnode.name] + if adjdef and adjdef.mvps_sticky then + local sticksto = adjdef.mvps_sticky(adjpos, adjnode) -- connects to this position? for _, link in ipairs(sticksto) do diff --git a/mesecons_noteblock/locale/mesecons_noteblock.fr.tr b/mesecons_noteblock/locale/mesecons_noteblock.fr.tr new file mode 100644 index 0000000..8a2d632 --- /dev/null +++ b/mesecons_noteblock/locale/mesecons_noteblock.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_noteblock + +### init.lua ### +Noteblock=Bloc de musique diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 3d75b35..274258e 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -270,9 +270,9 @@ minetest.register_node("mesecons_pistons:piston_normal_off", { description = S("Piston"), tiles = { "mesecons_piston_top.png", - "mesecons_piston_bottom.png", - "mesecons_piston_left.png", - "mesecons_piston_right.png", + "mesecons_piston_top.png^[transform2", + "mesecons_piston_top.png^[transform3", + "mesecons_piston_top.png^[transform1", "mesecons_piston_back.png", "mesecons_piston_pusher_front.png" }, @@ -296,9 +296,9 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { drawtype = "nodebox", tiles = { "mesecons_piston_top.png", - "mesecons_piston_bottom.png", - "mesecons_piston_left.png", - "mesecons_piston_right.png", + "mesecons_piston_top.png^[transform2", + "mesecons_piston_top.png^[transform3", + "mesecons_piston_top.png^[transform1", "mesecons_piston_back.png", "mesecons_piston_on_front.png" }, @@ -325,9 +325,9 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", { drawtype = "nodebox", tiles = { "mesecons_piston_pusher_top.png", - "mesecons_piston_pusher_bottom.png", - "mesecons_piston_pusher_left.png", - "mesecons_piston_pusher_right.png", + "mesecons_piston_pusher_top.png^[transform2", + "mesecons_piston_pusher_top.png^[transform3", + "mesecons_piston_pusher_top.png^[transform1", "mesecons_piston_pusher_back.png", "mesecons_piston_pusher_front.png" }, @@ -349,9 +349,9 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { description = S("Sticky Piston"), tiles = { "mesecons_piston_top.png", - "mesecons_piston_bottom.png", - "mesecons_piston_left.png", - "mesecons_piston_right.png", + "mesecons_piston_top.png^[transform2", + "mesecons_piston_top.png^[transform3", + "mesecons_piston_top.png^[transform1", "mesecons_piston_back.png", "mesecons_piston_pusher_front_sticky.png" }, @@ -375,9 +375,9 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { drawtype = "nodebox", tiles = { "mesecons_piston_top.png", - "mesecons_piston_bottom.png", - "mesecons_piston_left.png", - "mesecons_piston_right.png", + "mesecons_piston_top.png^[transform2", + "mesecons_piston_top.png^[transform3", + "mesecons_piston_top.png^[transform1", "mesecons_piston_back.png", "mesecons_piston_on_front.png" }, @@ -404,9 +404,9 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", { drawtype = "nodebox", tiles = { "mesecons_piston_pusher_top.png", - "mesecons_piston_pusher_bottom.png", - "mesecons_piston_pusher_left.png", - "mesecons_piston_pusher_right.png", + "mesecons_piston_pusher_top.png^[transform2", + "mesecons_piston_pusher_top.png^[transform3", + "mesecons_piston_pusher_top.png^[transform1", "mesecons_piston_pusher_back.png", "mesecons_piston_pusher_front_sticky.png" }, diff --git a/mesecons_pistons/locale/mesecons_pistons.fr.tr b/mesecons_pistons/locale/mesecons_pistons.fr.tr new file mode 100644 index 0000000..5be2ea3 --- /dev/null +++ b/mesecons_pistons/locale/mesecons_pistons.fr.tr @@ -0,0 +1,9 @@ +# textdomain: mesecons_pistons + +### init.lua ### +Piston=Piston +Activated Piston Base=Base de piston activé +Piston Pusher=Bras de piston +Sticky Piston=Piston collant +Activated Sticky Piston Base=Base de piston collant activé +Sticky Piston Pusher=Bras de piston collant diff --git a/mesecons_pistons/textures/mesecons_piston_bottom.png b/mesecons_pistons/textures/mesecons_piston_bottom.png deleted file mode 100644 index d4b2fbf..0000000 Binary files a/mesecons_pistons/textures/mesecons_piston_bottom.png and /dev/null differ diff --git a/mesecons_pistons/textures/mesecons_piston_left.png b/mesecons_pistons/textures/mesecons_piston_left.png deleted file mode 100644 index a560a7d..0000000 Binary files a/mesecons_pistons/textures/mesecons_piston_left.png and /dev/null differ diff --git a/mesecons_pistons/textures/mesecons_piston_pusher_bottom.png b/mesecons_pistons/textures/mesecons_piston_pusher_bottom.png deleted file mode 100644 index cc6420e..0000000 Binary files a/mesecons_pistons/textures/mesecons_piston_pusher_bottom.png and /dev/null differ diff --git a/mesecons_pistons/textures/mesecons_piston_pusher_left.png b/mesecons_pistons/textures/mesecons_piston_pusher_left.png deleted file mode 100644 index 43d0327..0000000 Binary files a/mesecons_pistons/textures/mesecons_piston_pusher_left.png and /dev/null differ diff --git a/mesecons_pistons/textures/mesecons_piston_pusher_right.png b/mesecons_pistons/textures/mesecons_piston_pusher_right.png deleted file mode 100644 index af86c0f..0000000 Binary files a/mesecons_pistons/textures/mesecons_piston_pusher_right.png and /dev/null differ diff --git a/mesecons_pistons/textures/mesecons_piston_right.png b/mesecons_pistons/textures/mesecons_piston_right.png deleted file mode 100644 index 02fa023..0000000 Binary files a/mesecons_pistons/textures/mesecons_piston_right.png and /dev/null differ diff --git a/mesecons_powerplant/locale/mesecons_powerplant.fr.tr b/mesecons_powerplant/locale/mesecons_powerplant.fr.tr new file mode 100644 index 0000000..5098d63 --- /dev/null +++ b/mesecons_powerplant/locale/mesecons_powerplant.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_powerplant + +### init.lua ### +Power Plant=Centrale à signal actif \ No newline at end of file diff --git a/mesecons_pressureplates/locale/mesecons_pressureplates.fr.tr b/mesecons_pressureplates/locale/mesecons_pressureplates.fr.tr new file mode 100644 index 0000000..23d0c5b --- /dev/null +++ b/mesecons_pressureplates/locale/mesecons_pressureplates.fr.tr @@ -0,0 +1,5 @@ +# textdomain: mesecons_pressureplates + +### init.lua ### +Wooden Pressure Plate=Plaque de pression en bois +Stone Pressure Plate=Plaque de pression en pierre diff --git a/mesecons_random/locale/mesecons_random.fr.tr b/mesecons_random/locale/mesecons_random.fr.tr new file mode 100644 index 0000000..15bdb0c --- /dev/null +++ b/mesecons_random/locale/mesecons_random.fr.tr @@ -0,0 +1,5 @@ +# textdomain: mesecons_random + +### init.lua ### +Removestone=Pierre de suppression +Ghoststone=Pierre fantôme diff --git a/mesecons_solarpanel/locale/mesecons_solarpanel.fr.tr b/mesecons_solarpanel/locale/mesecons_solarpanel.fr.tr new file mode 100644 index 0000000..ed41452 --- /dev/null +++ b/mesecons_solarpanel/locale/mesecons_solarpanel.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_solarpanel + +### init.lua ### +Solar Panel=Détecteur solaire diff --git a/mesecons_stickyblocks/locale/mesecons_stickyblocks.fr.tr b/mesecons_stickyblocks/locale/mesecons_stickyblocks.fr.tr new file mode 100644 index 0000000..9dc82d7 --- /dev/null +++ b/mesecons_stickyblocks/locale/mesecons_stickyblocks.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_stickyblocks + +### init.lua ### +Sticky Block=Bloc collant diff --git a/mesecons_switch/locale/mesecons_switch.fr.tr b/mesecons_switch/locale/mesecons_switch.fr.tr new file mode 100644 index 0000000..6c07c64 --- /dev/null +++ b/mesecons_switch/locale/mesecons_switch.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_switch + +### init.lua ### +Switch=Commutateur diff --git a/mesecons_torch/init.lua b/mesecons_torch/init.lua index ab2df98..6469d7b 100644 --- a/mesecons_torch/init.lua +++ b/mesecons_torch/init.lua @@ -56,8 +56,8 @@ local torch_selectionbox = } minetest.register_node("mesecons_torch:mesecon_torch_off", { - drawtype = "torchlike", - tiles = {"jeija_torches_off.png", "jeija_torches_off_ceiling.png", "jeija_torches_off_side.png"}, + drawtype = "plantlike", + tiles = {"jeija_torches_off.png"}, inventory_image = "jeija_torches_off.png", paramtype = "light", is_ground_content = false, @@ -75,8 +75,8 @@ minetest.register_node("mesecons_torch:mesecon_torch_off", { }) minetest.register_node("mesecons_torch:mesecon_torch_on", { - drawtype = "torchlike", - tiles = {"jeija_torches_on.png", "jeija_torches_on_ceiling.png", "jeija_torches_on_side.png"}, + drawtype = "plantlike", + tiles = {"jeija_torches_on.png"}, inventory_image = "jeija_torches_on.png", wield_image = "jeija_torches_on.png", paramtype = "light", diff --git a/mesecons_torch/locale/mesecons_torch.fr.tr b/mesecons_torch/locale/mesecons_torch.fr.tr new file mode 100644 index 0000000..50687b3 --- /dev/null +++ b/mesecons_torch/locale/mesecons_torch.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_torch + +### init.lua ### +Mesecon Torch=Torche de Mesecon diff --git a/mesecons_torch/textures/jeija_torches_off_ceiling.png b/mesecons_torch/textures/jeija_torches_off_ceiling.png deleted file mode 100644 index 033d2b4..0000000 Binary files a/mesecons_torch/textures/jeija_torches_off_ceiling.png and /dev/null differ diff --git a/mesecons_torch/textures/jeija_torches_off_side.png b/mesecons_torch/textures/jeija_torches_off_side.png deleted file mode 100644 index cf703e5..0000000 Binary files a/mesecons_torch/textures/jeija_torches_off_side.png and /dev/null differ diff --git a/mesecons_torch/textures/jeija_torches_on_ceiling.png b/mesecons_torch/textures/jeija_torches_on_ceiling.png deleted file mode 100644 index 81e7867..0000000 Binary files a/mesecons_torch/textures/jeija_torches_on_ceiling.png and /dev/null differ diff --git a/mesecons_torch/textures/jeija_torches_on_side.png b/mesecons_torch/textures/jeija_torches_on_side.png deleted file mode 100644 index 895a4e3..0000000 Binary files a/mesecons_torch/textures/jeija_torches_on_side.png and /dev/null differ diff --git a/mesecons_walllever/locale/mesecons_walllever.fr.tr b/mesecons_walllever/locale/mesecons_walllever.fr.tr new file mode 100644 index 0000000..4821709 --- /dev/null +++ b/mesecons_walllever/locale/mesecons_walllever.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_walllever + +### init.lua ### +Lever=Levier diff --git a/mesecons_wires/init.lua b/mesecons_wires/init.lua index d869cde..dc1a8ac 100644 --- a/mesecons_wires/init.lua +++ b/mesecons_wires/init.lua @@ -13,11 +13,11 @@ local S = minetest.get_translator(minetest.get_current_modname()) -- self_pos = pos of any mesecon node, from_pos = pos of conductor to getconnect for local wire_getconnect = function (from_pos, self_pos) local node = minetest.get_node(self_pos) - if minetest.registered_nodes[node.name] - and minetest.registered_nodes[node.name].mesecons then + local def = minetest.registered_nodes[node.name] + if def and def.mesecons then -- rules of node to possibly connect to local rules - if (minetest.registered_nodes[node.name].mesecon_wire) then + if def.mesecon_wire then rules = mesecon.rules.default else rules = mesecon.get_any_rules(node) @@ -68,16 +68,18 @@ end local update_on_place_dig = function (pos, node) -- Update placed node (get_node again as it may have been dug) - local nn = minetest.get_node(pos) - if (minetest.registered_nodes[nn.name]) - and (minetest.registered_nodes[nn.name].mesecon_wire) then - wire_updateconnect(pos) + do + local nn = minetest.get_node(pos) + local def = minetest.registered_nodes[nn.name] + if def and def.mesecon_wire then + wire_updateconnect(pos) + end end -- Update nodes around it local rules - if minetest.registered_nodes[node.name] - and minetest.registered_nodes[node.name].mesecon_wire then + local ndef = minetest.registered_nodes[node.name] + if ndef and ndef.mesecon_wire then rules = mesecon.rules.default else rules = mesecon.get_any_rules(node) @@ -86,8 +88,8 @@ local update_on_place_dig = function (pos, node) for _, r in ipairs(mesecon.flattenrules(rules)) do local np = vector.add(pos, r) - if minetest.registered_nodes[minetest.get_node(np).name] - and minetest.registered_nodes[minetest.get_node(np).name].mesecon_wire then + local rdef = minetest.registered_nodes[minetest.get_node(np).name] + if rdef and rdef.mesecon_wire then wire_updateconnect(np) end end diff --git a/mesecons_wires/locale/mesecons_wires.fr.tr b/mesecons_wires/locale/mesecons_wires.fr.tr new file mode 100644 index 0000000..cc8386c --- /dev/null +++ b/mesecons_wires/locale/mesecons_wires.fr.tr @@ -0,0 +1,4 @@ +# textdomain: mesecons_wires + +### init.lua ### +Mesecon=Mesecon diff --git a/modpack.conf b/modpack.conf index 5c56920..2878aae 100644 --- a/modpack.conf +++ b/modpack.conf @@ -1 +1,3 @@ name = mesecons +description = Mod that implements a ton of items related to digital circuitry. +min_minetest_version = 5.0