diff --git a/.gitignore b/.gitignore
index b25c15b..41756b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
*~
+*.patch
+*.diff
diff --git a/mesecons/actionqueue.lua b/mesecons/actionqueue.lua
index f3479ce..5508095 100644
--- a/mesecons/actionqueue.lua
+++ b/mesecons/actionqueue.lua
@@ -1,96 +1,140 @@
-mesecon.queue.actions={} -- contains all ActionQueue actions
+--[[
+Mesecons uses something it calls an ActionQueue.
-function mesecon.queue:add_function(name, func)
- mesecon.queue.funcs[name] = func
+The ActionQueue holds functions and actions.
+Functions are added on load time with a specified name.
+Actions are preserved over server restarts.
+
+Each action consists of a position, the name of an added function to be called,
+the params that should be used in this function call (additionally to the pos),
+the time after which it should be executed, an optional overwritecheck and a
+priority.
+
+If time = 0, the action will be executed in the next globalstep, otherwise the
+earliest globalstep when it will be executed is the after next globalstep.
+
+It is guaranteed, that for two actions ac1, ac2 where ac1 ~= ac2,
+ac1.time == ac2.time, ac1.priority == ac2.priority and ac1 was added earlier
+than ac2, ac1 will be executed before ac2 (but in the same globalstep).
+
+Note: Do not pass references in params, as they can not be preserved.
+
+Also note: Some of the guarantees here might be dropped at some time.
+]]
+
+
+-- localize for speed
+local queue = mesecon.queue
+
+queue.actions = {} -- contains all ActionQueue actions
+
+function queue:add_function(name, func)
+ queue.funcs[name] = func
end
-- If add_action with twice the same overwritecheck and same position are called, the first one is overwritten
-- use overwritecheck nil to never overwrite, but just add the event to the queue
-- priority specifies the order actions are executed within one globalstep, highest first
-- should be between 0 and 1
-function mesecon.queue:add_action(pos, func, params, time, overwritecheck, priority)
+function queue:add_action(pos, func, params, time, overwritecheck, priority)
-- Create Action Table:
time = time or 0 -- time <= 0 --> execute, time > 0 --> wait time until execution
priority = priority or 1
- local action = { pos=mesecon.tablecopy(pos),
- func=func,
- params=mesecon.tablecopy(params or {}),
- time=time,
- owcheck=(overwritecheck and mesecon.tablecopy(overwritecheck)) or nil,
- priority=priority}
+ local action = {
+ pos = mesecon.tablecopy(pos),
+ func = func,
+ params = mesecon.tablecopy(params or {}),
+ time = time,
+ owcheck = (overwritecheck and mesecon.tablecopy(overwritecheck)) or nil,
+ priority = priority
+ }
- local toremove = nil
- -- Otherwise, add the action to the queue
- if overwritecheck then -- check if old action has to be overwritten / removed:
- for i, ac in ipairs(mesecon.queue.actions) do
- if(vector.equals(pos, ac.pos)
- and mesecon.cmpAny(overwritecheck, ac.owcheck)) then
- toremove = i
+ -- check if old action has to be overwritten / removed:
+ if overwritecheck then
+ for i, ac in ipairs(queue.actions) do
+ if vector.equals(pos, ac.pos)
+ and mesecon.cmpAny(overwritecheck, ac.owcheck) then
+ -- remove the old action
+ table.remove(queue.actions, i)
break
end
end
end
- if (toremove ~= nil) then
- table.remove(mesecon.queue.actions, toremove)
- end
-
- table.insert(mesecon.queue.actions, action)
+ table.insert(queue.actions, action)
end
-- execute the stored functions on a globalstep
-- if however, the pos of a function is not loaded (get_node_or_nil == nil), do NOT execute the function
--- this makes sure that resuming mesecons circuits when restarting minetest works fine
+-- this makes sure that resuming mesecons circuits when restarting minetest works fine (hm, where do we do this?)
-- However, even that does not work in some cases, that's why we delay the time the globalsteps
--- start to be execute by 5 seconds
-local get_highest_priority = function (actions)
- local highestp = -1
- local highesti
- for i, ac in ipairs(actions) do
- if ac.priority > highestp then
- highestp = ac.priority
- highesti = i
- end
- end
+-- start to be execute by 4 seconds
- return highesti
-end
+local function globalstep_func(dtime)
+ local actions = queue.actions
+ -- split into two categories:
+ -- actions_now: actions to execute now
+ -- queue.actions: actions to execute later
+ local actions_now = {}
+ queue.actions = {}
-local m_time = 0
-local resumetime = mesecon.setting("resumetime", 4)
-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
- local actions = mesecon.tablecopy(mesecon.queue.actions)
- local actions_now={}
-
- mesecon.queue.actions = {}
-
- -- sort actions into two categories:
- -- those toexecute now (actions_now) and those to execute later (mesecon.queue.actions)
- for i, ac in ipairs(actions) do
+ for _, ac in ipairs(actions) do
if ac.time > 0 then
- ac.time = ac.time - dtime -- executed later
- table.insert(mesecon.queue.actions, ac)
+ -- action ac is to be executed later
+ -- ~> insert into queue.actions
+ ac.time = ac.time - dtime
+ table.insert(queue.actions, ac)
else
+ -- action ac is to be executed now
+ -- ~> insert into actions_now
table.insert(actions_now, ac)
end
end
- while(#actions_now > 0) do -- execute highest priorities first, until all are executed
- local hp = get_highest_priority(actions_now)
- mesecon.queue:execute(actions_now[hp])
- table.remove(actions_now, hp)
+ -- stable-sort the executed actions after their priority
+ -- some constructions might depend on the execution order, hence we first
+ -- execute the actions that had a lower index in actions_now
+ local old_action_order = {}
+ for i, ac in ipairs(actions_now) do
+ old_action_order[ac] = i
end
-end)
+ table.sort(actions_now, function(ac1, ac2)
+ if ac1.priority ~= ac2.priority then
+ return ac1.priority > ac2.priority
+ else
+ return old_action_order[ac1] < old_action_order[ac2]
+ end
+ end)
-function mesecon.queue:execute(action)
+ -- execute highest priorities first, until all are executed
+ for _, ac in ipairs(actions_now) do
+ queue:execute(ac)
+ 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
+
+function queue:execute(action)
-- ignore if action queue function name doesn't exist,
-- (e.g. in case the action queue savegame was written by an old mesecons version)
- if mesecon.queue.funcs[action.func] then
- mesecon.queue.funcs[action.func](action.pos, unpack(action.params))
+ if queue.funcs[action.func] then
+ queue.funcs[action.func](action.pos, unpack(action.params))
end
end
@@ -98,8 +142,8 @@ end
-- Store and read the ActionQueue to / from a file
-- so that upcoming actions are remembered when the game
-- is restarted
-mesecon.queue.actions = mesecon.file2table("mesecon_actionqueue")
+queue.actions = mesecon.file2table("mesecon_actionqueue")
minetest.register_on_shutdown(function()
- mesecon.table2file("mesecon_actionqueue", mesecon.queue.actions)
+ mesecon.table2file("mesecon_actionqueue", queue.actions)
end)
diff --git a/mesecons/depends.txt b/mesecons/depends.txt
deleted file mode 100644
index 4ad96d5..0000000
--- a/mesecons/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-default
diff --git a/mesecons/mod.conf b/mesecons/mod.conf
new file mode 100644
index 0000000..61b628e
--- /dev/null
+++ b/mesecons/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons
+depends = default
diff --git a/mesecons/textures/jeija_close_window.png b/mesecons/textures/jeija_close_window.png
index 5c27c6c..8ab7783 100644
Binary files a/mesecons/textures/jeija_close_window.png and b/mesecons/textures/jeija_close_window.png differ
diff --git a/mesecons/textures/jeija_microcontroller_LED_A.png b/mesecons/textures/jeija_microcontroller_LED_A.png
index 64526cf..6f8f056 100644
Binary files a/mesecons/textures/jeija_microcontroller_LED_A.png and b/mesecons/textures/jeija_microcontroller_LED_A.png differ
diff --git a/mesecons/textures/jeija_microcontroller_LED_B.png b/mesecons/textures/jeija_microcontroller_LED_B.png
index 1f7b451..7cc58ea 100644
Binary files a/mesecons/textures/jeija_microcontroller_LED_B.png and b/mesecons/textures/jeija_microcontroller_LED_B.png differ
diff --git a/mesecons/textures/jeija_microcontroller_LED_C.png b/mesecons/textures/jeija_microcontroller_LED_C.png
index 399cc2c..3046d24 100644
Binary files a/mesecons/textures/jeija_microcontroller_LED_C.png and b/mesecons/textures/jeija_microcontroller_LED_C.png differ
diff --git a/mesecons/textures/jeija_microcontroller_LED_D.png b/mesecons/textures/jeija_microcontroller_LED_D.png
index 506389c..ed46d97 100644
Binary files a/mesecons/textures/jeija_microcontroller_LED_D.png and b/mesecons/textures/jeija_microcontroller_LED_D.png differ
diff --git a/mesecons/textures/jeija_microcontroller_bottom.png b/mesecons/textures/jeija_microcontroller_bottom.png
index 3a9161e..7ae955c 100644
Binary files a/mesecons/textures/jeija_microcontroller_bottom.png and b/mesecons/textures/jeija_microcontroller_bottom.png differ
diff --git a/mesecons/textures/jeija_microcontroller_sides.png b/mesecons/textures/jeija_microcontroller_sides.png
index b367644..40f4b60 100644
Binary files a/mesecons/textures/jeija_microcontroller_sides.png and b/mesecons/textures/jeija_microcontroller_sides.png differ
diff --git a/mesecons/textures/mesecons_wire_inv.png b/mesecons/textures/mesecons_wire_inv.png
index a3930cb..db2676c 100644
Binary files a/mesecons/textures/mesecons_wire_inv.png and b/mesecons/textures/mesecons_wire_inv.png differ
diff --git a/mesecons/textures/mesecons_wire_off.png b/mesecons/textures/mesecons_wire_off.png
index 58164fa..d41f626 100644
Binary files a/mesecons/textures/mesecons_wire_off.png and b/mesecons/textures/mesecons_wire_off.png differ
diff --git a/mesecons/textures/mesecons_wire_on.png b/mesecons/textures/mesecons_wire_on.png
index 98a86c8..239356a 100644
Binary files a/mesecons/textures/mesecons_wire_on.png and b/mesecons/textures/mesecons_wire_on.png differ
diff --git a/mesecons/util.lua b/mesecons/util.lua
index b15858d..7485cac 100644
--- a/mesecons/util.lua
+++ b/mesecons/util.lua
@@ -186,19 +186,11 @@ function mesecon.invertRule(r)
return vector.multiply(r, -1)
end
-function mesecon.tablecopy(table) -- deep table copy
- if type(table) ~= "table" then return table end -- no need to copy
- local newtable = {}
-
- for idx, item in pairs(table) do
- if type(item) == "table" then
- newtable[idx] = mesecon.tablecopy(item)
- else
- newtable[idx] = item
- end
+function mesecon.tablecopy(obj) -- deep copy
+ if type(obj) == "table" then
+ return table.copy(obj)
end
-
- return newtable
+ return obj
end
function mesecon.cmpAny(t1, t2)
diff --git a/mesecons_alias/depends.txt b/mesecons_alias/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_alias/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_alias/mod.conf b/mesecons_alias/mod.conf
new file mode 100644
index 0000000..533d54c
--- /dev/null
+++ b/mesecons_alias/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_alias
+depends = mesecons
diff --git a/mesecons_blinkyplant/depends.txt b/mesecons_blinkyplant/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_blinkyplant/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_blinkyplant/doc/blinkyplant/preview.png b/mesecons_blinkyplant/doc/blinkyplant/preview.png
old mode 100755
new mode 100644
index 40ce5b5..4c93b5f
Binary files a/mesecons_blinkyplant/doc/blinkyplant/preview.png and b/mesecons_blinkyplant/doc/blinkyplant/preview.png differ
diff --git a/mesecons_blinkyplant/doc/blinkyplant/recipe.png b/mesecons_blinkyplant/doc/blinkyplant/recipe.png
index 6f1e148..afd572a 100644
Binary files a/mesecons_blinkyplant/doc/blinkyplant/recipe.png and b/mesecons_blinkyplant/doc/blinkyplant/recipe.png differ
diff --git a/mesecons_blinkyplant/mod.conf b/mesecons_blinkyplant/mod.conf
new file mode 100644
index 0000000..04997b9
--- /dev/null
+++ b/mesecons_blinkyplant/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_blinkyplant
+depends = mesecons
diff --git a/mesecons_blinkyplant/textures/jeija_blinky_plant_off.png b/mesecons_blinkyplant/textures/jeija_blinky_plant_off.png
index 4f507da..a8c22fc 100644
Binary files a/mesecons_blinkyplant/textures/jeija_blinky_plant_off.png and b/mesecons_blinkyplant/textures/jeija_blinky_plant_off.png differ
diff --git a/mesecons_blinkyplant/textures/jeija_blinky_plant_on.png b/mesecons_blinkyplant/textures/jeija_blinky_plant_on.png
index f77a134..3ac576d 100644
Binary files a/mesecons_blinkyplant/textures/jeija_blinky_plant_on.png and b/mesecons_blinkyplant/textures/jeija_blinky_plant_on.png differ
diff --git a/mesecons_button/depends.txt b/mesecons_button/depends.txt
deleted file mode 100644
index 19c798c..0000000
--- a/mesecons_button/depends.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-mesecons
-mesecons_receiver
diff --git a/mesecons_button/doc/button/preview.png b/mesecons_button/doc/button/preview.png
index b69f8f4..8c54020 100644
Binary files a/mesecons_button/doc/button/preview.png and b/mesecons_button/doc/button/preview.png differ
diff --git a/mesecons_button/doc/button/recipe.png b/mesecons_button/doc/button/recipe.png
index c6232b4..67d83cf 100644
Binary files a/mesecons_button/doc/button/recipe.png and b/mesecons_button/doc/button/recipe.png differ
diff --git a/mesecons_button/init.lua b/mesecons_button/init.lua
index 8764fbc..d7b84b6 100644
--- a/mesecons_button/init.lua
+++ b/mesecons_button/init.lua
@@ -8,7 +8,7 @@ mesecon.button_turnoff = function (pos)
return
end
minetest.swap_node(pos, {name = "mesecons_button:button_off", param2 = node.param2})
- minetest.sound_play("mesecons_button_pop", {pos = pos})
+ minetest.sound_play("mesecons_button_pop", { pos = pos }, true)
local rules = mesecon.rules.buttonlike_get(node)
mesecon.receptor_off(pos, rules)
end
@@ -46,7 +46,7 @@ minetest.register_node("mesecons_button:button_off", {
on_rightclick = function (pos, node)
minetest.swap_node(pos, {name = "mesecons_button:button_on", param2=node.param2})
mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node))
- minetest.sound_play("mesecons_button_push", {pos=pos})
+ minetest.sound_play("mesecons_button_push", { pos = pos }, true)
minetest.get_node_timer(pos):start(1)
end,
sounds = default.node_sound_stone_defaults(),
diff --git a/mesecons_button/mod.conf b/mesecons_button/mod.conf
new file mode 100644
index 0000000..b98afd1
--- /dev/null
+++ b/mesecons_button/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_button
+depends = mesecons, mesecons_receiver
diff --git a/mesecons_button/textures/jeija_wall_button_off.png b/mesecons_button/textures/jeija_wall_button_off.png
index 0e3ff25..d55f7c0 100644
Binary files a/mesecons_button/textures/jeija_wall_button_off.png and b/mesecons_button/textures/jeija_wall_button_off.png differ
diff --git a/mesecons_button/textures/jeija_wall_button_on.png b/mesecons_button/textures/jeija_wall_button_on.png
index 1d97464..2286f53 100644
Binary files a/mesecons_button/textures/jeija_wall_button_on.png and b/mesecons_button/textures/jeija_wall_button_on.png differ
diff --git a/mesecons_button/textures/jeija_wall_button_sides.png b/mesecons_button/textures/jeija_wall_button_sides.png
index 9b79b57..59c7240 100644
Binary files a/mesecons_button/textures/jeija_wall_button_sides.png and b/mesecons_button/textures/jeija_wall_button_sides.png differ
diff --git a/mesecons_commandblock/depends.txt b/mesecons_commandblock/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_commandblock/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_commandblock/doc/commandblock/preview.png b/mesecons_commandblock/doc/commandblock/preview.png
index d89cc7b..50e2cc7 100644
Binary files a/mesecons_commandblock/doc/commandblock/preview.png and b/mesecons_commandblock/doc/commandblock/preview.png differ
diff --git a/mesecons_commandblock/init.lua b/mesecons_commandblock/init.lua
index 326b8ae..f68ac4a 100644
--- a/mesecons_commandblock/init.lua
+++ b/mesecons_commandblock/init.lua
@@ -110,7 +110,7 @@ local function resolve_commands(commands, pos)
local nearest, farthest = nil, nil
local min_distance, max_distance = math.huge, -1
for index, player in pairs(players) do
- local distance = vector.distance(pos, player:getpos())
+ local distance = vector.distance(pos, player:get_pos())
if distance < min_distance then
min_distance = distance
nearest = player:get_player_name()
@@ -174,7 +174,8 @@ end
local function can_dig(pos, player)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
- return owner == "" or owner == player:get_player_name()
+ return owner == "" or owner == player:get_player_name() or
+ minetest.check_player_privs(player, "protection_bypass")
end
minetest.register_node("mesecons_commandblock:commandblock_off", {
diff --git a/mesecons_commandblock/mod.conf b/mesecons_commandblock/mod.conf
new file mode 100644
index 0000000..750a6e7
--- /dev/null
+++ b/mesecons_commandblock/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_commandblock
+depends = mesecons
diff --git a/mesecons_commandblock/textures/jeija_commandblock_off.png b/mesecons_commandblock/textures/jeija_commandblock_off.png
index c05b616..1d989d9 100644
Binary files a/mesecons_commandblock/textures/jeija_commandblock_off.png and b/mesecons_commandblock/textures/jeija_commandblock_off.png differ
diff --git a/mesecons_commandblock/textures/jeija_commandblock_on.png b/mesecons_commandblock/textures/jeija_commandblock_on.png
index 7fc35b6..555f8a3 100644
Binary files a/mesecons_commandblock/textures/jeija_commandblock_on.png and b/mesecons_commandblock/textures/jeija_commandblock_on.png differ
diff --git a/mesecons_delayer/depends.txt b/mesecons_delayer/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_delayer/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_delayer/doc/delayer/preview.png b/mesecons_delayer/doc/delayer/preview.png
index c57c728..d190900 100644
Binary files a/mesecons_delayer/doc/delayer/preview.png and b/mesecons_delayer/doc/delayer/preview.png differ
diff --git a/mesecons_delayer/doc/delayer/recipe.png b/mesecons_delayer/doc/delayer/recipe.png
index ea394aa..3713b39 100644
Binary files a/mesecons_delayer/doc/delayer/recipe.png and b/mesecons_delayer/doc/delayer/recipe.png differ
diff --git a/mesecons_delayer/init.lua b/mesecons_delayer/init.lua
index 94450db..66665ad 100644
--- a/mesecons_delayer/init.lua
+++ b/mesecons_delayer/init.lua
@@ -33,19 +33,9 @@ end
-- Register the 2 (states) x 4 (delay times) delayers
-for i = 1, 4 do
-local groups = {}
-if i == 1 then
- groups = {bendy=2,snappy=1,dig_immediate=2}
-else
- groups = {bendy=2,snappy=1,dig_immediate=2, not_in_creative_inventory=1}
-end
+local delaytime = { 0.1, 0.3, 0.5, 1.0 }
-local delaytime
-if i == 1 then delaytime = 0.1
-elseif i == 2 then delaytime = 0.3
-elseif i == 3 then delaytime = 0.5
-elseif i == 4 then delaytime = 1.0 end
+for i = 1, 4 do
local boxes = {
{ -6/16, -8/16, -6/16, 6/16, -7/16, 6/16 }, -- the main slab
@@ -61,19 +51,9 @@ local boxes = {
{ 6/16, -8/16, -1/16, 8/16, -7/16, 1/16 }
}
-minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
- description = "Delayer",
+-- Delayer definition defaults
+local def = {
drawtype = "nodebox",
- 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"
- },
- inventory_image = "mesecons_delayer_off_1.png",
- wield_image = "mesecons_delayer_off_1.png",
walkable = true,
selection_box = {
type = "fixed",
@@ -83,26 +63,46 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
type = "fixed",
fixed = boxes
},
- groups = groups,
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
is_ground_content = false,
- drop = 'mesecons_delayer:delayer_off_1',
- on_punch = function (pos, node)
- if node.name=="mesecons_delayer:delayer_off_1" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_off_2", param2=node.param2})
- elseif node.name=="mesecons_delayer:delayer_off_2" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_off_3", param2=node.param2})
- elseif node.name=="mesecons_delayer:delayer_off_3" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_off_4", param2=node.param2})
- elseif node.name=="mesecons_delayer:delayer_off_4" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_off_1", param2=node.param2})
- end
- end,
- delayer_time = delaytime,
- delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i),
+ delayer_time = delaytime[i],
sounds = default.node_sound_stone_defaults(),
+ on_blast = mesecon.on_blastnode,
+ drop = "mesecons_delayer:delayer_off_1",
+}
+
+-- Deactivated delayer definition defaults
+local off_groups = {bendy=2,snappy=1,dig_immediate=2}
+if i > 1 then
+ off_groups.not_in_creative_inventory = 1
+end
+
+local off_state = {
+ description = "Delayer",
+ 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"
+ },
+ 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()) then
+ return
+ end
+
+ minetest.swap_node(pos, {
+ name = "mesecons_delayer:delayer_off_"..tostring(i % 4 + 1),
+ param2 = node.param2
+ })
+ end,
+ delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i),
mesecons = {
receptor =
{
@@ -115,13 +115,15 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
action_on = delayer_activate
}
},
- on_blast = mesecon.on_blastnode,
-})
+}
+for k, v in pairs(def) do
+ off_state[k] = off_state[k] or v
+end
+minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), off_state)
-
-minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
+-- Activated delayer definition defaults
+local on_state = {
description = "You hacker you",
- drawtype = "nodebox",
tiles = {
"mesecons_delayer_on_"..tostring(i)..".png",
"mesecons_delayer_bottom.png",
@@ -129,36 +131,19 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
"mesecons_delayer_ends_on.png",
"mesecons_delayer_sides_on.png",
"mesecons_delayer_sides_on.png"
- },
- walkable = true,
- selection_box = {
- type = "fixed",
- fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
- },
- node_box = {
- type = "fixed",
- fixed = boxes
},
groups = {bendy = 2, snappy = 1, dig_immediate = 2, not_in_creative_inventory = 1},
- paramtype = "light",
- paramtype2 = "facedir",
- sunlight_propagates = true,
- is_ground_content = false,
- drop = 'mesecons_delayer:delayer_off_1',
- on_punch = function (pos, node)
- if node.name=="mesecons_delayer:delayer_on_1" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_on_2", param2=node.param2})
- elseif node.name=="mesecons_delayer:delayer_on_2" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_on_3", param2=node.param2})
- elseif node.name=="mesecons_delayer:delayer_on_3" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_on_4", param2=node.param2})
- elseif node.name=="mesecons_delayer:delayer_on_4" then
- minetest.swap_node(pos, {name = "mesecons_delayer:delayer_on_1", param2=node.param2})
+ on_punch = function(pos, node, puncher)
+ if minetest.is_protected(pos, puncher and puncher:get_player_name()) then
+ return
end
+
+ minetest.swap_node(pos, {
+ name = "mesecons_delayer:delayer_on_"..tostring(i % 4 + 1),
+ param2 = node.param2
+ })
end,
- delayer_time = delaytime,
delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i),
- sounds = default.node_sound_stone_defaults(),
mesecons = {
receptor =
{
@@ -171,8 +156,12 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
action_off = delayer_deactivate
}
},
- on_blast = mesecon.on_blastnode,
-})
+}
+for k, v in pairs(def) do
+ on_state[k] = on_state[k] or v
+end
+minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), on_state)
+
end
minetest.register_craft({
diff --git a/mesecons_delayer/mod.conf b/mesecons_delayer/mod.conf
new file mode 100644
index 0000000..b9b96d0
--- /dev/null
+++ b/mesecons_delayer/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_delayer
+depends = mesecons
diff --git a/mesecons_delayer/textures/mesecons_delayer_bottom.png b/mesecons_delayer/textures/mesecons_delayer_bottom.png
index 2e49d31..2307b39 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_bottom.png and b/mesecons_delayer/textures/mesecons_delayer_bottom.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_ends_off.png b/mesecons_delayer/textures/mesecons_delayer_ends_off.png
index 0242deb..9cbeb39 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_ends_off.png and b/mesecons_delayer/textures/mesecons_delayer_ends_off.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_ends_on.png b/mesecons_delayer/textures/mesecons_delayer_ends_on.png
index 19ae0cb..446ef48 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_ends_on.png and b/mesecons_delayer/textures/mesecons_delayer_ends_on.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_off_1.png b/mesecons_delayer/textures/mesecons_delayer_off_1.png
index 7372b37..20d9efc 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_off_1.png and b/mesecons_delayer/textures/mesecons_delayer_off_1.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_off_2.png b/mesecons_delayer/textures/mesecons_delayer_off_2.png
index e34f0ac..590d62f 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_off_2.png and b/mesecons_delayer/textures/mesecons_delayer_off_2.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_off_3.png b/mesecons_delayer/textures/mesecons_delayer_off_3.png
index 091adbc..57ac4c4 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_off_3.png and b/mesecons_delayer/textures/mesecons_delayer_off_3.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_off_4.png b/mesecons_delayer/textures/mesecons_delayer_off_4.png
index 7ecc9b6..94fc00c 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_off_4.png and b/mesecons_delayer/textures/mesecons_delayer_off_4.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_on_1.png b/mesecons_delayer/textures/mesecons_delayer_on_1.png
index 61f52f2..9369a4e 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_on_1.png and b/mesecons_delayer/textures/mesecons_delayer_on_1.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_on_2.png b/mesecons_delayer/textures/mesecons_delayer_on_2.png
index 7bd363f..7984ef4 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_on_2.png and b/mesecons_delayer/textures/mesecons_delayer_on_2.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_on_3.png b/mesecons_delayer/textures/mesecons_delayer_on_3.png
index b93f725..1799cad 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_on_3.png and b/mesecons_delayer/textures/mesecons_delayer_on_3.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_on_4.png b/mesecons_delayer/textures/mesecons_delayer_on_4.png
index ca90a1e..0386112 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_on_4.png and b/mesecons_delayer/textures/mesecons_delayer_on_4.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_sides_off.png b/mesecons_delayer/textures/mesecons_delayer_sides_off.png
index 79f3d59..2c60cbb 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_sides_off.png and b/mesecons_delayer/textures/mesecons_delayer_sides_off.png differ
diff --git a/mesecons_delayer/textures/mesecons_delayer_sides_on.png b/mesecons_delayer/textures/mesecons_delayer_sides_on.png
index 1c8edaa..4927557 100644
Binary files a/mesecons_delayer/textures/mesecons_delayer_sides_on.png and b/mesecons_delayer/textures/mesecons_delayer_sides_on.png differ
diff --git a/mesecons_detector/depends.txt b/mesecons_detector/depends.txt
deleted file mode 100644
index bc7b062..0000000
--- a/mesecons_detector/depends.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-mesecons
-mesecons_materials
diff --git a/mesecons_detector/doc/nodedetector/description.html b/mesecons_detector/doc/nodedetector/description.html
index ee8c09d..4c62359 100644
--- a/mesecons_detector/doc/nodedetector/description.html
+++ b/mesecons_detector/doc/nodedetector/description.html
@@ -1,8 +1,11 @@
The node detector is a receptor. It changes its state when either any node
or a specific node is detected. Right-click it to set a nodename to scan for.
-It can also receive digiline signals. You can either send "GET" and it will
-respond with the detected nodename or you can send any other string and it will
-set this string as the node to scan for.
+It can also receive digiline signals. For example, you can send
+{distance=4, scanname="default:dirt"}
+to set distance to 4 and scan for dirt. You can omit either parameter.
+There is also a command parameter: {command="get"}
will respond
+with the detected nodename and {command="scan"}
will respond with
+a boolean using the distance and nodename of the detector.
Nodenames must include the mod they reside in, so for instance default:dirt, not just dirt.
The distance parameter specifies how many blocks are between the node detector and the node to detect.
Automatic scanning with Mesecons output only works when the detector is in an active block, but Digilines queries always work.
diff --git a/mesecons_detector/doc/nodedetector/preview.png b/mesecons_detector/doc/nodedetector/preview.png
index 1f78161..759a9fa 100644
Binary files a/mesecons_detector/doc/nodedetector/preview.png and b/mesecons_detector/doc/nodedetector/preview.png differ
diff --git a/mesecons_detector/doc/nodedetector/recipe.png b/mesecons_detector/doc/nodedetector/recipe.png
index 958c7e6..13ab570 100644
Binary files a/mesecons_detector/doc/nodedetector/recipe.png and b/mesecons_detector/doc/nodedetector/recipe.png differ
diff --git a/mesecons_detector/doc/objectdetector/preview.png b/mesecons_detector/doc/objectdetector/preview.png
index 85c4dea..edee110 100644
Binary files a/mesecons_detector/doc/objectdetector/preview.png and b/mesecons_detector/doc/objectdetector/preview.png differ
diff --git a/mesecons_detector/doc/objectdetector/recipe.png b/mesecons_detector/doc/objectdetector/recipe.png
index a1cee00..0081b36 100644
Binary files a/mesecons_detector/doc/objectdetector/recipe.png and b/mesecons_detector/doc/objectdetector/recipe.png differ
diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua
index fc7d4c3..1234378 100644
--- a/mesecons_detector/init.lua
+++ b/mesecons_detector/init.lua
@@ -189,28 +189,49 @@ local function node_detector_scan(pos)
(frontname ~= "air" and frontname ~= "ignore" and scanname == "")
end
+local function node_detector_send_node_name(pos, node, channel, meta)
+ local distance = meta:get_int("distance")
+ local distance_max = mesecon.setting("node_detector_distance_max", 10)
+ if distance < 0 then distance = 0 end
+ if distance > distance_max then distance = distance_max end
+ local nodename = minetest.get_node(
+ vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance + 1))
+ ).name
+
+ digiline:receptor_send(pos, digiline.rules.default, channel, nodename)
+end
+
-- set player name when receiving a digiline signal on a specific channel
local node_detector_digiline = {
effector = {
action = function(pos, node, channel, msg)
local meta = minetest.get_meta(pos)
- local distance = meta:get_int("distance")
- local distance_max = mesecon.setting("node_detector_distance_max", 10)
- if distance < 0 then distance = 0 end
- if distance > distance_max then distance = distance_max end
-
if channel ~= meta:get_string("digiline_channel") then return end
- if msg == GET_COMMAND then
- local nodename = minetest.get_node(
- vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), distance + 1))
- ).name
-
- digiline:receptor_send(pos, digiline.rules.default, channel, nodename)
+ if type(msg) == "table" then
+ if msg.distance or msg.scanname then
+ if msg.distance then
+ meta:set_string("distance", msg.distance)
+ end
+ if msg.scanname then
+ meta:set_string("scanname", msg.scanname)
+ end
+ node_detector_make_formspec(pos)
+ end
+ if msg.command == "get" then
+ node_detector_send_node_name(pos, node, channel, meta)
+ elseif msg.command == "scan" then
+ local result = node_detector_scan(pos)
+ digiline:receptor_send(pos, digiline.rules.default, channel, result)
+ end
else
- meta:set_string("scanname", msg)
- node_detector_make_formspec(pos)
+ if msg == GET_COMMAND then
+ node_detector_send_node_name(pos, node, channel, meta)
+ else
+ meta:set_string("scanname", msg)
+ node_detector_make_formspec(pos)
+ end
end
end,
},
@@ -218,7 +239,7 @@ local node_detector_digiline = {
}
local function after_place_node_detector(pos, placer)
- local placer_pos = placer:getpos()
+ local placer_pos = placer:get_pos()
if not placer_pos then
return
end
diff --git a/mesecons_detector/mod.conf b/mesecons_detector/mod.conf
new file mode 100644
index 0000000..75456b3
--- /dev/null
+++ b/mesecons_detector/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_detector
+depends = mesecons, mesecons_materials
diff --git a/mesecons_detector/textures/jeija_node_detector_off.png b/mesecons_detector/textures/jeija_node_detector_off.png
index 6d130ad..bfd7b21 100644
Binary files a/mesecons_detector/textures/jeija_node_detector_off.png and b/mesecons_detector/textures/jeija_node_detector_off.png differ
diff --git a/mesecons_detector/textures/jeija_node_detector_on.png b/mesecons_detector/textures/jeija_node_detector_on.png
index 926a9d1..69305ea 100644
Binary files a/mesecons_detector/textures/jeija_node_detector_on.png and b/mesecons_detector/textures/jeija_node_detector_on.png differ
diff --git a/mesecons_detector/textures/jeija_object_detector_off.png b/mesecons_detector/textures/jeija_object_detector_off.png
index 825d78f..104a12b 100644
Binary files a/mesecons_detector/textures/jeija_object_detector_off.png and b/mesecons_detector/textures/jeija_object_detector_off.png differ
diff --git a/mesecons_detector/textures/jeija_object_detector_on.png b/mesecons_detector/textures/jeija_object_detector_on.png
index 96f8ba3..ccbdccb 100644
Binary files a/mesecons_detector/textures/jeija_object_detector_on.png and b/mesecons_detector/textures/jeija_object_detector_on.png differ
diff --git a/mesecons_doors/depends.txt b/mesecons_doors/depends.txt
deleted file mode 100644
index ed2fcd8..0000000
--- a/mesecons_doors/depends.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-mesecons
-doors
diff --git a/mesecons_doors/init.lua b/mesecons_doors/init.lua
index 52d6c17..cf6faeb 100644
--- a/mesecons_doors/init.lua
+++ b/mesecons_doors/init.lua
@@ -13,9 +13,9 @@ local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
minetest.swap_node(pos, {name = replace, param2 = p2})
if (minetest.get_meta(pos):get_int("right") ~= 0) == (params[1] ~= 3) then
- minetest.sound_play("doors_door_close", {pos = pos, gain = 0.3, max_hear_distance = 10})
+ minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
else
- minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
+ minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
end
end
@@ -79,10 +79,10 @@ local function trapdoor_switch(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})
+ 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})
else
- minetest.sound_play("doors_door_open", {pos = pos, gain = 0.3, max_hear_distance = 10})
+ 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})
end
diff --git a/mesecons_doors/mod.conf b/mesecons_doors/mod.conf
new file mode 100644
index 0000000..da12b38
--- /dev/null
+++ b/mesecons_doors/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_doors
+depends = mesecons, doors
diff --git a/mesecons_extrawires/corner.lua b/mesecons_extrawires/corner.lua
index d33447a..b25c2a2 100644
--- a/mesecons_extrawires/corner.lua
+++ b/mesecons_extrawires/corner.lua
@@ -1,12 +1,5 @@
local screwdriver_exists = minetest.global_exists("screwdriver")
-local corner_nodebox = {
- type = "fixed",
- -- ±0.001 is to prevent z-fighting
- fixed = {{ -16/32-0.001, -17/32, -3/32, 0, -13/32, 3/32 },
- { -3/32, -17/32, -16/32+0.001, 3/32, -13/32, 3/32}}
-}
-
local corner_selectionbox = {
type = "fixed",
fixed = { -16/32, -16/32, -16/32, 5/32, -12/32, 5/32 },
@@ -25,14 +18,11 @@ local corner_get_rules = function (node)
end
minetest.register_node("mesecons_extrawires:corner_on", {
- drawtype = "nodebox",
+ drawtype = "mesh",
+ mesh = "mesecons_extrawires_corner.obj",
tiles = {
- "jeija_insulated_wire_curved_tb_on.png",
- "jeija_insulated_wire_curved_tb_on.png^[transformR270",
- "jeija_insulated_wire_sides_on.png",
- "jeija_insulated_wire_ends_on.png",
- "jeija_insulated_wire_sides_on.png",
- "jeija_insulated_wire_ends_on.png"
+ { name = "jeija_insulated_wire_sides_on.png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_on.png", backface_culling = true },
},
paramtype = "light",
paramtype2 = "facedir",
@@ -55,15 +45,12 @@ minetest.register_node("mesecons_extrawires:corner_on", {
})
minetest.register_node("mesecons_extrawires:corner_off", {
- drawtype = "nodebox",
+ drawtype = "mesh",
description = "Insulated Mesecon Corner",
+ mesh = "mesecons_extrawires_corner.obj",
tiles = {
- "jeija_insulated_wire_curved_tb_off.png",
- "jeija_insulated_wire_curved_tb_off.png^[transformR270",
- "jeija_insulated_wire_sides_off.png",
- "jeija_insulated_wire_ends_off.png",
- "jeija_insulated_wire_sides_off.png",
- "jeija_insulated_wire_ends_off.png"
+ { name = "jeija_insulated_wire_sides_off.png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_off.png", backface_culling = true },
},
paramtype = "light",
paramtype2 = "facedir",
@@ -87,8 +74,7 @@ minetest.register_node("mesecons_extrawires:corner_off", {
minetest.register_craft({
output = "mesecons_extrawires:corner_off 3",
recipe = {
- {"", "", ""},
- {"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off", ""},
- {"", "mesecons_insulated:insulated_off", ""},
+ {"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off"},
+ {"", "mesecons_insulated:insulated_off"},
}
})
diff --git a/mesecons_extrawires/depends.txt b/mesecons_extrawires/depends.txt
deleted file mode 100644
index 369aeb7..0000000
--- a/mesecons_extrawires/depends.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-default
-mesecons
-screwdriver?
diff --git a/mesecons_extrawires/doc/corner/preview.png b/mesecons_extrawires/doc/corner/preview.png
index 9713229..7fbb0dc 100644
Binary files a/mesecons_extrawires/doc/corner/preview.png and b/mesecons_extrawires/doc/corner/preview.png differ
diff --git a/mesecons_extrawires/doc/corner/recipe.png b/mesecons_extrawires/doc/corner/recipe.png
index ac85b01..ce6e86e 100644
Binary files a/mesecons_extrawires/doc/corner/recipe.png and b/mesecons_extrawires/doc/corner/recipe.png differ
diff --git a/mesecons_extrawires/doc/crossing/preview.png b/mesecons_extrawires/doc/crossing/preview.png
index 66aaa05..b5466a5 100644
Binary files a/mesecons_extrawires/doc/crossing/preview.png and b/mesecons_extrawires/doc/crossing/preview.png differ
diff --git a/mesecons_extrawires/doc/crossing/recipe.png b/mesecons_extrawires/doc/crossing/recipe.png
index ac37401..6beac96 100644
Binary files a/mesecons_extrawires/doc/crossing/recipe.png and b/mesecons_extrawires/doc/crossing/recipe.png differ
diff --git a/mesecons_extrawires/doc/mese/preview.png b/mesecons_extrawires/doc/mese/preview.png
index 3ce0ea4..ed1a162 100644
Binary files a/mesecons_extrawires/doc/mese/preview.png and b/mesecons_extrawires/doc/mese/preview.png differ
diff --git a/mesecons_extrawires/doc/mese/recipe.png b/mesecons_extrawires/doc/mese/recipe.png
index 904cf0b..e4bb08c 100644
Binary files a/mesecons_extrawires/doc/mese/recipe.png and b/mesecons_extrawires/doc/mese/recipe.png differ
diff --git a/mesecons_extrawires/doc/tjunction/preview.png b/mesecons_extrawires/doc/tjunction/preview.png
index 4dec841..8407d15 100644
Binary files a/mesecons_extrawires/doc/tjunction/preview.png and b/mesecons_extrawires/doc/tjunction/preview.png differ
diff --git a/mesecons_extrawires/doc/tjunction/recipe.png b/mesecons_extrawires/doc/tjunction/recipe.png
index 8602941..7358d91 100644
Binary files a/mesecons_extrawires/doc/tjunction/recipe.png and b/mesecons_extrawires/doc/tjunction/recipe.png differ
diff --git a/mesecons_extrawires/doc/vertical/preview.png b/mesecons_extrawires/doc/vertical/preview.png
index aad6ea8..eea5571 100644
Binary files a/mesecons_extrawires/doc/vertical/preview.png and b/mesecons_extrawires/doc/vertical/preview.png differ
diff --git a/mesecons_extrawires/doc/vertical/recipe.png b/mesecons_extrawires/doc/vertical/recipe.png
index 83bc498..b12ccde 100644
Binary files a/mesecons_extrawires/doc/vertical/recipe.png and b/mesecons_extrawires/doc/vertical/recipe.png differ
diff --git a/mesecons_extrawires/doublecorner.lua b/mesecons_extrawires/doublecorner.lua
new file mode 100644
index 0000000..d94e792
--- /dev/null
+++ b/mesecons_extrawires/doublecorner.lua
@@ -0,0 +1,91 @@
+local rotate
+if minetest.global_exists("screwdriver") then rotate = screwdriver.rotate_simple end
+
+local doublecorner_selectionbox = {
+ type = "fixed",
+ fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
+}
+
+local rules = {
+ {
+ { x = 1, y = 0, z = 0 },
+ { x = 0, y = 0, z = 1 },
+ },
+ {
+ { x = -1, y = 0, z = 0 },
+ { x = 0, y = 0, z = -1 },
+ },
+}
+
+local doublecorner_rules = {}
+for k = 1, 4 do
+ doublecorner_rules[k] = table.copy(rules)
+ for i, r in ipairs(rules) do
+ rules[i] = mesecon.rotate_rules_left(r)
+ end
+end
+
+local function doublecorner_get_rules(node)
+ return doublecorner_rules[node.param2 % 4 + 1]
+end
+
+local doublecorner_states = {
+ "mesecons_extrawires:doublecorner_00",
+ "mesecons_extrawires:doublecorner_01",
+ "mesecons_extrawires:doublecorner_10",
+ "mesecons_extrawires:doublecorner_11",
+}
+local wire1_states = { "off", "off", "on", "on" }
+local wire2_states = { "off", "on", "off", "on" }
+
+for k, state in ipairs(doublecorner_states) do
+ local w1 = wire1_states[k]
+ local w2 = wire2_states[k]
+ local groups = { dig_immediate = 3 }
+ if k ~= 1 then groups.not_in_creative_inventory = 1 end
+ minetest.register_node(state, {
+ drawtype = "mesh",
+ mesh = "mesecons_extrawires_doublecorner.obj",
+ description = "Insulated Mesecon Double Corner",
+ tiles = {
+ { name = "jeija_insulated_wire_sides_" .. w1 .. ".png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_" .. w1 .. ".png", backface_culling = true },
+ { name = "jeija_insulated_wire_sides_" .. w2 .. ".png", backface_culling = true },
+ { name = "jeija_insulated_wire_ends_" .. w2 .. ".png", backface_culling = true },
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ is_ground_content = false,
+ walkable = false,
+ sunlight_propagates = true,
+ selection_box = doublecorner_selectionbox,
+ groups = groups,
+ drop = doublecorner_states[1],
+ sounds = default.node_sound_defaults(),
+ mesecons = {
+ conductor = {
+ states = doublecorner_states,
+ rules = doublecorner_get_rules,
+ },
+ },
+ on_blast = mesecon.on_blastnode,
+ on_rotate = rotate,
+ })
+end
+
+minetest.register_craft({
+ type = "shapeless",
+ output = "mesecons_extrawires:doublecorner_00",
+ recipe = {
+ "mesecons_extrawires:corner_off",
+ "mesecons_extrawires:corner_off",
+ },
+})
+
+minetest.register_craft({
+ type = "shapeless",
+ output = "mesecons_extrawires:corner_off 2",
+ recipe = {
+ "mesecons_extrawires:doublecorner_00",
+ },
+})
diff --git a/mesecons_extrawires/init.lua b/mesecons_extrawires/init.lua
index b22f2e5..02dc1a6 100644
--- a/mesecons_extrawires/init.lua
+++ b/mesecons_extrawires/init.lua
@@ -1,5 +1,6 @@
dofile(minetest.get_modpath("mesecons_extrawires").."/crossover.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/tjunction.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/corner.lua");
+dofile(minetest.get_modpath("mesecons_extrawires").."/doublecorner.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/vertical.lua");
dofile(minetest.get_modpath("mesecons_extrawires").."/mesewire.lua");
diff --git a/mesecons_extrawires/mod.conf b/mesecons_extrawires/mod.conf
new file mode 100644
index 0000000..5632d87
--- /dev/null
+++ b/mesecons_extrawires/mod.conf
@@ -0,0 +1,3 @@
+name = mesecons_extrawires
+depends = default, mesecons
+optional_depends = screwdriver
diff --git a/mesecons_extrawires/models/mesecons_extrawires_corner.obj b/mesecons_extrawires/models/mesecons_extrawires_corner.obj
new file mode 100644
index 0000000..c7b6b16
--- /dev/null
+++ b/mesecons_extrawires/models/mesecons_extrawires_corner.obj
@@ -0,0 +1,125 @@
+# Вершины
+# Провод 1
+# 1 (ниж. внутр.)
+v 0.093750 -0.531250 -0.501000
+v 0.093750 -0.531250 -0.331726
+v 0.331726 -0.531250 -0.093750
+v 0.501000 -0.531250 -0.093750
+# 5 (ниж. наруж.)
+v -0.093750 -0.531250 -0.501000
+v -0.093750 -0.531250 -0.254061
+v 0.254061 -0.531250 0.093750
+v 0.501000 -0.531250 0.093750
+# 9 (верх. внутр.)
+v 0.093750 -0.406250 -0.501000
+v 0.093750 -0.406250 -0.331726
+v 0.331726 -0.406250 -0.093750
+v 0.501000 -0.406250 -0.093750
+# 13 (верх. наруж.)
+v -0.093750 -0.406250 -0.501000
+v -0.093750 -0.406250 -0.254061
+v 0.254061 -0.406250 0.093750
+v 0.501000 -0.406250 0.093750
+# Текстурные координаты
+# 1 (ниж.)
+vt 0.000000 0.406250
+vt 0.168274 0.406250
+vt 0.331726 0.406250
+vt 0.668274 0.406250
+vt 0.831726 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.245939 0.593750
+vt 0.254061 0.593750
+vt 0.745939 0.593750
+vt 0.754061 0.593750
+vt 1.000000 0.593750
+# 13 (верх.)
+vt 0.000000 0.406250
+vt 0.245939 0.406250
+vt 0.254061 0.406250
+vt 0.745939 0.406250
+vt 0.754061 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.168274 0.593750
+vt 0.331726 0.593750
+vt 0.668274 0.593750
+vt 0.831726 0.593750
+vt 1.000000 0.593750
+# 25 (внутр.)
+vt 1.000000 0.093750
+vt 0.831726 0.093750
+vt 0.668274 0.093750
+vt 0.331726 0.093750
+vt 0.168274 0.093750
+vt 0.000000 0.093750
+vt 1.000000 -0.031250
+vt 0.831726 -0.031250
+vt 0.668274 -0.031250
+vt 0.331726 -0.031250
+vt 0.168274 -0.031250
+vt 0.000000 -0.031250
+# 37 (внеш.)
+vt 0.000000 -0.031250
+vt 0.245939 -0.031250
+vt 0.254061 -0.031250
+vt 0.745939 -0.031250
+vt 0.754061 -0.031250
+vt 1.000000 -0.031250
+vt 0.000000 0.093750
+vt 0.245939 0.093750
+vt 0.254061 0.093750
+vt 0.745939 0.093750
+vt 0.754061 0.093750
+vt 1.000000 0.093750
+# 49 (торец)
+vt 0.406250 -0.031250
+vt 0.406250 0.093750
+vt 0.593750 -0.031250
+vt 0.593750 0.093750
+# Нормали
+# 1
+vn 1.000000 0.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.707107 0.000000 0.707107
+# 5
+vn -1.000000 0.000000 0.000000
+vn 0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.707107 0.000000 -0.707107
+# Грани
+g Sides1
+# Часть 1
+f 5/37/1 6/38/1 14/44/1
+f 5/37/1 14/44/1 13/43/1
+f 13/13/2 14/14/2 10/20/2
+f 13/13/2 10/20/2 9/19/2
+f 9/25/5 10/26/5 2/32/5
+f 9/25/5 2/32/5 1/31/5
+f 1/1/6 2/2/6 6/8/6
+f 1/1/6 6/8/6 5/7/6
+# Часть 2
+f 6/39/4 7/40/4 15/46/4
+f 6/39/4 15/46/4 14/45/4
+f 14/15/2 15/16/2 11/22/2
+f 14/15/2 11/22/2 10/21/2
+f 10/27/8 11/28/8 3/34/8
+f 10/27/8 3/34/8 2/33/8
+f 2/3/6 3/4/6 7/10/6
+f 2/3/6 7/10/6 6/9/6
+# Часть 3
+f 7/41/3 8/42/3 16/48/3
+f 7/41/3 16/48/3 15/47/3
+f 15/17/2 16/18/2 12/24/2
+f 15/17/2 12/24/2 11/23/2
+f 11/29/7 12/30/7 4/36/7
+f 11/29/7 4/36/7 3/35/7
+f 3/5/6 4/6/6 8/12/6
+f 3/5/6 8/12/6 7/11/6
+g Ends1
+f 1/49/3 5/51/3 13/52/3
+f 1/49/3 13/52/3 9/50/3
+f 4/49/1 12/50/1 16/52/1
+f 4/49/1 16/52/1 8/51/1
diff --git a/mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj b/mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj
new file mode 100644
index 0000000..a74aa01
--- /dev/null
+++ b/mesecons_extrawires/models/mesecons_extrawires_doublecorner.obj
@@ -0,0 +1,180 @@
+# Вершины
+# Провод 1
+# 1 (ниж. внутр.)
+v 0.093750 -0.531250 -0.501000
+v 0.093750 -0.531250 -0.331726
+v 0.331726 -0.531250 -0.093750
+v 0.501000 -0.531250 -0.093750
+# 5 (ниж. наруж.)
+v -0.093750 -0.531250 -0.501000
+v -0.093750 -0.531250 -0.254061
+v 0.254061 -0.531250 0.093750
+v 0.501000 -0.531250 0.093750
+# 9 (верх. внутр.)
+v 0.093750 -0.406250 -0.501000
+v 0.093750 -0.406250 -0.331726
+v 0.331726 -0.406250 -0.093750
+v 0.501000 -0.406250 -0.093750
+# 13 (верх. наруж.)
+v -0.093750 -0.406250 -0.501000
+v -0.093750 -0.406250 -0.254061
+v 0.254061 -0.406250 0.093750
+v 0.501000 -0.406250 0.093750
+# Провод 2
+# 17 (ниж. внутр.)
+v -0.093750 -0.531250 0.501000
+v -0.093750 -0.531250 0.331726
+v -0.331726 -0.531250 0.093750
+v -0.501000 -0.531250 0.093750
+# 21 (ниж. наруж.)
+v 0.093750 -0.531250 0.501000
+v 0.093750 -0.531250 0.254061
+v -0.254061 -0.531250 -0.093750
+v -0.501000 -0.531250 -0.093750
+# 25 (верх. внутр.)
+v -0.093750 -0.406250 0.501000
+v -0.093750 -0.406250 0.331726
+v -0.331726 -0.406250 0.093750
+v -0.501000 -0.406250 0.093750
+# 29 (верх. наруж.)
+v 0.093750 -0.406250 0.501000
+v 0.093750 -0.406250 0.254061
+v -0.254061 -0.406250 -0.093750
+v -0.501000 -0.406250 -0.093750
+# Текстурные координаты
+# 1 (ниж.)
+vt 0.000000 0.406250
+vt 0.168274 0.406250
+vt 0.331726 0.406250
+vt 0.668274 0.406250
+vt 0.831726 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.245939 0.593750
+vt 0.254061 0.593750
+vt 0.745939 0.593750
+vt 0.754061 0.593750
+vt 1.000000 0.593750
+# 13 (верх.)
+vt 0.000000 0.406250
+vt 0.245939 0.406250
+vt 0.254061 0.406250
+vt 0.745939 0.406250
+vt 0.754061 0.406250
+vt 1.000000 0.406250
+vt 0.000000 0.593750
+vt 0.168274 0.593750
+vt 0.331726 0.593750
+vt 0.668274 0.593750
+vt 0.831726 0.593750
+vt 1.000000 0.593750
+# 25 (внутр.)
+vt 1.000000 0.093750
+vt 0.831726 0.093750
+vt 0.668274 0.093750
+vt 0.331726 0.093750
+vt 0.168274 0.093750
+vt 0.000000 0.093750
+vt 1.000000 -0.031250
+vt 0.831726 -0.031250
+vt 0.668274 -0.031250
+vt 0.331726 -0.031250
+vt 0.168274 -0.031250
+vt 0.000000 -0.031250
+# 37 (внеш.)
+vt 0.000000 -0.031250
+vt 0.245939 -0.031250
+vt 0.254061 -0.031250
+vt 0.745939 -0.031250
+vt 0.754061 -0.031250
+vt 1.000000 -0.031250
+vt 0.000000 0.093750
+vt 0.245939 0.093750
+vt 0.254061 0.093750
+vt 0.745939 0.093750
+vt 0.754061 0.093750
+vt 1.000000 0.093750
+# 49 (торец)
+vt 0.406250 -0.031250
+vt 0.406250 0.093750
+vt 0.593750 -0.031250
+vt 0.593750 0.093750
+# Нормали
+# 1
+vn 1.000000 0.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 1.000000
+vn 0.707107 0.000000 0.707107
+# 5
+vn -1.000000 0.000000 0.000000
+vn 0.000000 -1.000000 0.000000
+vn 0.000000 0.000000 -1.000000
+vn -0.707107 0.000000 -0.707107
+# Грани
+# Грани
+g Sides1
+# Часть 1
+f 5/37/1 6/38/1 14/44/1
+f 5/37/1 14/44/1 13/43/1
+f 13/13/2 14/14/2 10/20/2
+f 13/13/2 10/20/2 9/19/2
+f 9/25/5 10/26/5 2/32/5
+f 9/25/5 2/32/5 1/31/5
+f 1/1/6 2/2/6 6/8/6
+f 1/1/6 6/8/6 5/7/6
+# Часть 2
+f 6/39/4 7/40/4 15/46/4
+f 6/39/4 15/46/4 14/45/4
+f 14/15/2 15/16/2 11/22/2
+f 14/15/2 11/22/2 10/21/2
+f 10/27/8 11/28/8 3/34/8
+f 10/27/8 3/34/8 2/33/8
+f 2/3/6 3/4/6 7/10/6
+f 2/3/6 7/10/6 6/9/6
+# Часть 3
+f 7/41/3 8/42/3 16/48/3
+f 7/41/3 16/48/3 15/47/3
+f 15/17/2 16/18/2 12/24/2
+f 15/17/2 12/24/2 11/23/2
+f 11/29/7 12/30/7 4/36/7
+f 11/29/7 4/36/7 3/35/7
+f 3/5/6 4/6/6 8/12/6
+f 3/5/6 8/12/6 7/11/6
+g Ends1
+f 1/49/3 5/51/3 13/52/3
+f 1/49/3 13/52/3 9/50/3
+f 4/49/1 12/50/1 16/52/1
+f 4/49/1 16/52/1 8/51/1
+g Sides2
+# Часть 1
+f 21/37/1 22/38/1 30/44/1
+f 21/37/1 30/44/1 29/43/1
+f 29/13/2 30/14/2 26/20/2
+f 29/13/2 26/20/2 25/19/2
+f 25/25/5 26/26/5 18/32/5
+f 25/25/5 18/32/5 17/31/5
+f 17/1/6 18/2/6 22/8/6
+f 17/1/6 22/8/6 21/7/6
+# Часть 2
+f 22/39/4 23/40/4 31/46/4
+f 22/39/4 31/46/4 30/45/4
+f 30/15/2 31/16/2 27/22/2
+f 30/15/2 27/22/2 26/21/2
+f 26/27/8 27/28/8 19/34/8
+f 26/27/8 19/34/8 18/33/8
+f 18/3/6 19/4/6 23/10/6
+f 18/3/6 23/10/6 22/9/6
+# Часть 3
+f 23/41/3 24/42/3 32/48/3
+f 23/41/3 32/48/3 31/47/3
+f 31/17/2 32/18/2 28/24/2
+f 31/17/2 28/24/2 27/23/2
+f 27/29/7 28/30/7 20/36/7
+f 27/29/7 20/36/7 19/35/7
+f 19/5/6 20/6/6 24/12/6
+f 19/5/6 24/12/6 23/11/6
+g Ends2
+f 17/49/3 21/51/3 29/52/3
+f 17/49/3 29/52/3 25/50/3
+f 20/49/1 28/50/1 32/52/1
+f 20/49/1 32/52/1 24/51/1
diff --git a/mesecons_extrawires/tjunction.lua b/mesecons_extrawires/tjunction.lua
index 77c4290..8744a03 100644
--- a/mesecons_extrawires/tjunction.lua
+++ b/mesecons_extrawires/tjunction.lua
@@ -88,7 +88,6 @@ minetest.register_node("mesecons_extrawires:tjunction_off", {
minetest.register_craft({
output = "mesecons_extrawires:tjunction_off 3",
recipe = {
- {"", "", ""},
{"mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off", "mesecons_insulated:insulated_off"},
{"", "mesecons_insulated:insulated_off", ""},
}
diff --git a/mesecons_fpga/depends.txt b/mesecons_fpga/depends.txt
deleted file mode 100644
index a0ba1ef..0000000
--- a/mesecons_fpga/depends.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-mesecons
-screwdriver?
diff --git a/mesecons_fpga/doc/fpga/preview.png b/mesecons_fpga/doc/fpga/preview.png
index c156321..b4a2994 100644
Binary files a/mesecons_fpga/doc/fpga/preview.png and b/mesecons_fpga/doc/fpga/preview.png differ
diff --git a/mesecons_fpga/doc/fpga/recipe.png b/mesecons_fpga/doc/fpga/recipe.png
index 1140bfa..edb14f4 100644
Binary files a/mesecons_fpga/doc/fpga/recipe.png and b/mesecons_fpga/doc/fpga/recipe.png differ
diff --git a/mesecons_fpga/doc/programmer/preview.png b/mesecons_fpga/doc/programmer/preview.png
index 7437d39..b1bae7a 100644
Binary files a/mesecons_fpga/doc/programmer/preview.png and b/mesecons_fpga/doc/programmer/preview.png differ
diff --git a/mesecons_fpga/doc/programmer/recipe.png b/mesecons_fpga/doc/programmer/recipe.png
index 778ec5f..a7c691b 100644
Binary files a/mesecons_fpga/doc/programmer/recipe.png and b/mesecons_fpga/doc/programmer/recipe.png differ
diff --git a/mesecons_fpga/init.lua b/mesecons_fpga/init.lua
index 941b61a..6ba8f80 100644
--- a/mesecons_fpga/init.lua
+++ b/mesecons_fpga/init.lua
@@ -1,10 +1,11 @@
local plg = {}
plg.rules = {}
+-- per-player formspec positions
+plg.open_formspecs = {}
local lcore = dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/logic.lua")
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/tool.lua")(plg)
-
plg.register_nodes = function(template)
-- each loop is for one of the 4 IO ports
for a = 0, 1 do
@@ -93,16 +94,20 @@ plg.register_nodes({
meta:set_string("instr", lcore.serialize(is))
meta:set_int("valid", 0)
- meta:set_string("formspec", plg.to_formspec_string(is))
meta:set_string("infotext", "FPGA")
end,
- on_receive_fields = function(pos, formname, fields, sender)
- if fields.program == nil then return end -- we only care when the user clicks "Program"
+ on_rightclick = function(pos, node, clicker)
+ if not minetest.is_player(clicker) then
+ return
+ end
local meta = minetest.get_meta(pos)
- local is = plg.from_formspec_fields(fields)
+ local name = clicker:get_player_name()
+ -- Erase formspecs of old FPGAs
+ meta:set_string("formspec", "")
- meta:set_string("instr", lcore.serialize(is))
- plg.update_formspec(pos, is)
+ plg.open_formspecs[name] = pos
+ local is = lcore.deserialize(meta:get_string("instr"))
+ minetest.show_formspec(name, "mesecons:fpga", plg.to_formspec_string(is, nil))
end,
sounds = default.node_sound_stone_defaults(),
mesecons = {
@@ -116,6 +121,12 @@ plg.register_nodes({
},
after_dig_node = function(pos, node)
mesecon.receptor_off(pos, plg.rules[node.name])
+ for name, open_pos in pairs(plg.open_formspecs) do
+ if vector.equals(pos, open_pos) then
+ minetest.close_formspec(name, "mesecons:fpga")
+ plg.open_formspecs[name] = nil
+ end
+ end
end,
on_blast = mesecon.on_blastnode,
on_rotate = function(pos, node, user, mode)
@@ -153,13 +164,12 @@ plg.register_nodes({
end
meta:set_string("instr", lcore.serialize(instr))
- plg.update_formspec(pos, instr)
+ plg.update_meta(pos, instr)
return true
end,
})
-
-plg.to_formspec_string = function(is)
+plg.to_formspec_string = function(is, err)
local function dropdown_op(x, y, name, val)
local s = "dropdown[" .. tostring(x) .. "," .. tostring(y) .. ";"
.. "0.75,0.5;" .. name .. ";" -- the height seems to be ignored?
@@ -180,26 +190,20 @@ plg.to_formspec_string = function(is)
return s .. "]"
end
local function dropdown_action(x, y, name, val)
- local s = "dropdown[" .. tostring(x) .. "," .. tostring(y) .. ";"
- .. "1.125,0.5;" .. name .. ";" -- the height seems to be ignored?
- s = s .. " , AND, OR, NOT, XOR,NAND, =,XNOR;"
- if val == nil then
- return s .. "0]" -- actually selects no field at all
+ local selected = 0
+ local titles = { " " }
+ for i, data in ipairs(lcore.get_operations()) do
+ titles[i + 1] = data.fs_name
+ if val == data.gate then
+ selected = i + 1
+ end
end
- local mapping = {
- ["and"] = 1,
- ["or"] = 2,
- ["not"] = 3,
- ["xor"] = 4,
- ["nand"] = 5,
- ["buf"] = 6,
- ["xnor"] = 7,
- }
- return s .. tostring(1 + mapping[val]) .. "]"
+ return ("dropdown[%f,%f;1.125,0.5;%s;%s;%i]"):format(
+ x, y, name, table.concat(titles, ","), selected)
end
local s = "size[9,9]"..
"label[3.4,-0.15;FPGA gate configuration]"..
- "button_exit[7,7.5;2,2.5;program;Program]"..
+ "button[7,7.5;2,2.5;program;Program]"..
"box[4.2,0.5;0.03,7;#ffffff]"..
"label[0.25,0.25;op. 1]"..
"label[1.0,0.25;gate type]"..
@@ -225,6 +229,12 @@ plg.to_formspec_string = function(is)
y = 1 - 0.25
end
end
+ if err then
+ local fmsg = minetest.colorize("#ff0000", minetest.formspec_escape(err.msg))
+ s = s .. plg.red_box_around(err.i) ..
+ "label[0.25,8.25;The gate configuration is erroneous in the marked area:]"..
+ "label[0.25,8.5;" .. fmsg .. "]"
+ end
return s
end
@@ -239,20 +249,11 @@ plg.from_formspec_fields = function(fields)
end
end
local function read_action(s)
- if s == nil or s == " " then
- return nil
+ for i, data in ipairs(lcore.get_operations()) do
+ if data.fs_name == s then
+ return data.gate
+ end
end
- local mapping = {
- ["AND"] = "and",
- ["OR"] = "or",
- ["NOT"] = "not",
- ["XOR"] = "xor",
- ["NAND"] = "nand",
- ["="] = "buf",
- ["XNOR"] = "xnor",
- }
- s = s:gsub("^%s*", "") -- remove leading spaces
- return mapping[s]
end
local is = {}
for i = 1, 14 do
@@ -266,12 +267,11 @@ plg.from_formspec_fields = function(fields)
return is
end
-plg.update_formspec = function(pos, is)
+plg.update_meta = function(pos, is)
if type(is) == "string" then -- serialized string
is = lcore.deserialize(is)
end
local meta = minetest.get_meta(pos)
- local form = plg.to_formspec_string(is)
local err = lcore.validate(is)
if err == nil then
@@ -280,17 +280,20 @@ plg.update_formspec = function(pos, is)
else
meta:set_int("valid", 0)
meta:set_string("infotext", "FPGA")
- local fmsg = minetest.colorize("#ff0000", minetest.formspec_escape(err.msg))
- form = form .. plg.red_box_around(err.i) ..
- "label[0.25,8.25;The gate configuration is erroneous in the marked area:]"..
- "label[0.25,8.5;" .. fmsg .. "]"
end
- meta:set_string("formspec", form)
-
-- reset ports and run programmed logic
plg.setports(pos, false, false, false, false)
plg.update(pos)
+
+ -- Refresh open formspecs
+ local form = plg.to_formspec_string(is, err)
+ for name, open_pos in pairs(plg.open_formspecs) do
+ if vector.equals(pos, open_pos) then
+ minetest.show_formspec(name, "mesecons:fpga", form)
+ end
+ end
+ return err
end
plg.red_box_around = function(i)
@@ -409,6 +412,38 @@ plg.setports = function(pos, A, B, C, D) -- sets states of OUTPUT
end
end
+minetest.register_on_player_receive_fields(function(player, formname, fields)
+ local player_name = player:get_player_name()
+
+ if formname ~= "mesecons:fpga" or fields.quit then
+ plg.open_formspecs[player_name] = nil -- potential garbage
+ return
+ end
+ if not fields.program then
+ return -- we only care when the user clicks "Program"
+ end
+ local pos = plg.open_formspecs[player_name]
+ if minetest.is_protected(pos, player_name) then
+ minetest.record_protection_violation(pos, player_name)
+ return
+ end
+
+ local meta = minetest.get_meta(pos)
+ local is = plg.from_formspec_fields(fields)
+
+ meta:set_string("instr", lcore.serialize(is))
+ local err = plg.update_meta(pos, is)
+
+ if not err then
+ plg.open_formspecs[player_name] = nil
+ -- Close on success
+ minetest.close_formspec(player_name, "mesecons:fpga")
+ end
+end)
+
+minetest.register_on_leaveplayer(function(player)
+ plg.open_formspecs[player:get_player_name()] = nil
+end)
minetest.register_craft({
output = "mesecons_fpga:fpga0000 2",
diff --git a/mesecons_fpga/logic.lua b/mesecons_fpga/logic.lua
index 3dca154..106f779 100644
--- a/mesecons_fpga/logic.lua
+++ b/mesecons_fpga/logic.lua
@@ -1,5 +1,27 @@
+
local lg = {}
+local operations = {
+ -- table index: Index in the formspec dropdown
+ -- gate: Internal name
+ -- short: Serialized form, single character
+ -- fs_name: Display name, padded to 4 characters
+ -- func: Function that applies the operation
+ -- unary: Whether this gate only has one input
+ { gate = "and", short = "&", fs_name = " AND", func = function(a, b) return a and b end },
+ { gate = "or", short = "|", fs_name = " OR", func = function(a, b) return a or b end },
+ { gate = "not", short = "~", fs_name = " NOT", func = function(a, b) return not b end, unary = true },
+ { gate = "xor", short = "^", fs_name = " XOR", func = function(a, b) return a ~= b end },
+ { gate = "nand", short = "?", fs_name = "NAND", func = function(a, b) return not (a and b) end },
+ { gate = "buf", short = "_", fs_name = " =", func = function(a, b) return b end, unary = true },
+ { gate = "xnor", short = "=", fs_name = "XNOR", func = function(a, b) return a == b end },
+ { gate = "nor", short = "!", fs_name = " NOR", func = function(a, b) return not (a or b) end },
+}
+
+lg.get_operations = function()
+ return operations
+end
+
-- (de)serialize
lg.serialize = function(t)
local function _op(t)
@@ -11,20 +33,14 @@ lg.serialize = function(t)
return tostring(t.n)
end
end
- local function _action(s)
- if s == nil then
- return " "
+ -- Serialize actions (gates) from eg. "and" to "&"
+ local function _action(action)
+ for i, data in ipairs(operations) do
+ if data.gate == action then
+ return data.short
+ end
end
- local mapping = {
- ["and"] = "&",
- ["or"] = "|",
- ["not"] = "~",
- ["xor"] = "^",
- ["nand"] = "?", --dunno
- ["buf"] = "_",
- ["xnor"] = "=",
- }
- return mapping[s]
+ return " "
end
local s = ""
@@ -48,18 +64,14 @@ lg.deserialize = function(s)
return {type = "reg", n = tonumber(c)}
end
end
- local function _action(c)
- local mapping = {
- ["&"] = "and",
- ["|"] = "or",
- ["~"] = "not",
- ["^"] = "xor",
- ["?"] = "nand",
- ["_"] = "buf",
- ["="] = "xnor",
- [" "] = nil,
- }
- return mapping[c]
+ -- Deserialize actions (gates) from eg. "&" to "and"
+ local function _action(action)
+ for i, data in ipairs(operations) do
+ if data.short == action then
+ return data.gate
+ end
+ end
+ -- nil
end
local ret = {}
@@ -109,16 +121,25 @@ lg.validate_single = function(t, i)
return false
end
local elem = t[i]
+
+ local gate_data
+ for j, data in ipairs(operations) do
+ if data.gate == elem.action then
+ gate_data = data
+ break
+ end
+ end
+
-- check for completeness
- if elem.action == nil then
- return {i = i, msg = "Gate type required"}
- elseif elem.action == "not" or elem.action == "buf" then
+ if not gate_data then
+ return {i = i, msg = "Gate type is required"}
+ elseif gate_data.unary then
if elem.op1 ~= nil or elem.op2 == nil or elem.dst == nil then
- return {i = i, msg = "Second operand (only) and destination required"}
+ return {i = i, msg = "Second operand (only) and destination are required"}
end
else
if elem.op1 == nil or elem.op2 == nil or elem.dst == nil then
- return {i = i, msg = "Operands and destination required"}
+ return {i = i, msg = "Operands and destination are required"}
end
end
-- check whether operands/destination are identical
@@ -159,21 +180,12 @@ end
-- interpreter
lg.interpret = function(t, a, b, c, d)
local function _action(s, v1, v2)
- if s == "and" then
- return v1 and v2
- elseif s == "or" then
- return v1 or v2
- elseif s == "not" then
- return not v2
- elseif s == "xor" then
- return v1 ~= v2
- elseif s == "nand" then
- return not (v1 and v2)
- elseif s == "buf" then
- return v2
- else -- s == "xnor"
- return v1 == v2
+ for i, data in ipairs(operations) do
+ if data.gate == s then
+ return data.func(v1, v2)
+ end
end
+ return false -- unknown gate
end
local function _op(t, regs, io_in)
if t.type == "reg" then
diff --git a/mesecons_fpga/mod.conf b/mesecons_fpga/mod.conf
new file mode 100644
index 0000000..707f7c7
--- /dev/null
+++ b/mesecons_fpga/mod.conf
@@ -0,0 +1,3 @@
+name = mesecons_fpga
+depends = mesecons
+optional_depends = screwdriver
diff --git a/mesecons_fpga/sounds/mesecons_fpga_copy.ogg b/mesecons_fpga/sounds/mesecons_fpga_copy.ogg
new file mode 100644
index 0000000..259a1bd
Binary files /dev/null and b/mesecons_fpga/sounds/mesecons_fpga_copy.ogg differ
diff --git a/mesecons_fpga/sounds/mesecons_fpga_fail.ogg b/mesecons_fpga/sounds/mesecons_fpga_fail.ogg
new file mode 100644
index 0000000..5e9059f
Binary files /dev/null and b/mesecons_fpga/sounds/mesecons_fpga_fail.ogg differ
diff --git a/mesecons_fpga/sounds/mesecons_fpga_write.ogg b/mesecons_fpga/sounds/mesecons_fpga_write.ogg
new file mode 100644
index 0000000..e781bff
Binary files /dev/null and b/mesecons_fpga/sounds/mesecons_fpga_write.ogg differ
diff --git a/mesecons_fpga/textures/jeija_fpga_programmer.png b/mesecons_fpga/textures/jeija_fpga_programmer.png
index 9c0ba8f..78e7fb1 100644
Binary files a/mesecons_fpga/textures/jeija_fpga_programmer.png and b/mesecons_fpga/textures/jeija_fpga_programmer.png differ
diff --git a/mesecons_fpga/textures/jeija_fpga_sides.png b/mesecons_fpga/textures/jeija_fpga_sides.png
index e2d8e15..ed4f97d 100644
Binary files a/mesecons_fpga/textures/jeija_fpga_sides.png and b/mesecons_fpga/textures/jeija_fpga_sides.png differ
diff --git a/mesecons_fpga/textures/jeija_fpga_top.png b/mesecons_fpga/textures/jeija_fpga_top.png
index eaf1a1c..8382486 100644
Binary files a/mesecons_fpga/textures/jeija_fpga_top.png and b/mesecons_fpga/textures/jeija_fpga_top.png differ
diff --git a/mesecons_fpga/tool.lua b/mesecons_fpga/tool.lua
index 26ab49e..73d6c0f 100644
--- a/mesecons_fpga/tool.lua
+++ b/mesecons_fpga/tool.lua
@@ -18,11 +18,13 @@ minetest.register_tool("mesecons_fpga:programmer", {
local meta = minetest.get_meta(pos)
if meta:get_string("instr") == "//////////////" then
minetest.chat_send_player(placer:get_player_name(), "This FPGA is unprogrammed.")
+ minetest.sound_play("mesecons_fpga_fail", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack
end
itemstack:set_metadata(meta:get_string("instr"))
minetest.chat_send_player(placer:get_player_name(), "FPGA gate configuration was successfully copied!")
-
+ minetest.sound_play("mesecons_fpga_copy", { pos = placer:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
+
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
@@ -34,17 +36,24 @@ minetest.register_tool("mesecons_fpga:programmer", {
if minetest.get_node(pos).name:find("mesecons_fpga:fpga") ~= 1 then
return itemstack
end
+ local player_name = user:get_player_name()
+ if minetest.is_protected(pos, player_name) then
+ minetest.record_protection_violation(pos, player_name)
+ return itemstack
+ end
local imeta = itemstack:get_metadata()
if imeta == "" then
- minetest.chat_send_player(user:get_player_name(), "Use shift+right-click to copy a gate configuration first.")
+ minetest.chat_send_player(player_name, "Use shift+right-click to copy a gate configuration first.")
+ minetest.sound_play("mesecons_fpga_fail", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack
end
local meta = minetest.get_meta(pos)
meta:set_string("instr", imeta)
- plg.update_formspec(pos, imeta)
- minetest.chat_send_player(user:get_player_name(), "Gate configuration was successfully written to FPGA!")
+ plg.update_meta(pos, imeta)
+ minetest.chat_send_player(player_name, "Gate configuration was successfully written to FPGA!")
+ minetest.sound_play("mesecons_fpga_write", { pos = user:get_pos(), gain = 0.1, max_hear_distance = 4 }, true)
return itemstack
end
diff --git a/mesecons_gates/depends.txt b/mesecons_gates/depends.txt
deleted file mode 100644
index f3e0392..0000000
--- a/mesecons_gates/depends.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-mesecons
-mesecons_microcontroller
-mesecons_delayer
-
-mesecons_torch
-mesecons_materials
diff --git a/mesecons_gates/doc/and/preview.png b/mesecons_gates/doc/and/preview.png
index b2b5301..d3b2936 100644
Binary files a/mesecons_gates/doc/and/preview.png and b/mesecons_gates/doc/and/preview.png differ
diff --git a/mesecons_gates/doc/and/recipe.png b/mesecons_gates/doc/and/recipe.png
index ae6bf63..b81680a 100644
Binary files a/mesecons_gates/doc/and/recipe.png and b/mesecons_gates/doc/and/recipe.png differ
diff --git a/mesecons_gates/doc/diode/preview.png b/mesecons_gates/doc/diode/preview.png
index ced541b..dc961d9 100644
Binary files a/mesecons_gates/doc/diode/preview.png and b/mesecons_gates/doc/diode/preview.png differ
diff --git a/mesecons_gates/doc/diode/recipe.png b/mesecons_gates/doc/diode/recipe.png
index 71086bf..bce3562 100644
Binary files a/mesecons_gates/doc/diode/recipe.png and b/mesecons_gates/doc/diode/recipe.png differ
diff --git a/mesecons_gates/doc/nand/preview.png b/mesecons_gates/doc/nand/preview.png
index d8db780..364d6c3 100644
Binary files a/mesecons_gates/doc/nand/preview.png and b/mesecons_gates/doc/nand/preview.png differ
diff --git a/mesecons_gates/doc/nand/recipe.png b/mesecons_gates/doc/nand/recipe.png
index e6118b3..a1ee618 100644
Binary files a/mesecons_gates/doc/nand/recipe.png and b/mesecons_gates/doc/nand/recipe.png differ
diff --git a/mesecons_gates/doc/nor/preview.png b/mesecons_gates/doc/nor/preview.png
index b6d2781..d733fd7 100644
Binary files a/mesecons_gates/doc/nor/preview.png and b/mesecons_gates/doc/nor/preview.png differ
diff --git a/mesecons_gates/doc/nor/recipe.png b/mesecons_gates/doc/nor/recipe.png
index a2063c7..a801d8f 100644
Binary files a/mesecons_gates/doc/nor/recipe.png and b/mesecons_gates/doc/nor/recipe.png differ
diff --git a/mesecons_gates/doc/not/preview.png b/mesecons_gates/doc/not/preview.png
index 4a33cd1..3680c15 100644
Binary files a/mesecons_gates/doc/not/preview.png and b/mesecons_gates/doc/not/preview.png differ
diff --git a/mesecons_gates/doc/not/recipe.png b/mesecons_gates/doc/not/recipe.png
index ee1c0d6..b5ec6a8 100644
Binary files a/mesecons_gates/doc/not/recipe.png and b/mesecons_gates/doc/not/recipe.png differ
diff --git a/mesecons_gates/doc/or/preview.png b/mesecons_gates/doc/or/preview.png
index b7a8cdc..0c46aa1 100644
Binary files a/mesecons_gates/doc/or/preview.png and b/mesecons_gates/doc/or/preview.png differ
diff --git a/mesecons_gates/doc/or/recipe.png b/mesecons_gates/doc/or/recipe.png
index b94169d..58a1256 100644
Binary files a/mesecons_gates/doc/or/recipe.png and b/mesecons_gates/doc/or/recipe.png differ
diff --git a/mesecons_gates/doc/xor/preview.png b/mesecons_gates/doc/xor/preview.png
index 3d3941e..0bc24c6 100644
Binary files a/mesecons_gates/doc/xor/preview.png and b/mesecons_gates/doc/xor/preview.png differ
diff --git a/mesecons_gates/doc/xor/recipe.png b/mesecons_gates/doc/xor/recipe.png
index 1e129bf..f710899 100644
Binary files a/mesecons_gates/doc/xor/recipe.png and b/mesecons_gates/doc/xor/recipe.png differ
diff --git a/mesecons_gates/init.lua b/mesecons_gates/init.lua
index 421a7d4..c30f9f8 100644
--- a/mesecons_gates/init.lua
+++ b/mesecons_gates/init.lua
@@ -1,6 +1,14 @@
+local selection_box = {
+ type = "fixed",
+ fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }
+}
+
local nodebox = {
type = "fixed",
- fixed = {{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }},
+ 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 }
+ },
}
local function gate_rotate_rules(node, rules)
@@ -68,7 +76,7 @@ local function register_gate(name, inputnumber, assess, recipe, description)
is_ground_content = false,
drawtype = "nodebox",
drop = basename.."_off",
- selection_box = nodebox,
+ selection_box = selection_box,
node_box = nodebox,
walkable = true,
sounds = default.node_sound_stone_defaults(),
@@ -78,8 +86,16 @@ local function register_gate(name, inputnumber, assess, recipe, description)
inputnumber = inputnumber,
after_dig_node = mesecon.do_cooldown,
},{
- tiles = {"jeija_microcontroller_bottom.png^".."jeija_gate_off.png^"..
- "jeija_gate_"..name..".png"},
+ tiles = {
+ "jeija_microcontroller_bottom.png^".."jeija_gate_off.png^"..
+ "jeija_gate_output_off.png^".."jeija_gate_"..name..".png",
+ "jeija_microcontroller_bottom.png^".."jeija_gate_output_off.png^"..
+ "[transformFY",
+ "jeija_gate_side.png^".."jeija_gate_side_output_off.png",
+ "jeija_gate_side.png",
+ "jeija_gate_side.png",
+ "jeija_gate_side.png"
+ },
groups = {dig_immediate = 2, overheat = 1},
mesecons = { receptor = {
state = "off",
@@ -89,8 +105,16 @@ local function register_gate(name, inputnumber, assess, recipe, description)
action_change = update_gate
}}
},{
- tiles = {"jeija_microcontroller_bottom.png^".."jeija_gate_on.png^"..
- "jeija_gate_"..name..".png"},
+ tiles = {
+ "jeija_microcontroller_bottom.png^".."jeija_gate_on.png^"..
+ "jeija_gate_output_on.png^".."jeija_gate_"..name..".png",
+ "jeija_microcontroller_bottom.png^".."jeija_gate_output_on.png^"..
+ "[transformFY",
+ "jeija_gate_side.png^".."jeija_gate_side_output_on.png",
+ "jeija_gate_side.png",
+ "jeija_gate_side.png",
+ "jeija_gate_side.png"
+ },
groups = {dig_immediate = 2, not_in_creative_inventory = 1, overheat = 1},
mesecons = { receptor = {
state = "on",
diff --git a/mesecons_gates/mod.conf b/mesecons_gates/mod.conf
new file mode 100644
index 0000000..c57336f
--- /dev/null
+++ b/mesecons_gates/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_gates
+depends = mesecons, mesecons_microcontroller, mesecons_delayer, mesecons_torch, mesecons_materials
diff --git a/mesecons_gates/textures/jeija_gate_and.png b/mesecons_gates/textures/jeija_gate_and.png
index 0ddc043..825a22b 100644
Binary files a/mesecons_gates/textures/jeija_gate_and.png and b/mesecons_gates/textures/jeija_gate_and.png differ
diff --git a/mesecons_gates/textures/jeija_gate_diode.png b/mesecons_gates/textures/jeija_gate_diode.png
index ffa403f..49c2076 100644
Binary files a/mesecons_gates/textures/jeija_gate_diode.png and b/mesecons_gates/textures/jeija_gate_diode.png differ
diff --git a/mesecons_gates/textures/jeija_gate_nand.png b/mesecons_gates/textures/jeija_gate_nand.png
index 0e4294e..f14567b 100644
Binary files a/mesecons_gates/textures/jeija_gate_nand.png and b/mesecons_gates/textures/jeija_gate_nand.png differ
diff --git a/mesecons_gates/textures/jeija_gate_nor.png b/mesecons_gates/textures/jeija_gate_nor.png
index c4298e3..c4218bc 100644
Binary files a/mesecons_gates/textures/jeija_gate_nor.png and b/mesecons_gates/textures/jeija_gate_nor.png differ
diff --git a/mesecons_gates/textures/jeija_gate_not.png b/mesecons_gates/textures/jeija_gate_not.png
index 939fb76..27b7281 100644
Binary files a/mesecons_gates/textures/jeija_gate_not.png and b/mesecons_gates/textures/jeija_gate_not.png differ
diff --git a/mesecons_gates/textures/jeija_gate_off.png b/mesecons_gates/textures/jeija_gate_off.png
index 44017b0..2f77aeb 100644
Binary files a/mesecons_gates/textures/jeija_gate_off.png and b/mesecons_gates/textures/jeija_gate_off.png differ
diff --git a/mesecons_gates/textures/jeija_gate_on.png b/mesecons_gates/textures/jeija_gate_on.png
index 47028a8..406e4f6 100644
Binary files a/mesecons_gates/textures/jeija_gate_on.png and b/mesecons_gates/textures/jeija_gate_on.png differ
diff --git a/mesecons_gates/textures/jeija_gate_or.png b/mesecons_gates/textures/jeija_gate_or.png
index 09f0661..3180add 100644
Binary files a/mesecons_gates/textures/jeija_gate_or.png and b/mesecons_gates/textures/jeija_gate_or.png differ
diff --git a/mesecons_gates/textures/jeija_gate_output_off.png b/mesecons_gates/textures/jeija_gate_output_off.png
new file mode 100644
index 0000000..bee3942
Binary files /dev/null and b/mesecons_gates/textures/jeija_gate_output_off.png differ
diff --git a/mesecons_gates/textures/jeija_gate_output_on.png b/mesecons_gates/textures/jeija_gate_output_on.png
new file mode 100644
index 0000000..b3b6d21
Binary files /dev/null and b/mesecons_gates/textures/jeija_gate_output_on.png differ
diff --git a/mesecons_gates/textures/jeija_gate_side.png b/mesecons_gates/textures/jeija_gate_side.png
new file mode 100644
index 0000000..1223b54
Binary files /dev/null and b/mesecons_gates/textures/jeija_gate_side.png differ
diff --git a/mesecons_gates/textures/jeija_gate_side_output_off.png b/mesecons_gates/textures/jeija_gate_side_output_off.png
new file mode 100644
index 0000000..785e7c6
Binary files /dev/null and b/mesecons_gates/textures/jeija_gate_side_output_off.png differ
diff --git a/mesecons_gates/textures/jeija_gate_side_output_on.png b/mesecons_gates/textures/jeija_gate_side_output_on.png
new file mode 100644
index 0000000..0aaa4a5
Binary files /dev/null and b/mesecons_gates/textures/jeija_gate_side_output_on.png differ
diff --git a/mesecons_gates/textures/jeija_gate_xor.png b/mesecons_gates/textures/jeija_gate_xor.png
index afbd6ab..df13e96 100644
Binary files a/mesecons_gates/textures/jeija_gate_xor.png and b/mesecons_gates/textures/jeija_gate_xor.png differ
diff --git a/mesecons_hydroturbine/depends.txt b/mesecons_hydroturbine/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_hydroturbine/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_hydroturbine/doc/waterturbine/preview.png b/mesecons_hydroturbine/doc/waterturbine/preview.png
index 14be16e..b45ca23 100644
Binary files a/mesecons_hydroturbine/doc/waterturbine/preview.png and b/mesecons_hydroturbine/doc/waterturbine/preview.png differ
diff --git a/mesecons_hydroturbine/doc/waterturbine/recipe.png b/mesecons_hydroturbine/doc/waterturbine/recipe.png
index 8eb5365..8c8141e 100644
Binary files a/mesecons_hydroturbine/doc/waterturbine/recipe.png and b/mesecons_hydroturbine/doc/waterturbine/recipe.png differ
diff --git a/mesecons_hydroturbine/mod.conf b/mesecons_hydroturbine/mod.conf
new file mode 100644
index 0000000..ce221ea
--- /dev/null
+++ b/mesecons_hydroturbine/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_hydroturbine
+depends = mesecons
diff --git a/mesecons_hydroturbine/textures/jeija_hydro_turbine_inv.png b/mesecons_hydroturbine/textures/jeija_hydro_turbine_inv.png
index 4cc9f20..7453d61 100644
Binary files a/mesecons_hydroturbine/textures/jeija_hydro_turbine_inv.png and b/mesecons_hydroturbine/textures/jeija_hydro_turbine_inv.png differ
diff --git a/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_off.png b/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_off.png
index 89975e8..6e12834 100644
Binary files a/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_off.png and b/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_off.png differ
diff --git a/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_on.png b/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_on.png
index 759388a..c8a2f39 100644
Binary files a/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_on.png and b/mesecons_hydroturbine/textures/jeija_hydro_turbine_sides_on.png differ
diff --git a/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_off.png b/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_off.png
index 45a720b..c6ed54d 100644
Binary files a/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_off.png and b/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_off.png differ
diff --git a/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_on.png b/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_on.png
index e609dd2..2d6b9fa 100644
Binary files a/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_on.png and b/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_misc_on.png differ
diff --git a/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_top_bottom_on.png b/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_top_bottom_on.png
index ac4df83..8d93f9d 100644
Binary files a/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_top_bottom_on.png and b/mesecons_hydroturbine/textures/jeija_hydro_turbine_turbine_top_bottom_on.png differ
diff --git a/mesecons_insulated/depends.txt b/mesecons_insulated/depends.txt
deleted file mode 100644
index a0ba1ef..0000000
--- a/mesecons_insulated/depends.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-mesecons
-screwdriver?
diff --git a/mesecons_insulated/doc/insulated/preview.png b/mesecons_insulated/doc/insulated/preview.png
index bf544e8..04356d5 100644
Binary files a/mesecons_insulated/doc/insulated/preview.png and b/mesecons_insulated/doc/insulated/preview.png differ
diff --git a/mesecons_insulated/doc/insulated/recipe.png b/mesecons_insulated/doc/insulated/recipe.png
index f2a731a..e2a7f44 100644
Binary files a/mesecons_insulated/doc/insulated/recipe.png and b/mesecons_insulated/doc/insulated/recipe.png differ
diff --git a/mesecons_insulated/mod.conf b/mesecons_insulated/mod.conf
new file mode 100644
index 0000000..d5965f0
--- /dev/null
+++ b/mesecons_insulated/mod.conf
@@ -0,0 +1,3 @@
+name = mesecons_insulated
+depends = mesecons
+optional_depends = screwdriver
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_off.png b/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_off.png
deleted file mode 100644
index 85ca90b..0000000
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_off.png and /dev/null differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_on.png b/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_on.png
deleted file mode 100644
index 772d9a6..0000000
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_curved_tb_on.png and /dev/null differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_ends_off.png b/mesecons_insulated/textures/jeija_insulated_wire_ends_off.png
index 89a8385..d457dde 100644
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_ends_off.png and b/mesecons_insulated/textures/jeija_insulated_wire_ends_off.png differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_ends_on.png b/mesecons_insulated/textures/jeija_insulated_wire_ends_on.png
index 75cf435..48df808 100644
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_ends_on.png and b/mesecons_insulated/textures/jeija_insulated_wire_ends_on.png differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_sides_off.png b/mesecons_insulated/textures/jeija_insulated_wire_sides_off.png
index db33f14..da933e0 100644
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_sides_off.png and b/mesecons_insulated/textures/jeija_insulated_wire_sides_off.png differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_sides_on.png b/mesecons_insulated/textures/jeija_insulated_wire_sides_on.png
index f76e9a8..cdc3798 100644
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_sides_on.png and b/mesecons_insulated/textures/jeija_insulated_wire_sides_on.png differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_off.png b/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_off.png
index a897b29..451fbc2 100644
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_off.png and b/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_off.png differ
diff --git a/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_on.png b/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_on.png
index 8fc312b..e30dad4 100644
Binary files a/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_on.png and b/mesecons_insulated/textures/jeija_insulated_wire_tjunction_tb_on.png differ
diff --git a/mesecons_lamp/depends.txt b/mesecons_lamp/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_lamp/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_lamp/doc/lamp/preview.png b/mesecons_lamp/doc/lamp/preview.png
index a581cb3..5de07f0 100644
Binary files a/mesecons_lamp/doc/lamp/preview.png and b/mesecons_lamp/doc/lamp/preview.png differ
diff --git a/mesecons_lamp/doc/lamp/recipe.png b/mesecons_lamp/doc/lamp/recipe.png
index 77570bd..145e6f3 100644
Binary files a/mesecons_lamp/doc/lamp/recipe.png and b/mesecons_lamp/doc/lamp/recipe.png differ
diff --git a/mesecons_lamp/mod.conf b/mesecons_lamp/mod.conf
new file mode 100644
index 0000000..b469619
--- /dev/null
+++ b/mesecons_lamp/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_lamp
+depends = mesecons
diff --git a/mesecons_lamp/textures/jeija_meselamp.png b/mesecons_lamp/textures/jeija_meselamp.png
index 5456ee9..b0bc817 100644
Binary files a/mesecons_lamp/textures/jeija_meselamp.png and b/mesecons_lamp/textures/jeija_meselamp.png differ
diff --git a/mesecons_lamp/textures/jeija_meselamp_off.png b/mesecons_lamp/textures/jeija_meselamp_off.png
index 67bd7fd..be6ad5f 100644
Binary files a/mesecons_lamp/textures/jeija_meselamp_off.png and b/mesecons_lamp/textures/jeija_meselamp_off.png differ
diff --git a/mesecons_lamp/textures/jeija_meselamp_on.png b/mesecons_lamp/textures/jeija_meselamp_on.png
index 2316e00..a91e1b1 100644
Binary files a/mesecons_lamp/textures/jeija_meselamp_on.png and b/mesecons_lamp/textures/jeija_meselamp_on.png differ
diff --git a/mesecons_lightstone/depends.txt b/mesecons_lightstone/depends.txt
deleted file mode 100644
index f9705e0..0000000
--- a/mesecons_lightstone/depends.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-mesecons
-dye
diff --git a/mesecons_lightstone/doc/lightstone_blue/preview.png b/mesecons_lightstone/doc/lightstone_blue/preview.png
index 579f719..085c619 100644
Binary files a/mesecons_lightstone/doc/lightstone_blue/preview.png and b/mesecons_lightstone/doc/lightstone_blue/preview.png differ
diff --git a/mesecons_lightstone/doc/lightstone_blue/recipe.png b/mesecons_lightstone/doc/lightstone_blue/recipe.png
index ce8ebd7..f72d00f 100644
Binary files a/mesecons_lightstone/doc/lightstone_blue/recipe.png and b/mesecons_lightstone/doc/lightstone_blue/recipe.png differ
diff --git a/mesecons_lightstone/doc/lightstone_darkgrey/preview.png b/mesecons_lightstone/doc/lightstone_darkgrey/preview.png
index 56fe6ea..f24c8ab 100644
Binary files a/mesecons_lightstone/doc/lightstone_darkgrey/preview.png and b/mesecons_lightstone/doc/lightstone_darkgrey/preview.png differ
diff --git a/mesecons_lightstone/doc/lightstone_darkgrey/recipe.png b/mesecons_lightstone/doc/lightstone_darkgrey/recipe.png
index fed0db2..193a37d 100644
Binary files a/mesecons_lightstone/doc/lightstone_darkgrey/recipe.png and b/mesecons_lightstone/doc/lightstone_darkgrey/recipe.png differ
diff --git a/mesecons_lightstone/doc/lightstone_green/preview.png b/mesecons_lightstone/doc/lightstone_green/preview.png
index 9efc774..1cff184 100644
Binary files a/mesecons_lightstone/doc/lightstone_green/preview.png and b/mesecons_lightstone/doc/lightstone_green/preview.png differ
diff --git a/mesecons_lightstone/doc/lightstone_green/recipe.png b/mesecons_lightstone/doc/lightstone_green/recipe.png
index 6690064..35b3523 100644
Binary files a/mesecons_lightstone/doc/lightstone_green/recipe.png and b/mesecons_lightstone/doc/lightstone_green/recipe.png differ
diff --git a/mesecons_lightstone/doc/lightstone_lightgrey/preview.png b/mesecons_lightstone/doc/lightstone_lightgrey/preview.png
index 0084fa3..0347c21 100644
Binary files a/mesecons_lightstone/doc/lightstone_lightgrey/preview.png and b/mesecons_lightstone/doc/lightstone_lightgrey/preview.png differ
diff --git a/mesecons_lightstone/doc/lightstone_lightgrey/recipe.png b/mesecons_lightstone/doc/lightstone_lightgrey/recipe.png
index e790012..37dba5b 100644
Binary files a/mesecons_lightstone/doc/lightstone_lightgrey/recipe.png and b/mesecons_lightstone/doc/lightstone_lightgrey/recipe.png differ
diff --git a/mesecons_lightstone/doc/lightstone_red/preview.png b/mesecons_lightstone/doc/lightstone_red/preview.png
index 5fd3eba..f802d3d 100644
Binary files a/mesecons_lightstone/doc/lightstone_red/preview.png and b/mesecons_lightstone/doc/lightstone_red/preview.png differ
diff --git a/mesecons_lightstone/doc/lightstone_red/recipe.png b/mesecons_lightstone/doc/lightstone_red/recipe.png
index 7791a99..dd5811a 100644
Binary files a/mesecons_lightstone/doc/lightstone_red/recipe.png and b/mesecons_lightstone/doc/lightstone_red/recipe.png differ
diff --git a/mesecons_lightstone/doc/lightstone_yellow/preview.png b/mesecons_lightstone/doc/lightstone_yellow/preview.png
index fb9f644..fa975c5 100644
Binary files a/mesecons_lightstone/doc/lightstone_yellow/preview.png and b/mesecons_lightstone/doc/lightstone_yellow/preview.png differ
diff --git a/mesecons_lightstone/doc/lightstone_yellow/recipe.png b/mesecons_lightstone/doc/lightstone_yellow/recipe.png
index f17e9d4..1ca449f 100644
Binary files a/mesecons_lightstone/doc/lightstone_yellow/recipe.png and b/mesecons_lightstone/doc/lightstone_yellow/recipe.png differ
diff --git a/mesecons_lightstone/mod.conf b/mesecons_lightstone/mod.conf
new file mode 100644
index 0000000..421f58d
--- /dev/null
+++ b/mesecons_lightstone/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_lightstone
+depends = mesecons, dye
diff --git a/mesecons_lightstone/textures/jeija_lightstone_blue_off.png b/mesecons_lightstone/textures/jeija_lightstone_blue_off.png
index 09acc22..87f753c 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_blue_off.png and b/mesecons_lightstone/textures/jeija_lightstone_blue_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_blue_on.png b/mesecons_lightstone/textures/jeija_lightstone_blue_on.png
index 93c8638..008a5fe 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_blue_on.png and b/mesecons_lightstone/textures/jeija_lightstone_blue_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_cyan_off.png b/mesecons_lightstone/textures/jeija_lightstone_cyan_off.png
index 5315110..1c9168c 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_cyan_off.png and b/mesecons_lightstone/textures/jeija_lightstone_cyan_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_cyan_on.png b/mesecons_lightstone/textures/jeija_lightstone_cyan_on.png
index 200345c..92edf58 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_cyan_on.png and b/mesecons_lightstone/textures/jeija_lightstone_cyan_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_darkgray_off.png b/mesecons_lightstone/textures/jeija_lightstone_darkgray_off.png
index 7e5aae7..f7ded2a 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_darkgray_off.png and b/mesecons_lightstone/textures/jeija_lightstone_darkgray_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_darkgray_on.png b/mesecons_lightstone/textures/jeija_lightstone_darkgray_on.png
index e6d4d00..cfffb09 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_darkgray_on.png and b/mesecons_lightstone/textures/jeija_lightstone_darkgray_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_gray_off.png b/mesecons_lightstone/textures/jeija_lightstone_gray_off.png
index f168fc2..1c5c28d 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_gray_off.png and b/mesecons_lightstone/textures/jeija_lightstone_gray_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_gray_on.png b/mesecons_lightstone/textures/jeija_lightstone_gray_on.png
index 24c5470..ba067ba 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_gray_on.png and b/mesecons_lightstone/textures/jeija_lightstone_gray_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_green_off.png b/mesecons_lightstone/textures/jeija_lightstone_green_off.png
index 2f214fa..9051fee 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_green_off.png and b/mesecons_lightstone/textures/jeija_lightstone_green_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_green_on.png b/mesecons_lightstone/textures/jeija_lightstone_green_on.png
index 225bf4e..0cadbc9 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_green_on.png and b/mesecons_lightstone/textures/jeija_lightstone_green_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_magenta_off.png b/mesecons_lightstone/textures/jeija_lightstone_magenta_off.png
index 43fa524..9c50f68 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_magenta_off.png and b/mesecons_lightstone/textures/jeija_lightstone_magenta_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_magenta_on.png b/mesecons_lightstone/textures/jeija_lightstone_magenta_on.png
index 8f28b7c..d46f295 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_magenta_on.png and b/mesecons_lightstone/textures/jeija_lightstone_magenta_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_orange_off.png b/mesecons_lightstone/textures/jeija_lightstone_orange_off.png
index 4bf206e..f62bc62 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_orange_off.png and b/mesecons_lightstone/textures/jeija_lightstone_orange_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_orange_on.png b/mesecons_lightstone/textures/jeija_lightstone_orange_on.png
index bcba4d2..e393585 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_orange_on.png and b/mesecons_lightstone/textures/jeija_lightstone_orange_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_pink_off.png b/mesecons_lightstone/textures/jeija_lightstone_pink_off.png
index ee265f9..89a358c 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_pink_off.png and b/mesecons_lightstone/textures/jeija_lightstone_pink_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_pink_on.png b/mesecons_lightstone/textures/jeija_lightstone_pink_on.png
index ba85110..8df940b 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_pink_on.png and b/mesecons_lightstone/textures/jeija_lightstone_pink_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_red_off.png b/mesecons_lightstone/textures/jeija_lightstone_red_off.png
index 3c828b2..32c22cd 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_red_off.png and b/mesecons_lightstone/textures/jeija_lightstone_red_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_red_on.png b/mesecons_lightstone/textures/jeija_lightstone_red_on.png
index 512b0fe..b1ffd57 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_red_on.png and b/mesecons_lightstone/textures/jeija_lightstone_red_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_violet_off.png b/mesecons_lightstone/textures/jeija_lightstone_violet_off.png
index 83b5e2d..514528c 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_violet_off.png and b/mesecons_lightstone/textures/jeija_lightstone_violet_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_violet_on.png b/mesecons_lightstone/textures/jeija_lightstone_violet_on.png
index 2b3eb2e..d607f32 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_violet_on.png and b/mesecons_lightstone/textures/jeija_lightstone_violet_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_white_off.png b/mesecons_lightstone/textures/jeija_lightstone_white_off.png
index 78338c8..ddb7ebb 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_white_off.png and b/mesecons_lightstone/textures/jeija_lightstone_white_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_white_on.png b/mesecons_lightstone/textures/jeija_lightstone_white_on.png
index 792d89d..9caac0c 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_white_on.png and b/mesecons_lightstone/textures/jeija_lightstone_white_on.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_yellow_off.png b/mesecons_lightstone/textures/jeija_lightstone_yellow_off.png
index 2e7fed0..5280e91 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_yellow_off.png and b/mesecons_lightstone/textures/jeija_lightstone_yellow_off.png differ
diff --git a/mesecons_lightstone/textures/jeija_lightstone_yellow_on.png b/mesecons_lightstone/textures/jeija_lightstone_yellow_on.png
index 8943aca..806efbe 100644
Binary files a/mesecons_lightstone/textures/jeija_lightstone_yellow_on.png and b/mesecons_lightstone/textures/jeija_lightstone_yellow_on.png differ
diff --git a/mesecons_luacontroller/depends.txt b/mesecons_luacontroller/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_luacontroller/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_luacontroller/doc/luacontroller/preview.png b/mesecons_luacontroller/doc/luacontroller/preview.png
index f16c9d0..d5babfc 100644
Binary files a/mesecons_luacontroller/doc/luacontroller/preview.png and b/mesecons_luacontroller/doc/luacontroller/preview.png differ
diff --git a/mesecons_luacontroller/doc/luacontroller/recipe.png b/mesecons_luacontroller/doc/luacontroller/recipe.png
index 529b66d..fca9b06 100644
Binary files a/mesecons_luacontroller/doc/luacontroller/recipe.png and b/mesecons_luacontroller/doc/luacontroller/recipe.png differ
diff --git a/mesecons_luacontroller/mod.conf b/mesecons_luacontroller/mod.conf
new file mode 100644
index 0000000..0db7d72
--- /dev/null
+++ b/mesecons_luacontroller/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_luacontroller
+depends = mesecons
diff --git a/mesecons_luacontroller/textures/jeija_luac_background.png b/mesecons_luacontroller/textures/jeija_luac_background.png
index 40b427e..f2a07e1 100644
Binary files a/mesecons_luacontroller/textures/jeija_luac_background.png and b/mesecons_luacontroller/textures/jeija_luac_background.png differ
diff --git a/mesecons_luacontroller/textures/jeija_luac_runbutton.png b/mesecons_luacontroller/textures/jeija_luac_runbutton.png
index 157507f..f43b571 100644
Binary files a/mesecons_luacontroller/textures/jeija_luac_runbutton.png and b/mesecons_luacontroller/textures/jeija_luac_runbutton.png differ
diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_A.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_A.png
index a187e8e..c6182cc 100644
Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_A.png and b/mesecons_luacontroller/textures/jeija_luacontroller_LED_A.png differ
diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_B.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_B.png
index 738ba96..04c2da0 100644
Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_B.png and b/mesecons_luacontroller/textures/jeija_luacontroller_LED_B.png differ
diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_C.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_C.png
index abe0fe6..01f6ae4 100644
Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_C.png and b/mesecons_luacontroller/textures/jeija_luacontroller_LED_C.png differ
diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_LED_D.png b/mesecons_luacontroller/textures/jeija_luacontroller_LED_D.png
index cc10170..6c8a26f 100644
Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_LED_D.png and b/mesecons_luacontroller/textures/jeija_luacontroller_LED_D.png differ
diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_burnt_top.png b/mesecons_luacontroller/textures/jeija_luacontroller_burnt_top.png
index d1a17af..c9e1144 100644
Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_burnt_top.png and b/mesecons_luacontroller/textures/jeija_luacontroller_burnt_top.png differ
diff --git a/mesecons_luacontroller/textures/jeija_luacontroller_top.png b/mesecons_luacontroller/textures/jeija_luacontroller_top.png
index 3128230..848f417 100644
Binary files a/mesecons_luacontroller/textures/jeija_luacontroller_top.png and b/mesecons_luacontroller/textures/jeija_luacontroller_top.png differ
diff --git a/mesecons_materials/depends.txt b/mesecons_materials/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_materials/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_materials/doc/fiber/preview.png b/mesecons_materials/doc/fiber/preview.png
index cad9645..4b5dc05 100644
Binary files a/mesecons_materials/doc/fiber/preview.png and b/mesecons_materials/doc/fiber/preview.png differ
diff --git a/mesecons_materials/doc/fiber/recipe.png b/mesecons_materials/doc/fiber/recipe.png
index 7a53123..689adf6 100644
Binary files a/mesecons_materials/doc/fiber/recipe.png and b/mesecons_materials/doc/fiber/recipe.png differ
diff --git a/mesecons_materials/doc/glue/preview.png b/mesecons_materials/doc/glue/preview.png
index 0158f9c..71a58ef 100644
Binary files a/mesecons_materials/doc/glue/preview.png and b/mesecons_materials/doc/glue/preview.png differ
diff --git a/mesecons_materials/doc/glue/recipe.png b/mesecons_materials/doc/glue/recipe.png
index b20ce66..763e369 100644
Binary files a/mesecons_materials/doc/glue/recipe.png and b/mesecons_materials/doc/glue/recipe.png differ
diff --git a/mesecons_materials/doc/silicon/preview.png b/mesecons_materials/doc/silicon/preview.png
index cd52dbd..452ed40 100644
Binary files a/mesecons_materials/doc/silicon/preview.png and b/mesecons_materials/doc/silicon/preview.png differ
diff --git a/mesecons_materials/doc/silicon/recipe.png b/mesecons_materials/doc/silicon/recipe.png
index 9e8b332..d73a6c2 100644
Binary files a/mesecons_materials/doc/silicon/recipe.png and b/mesecons_materials/doc/silicon/recipe.png differ
diff --git a/mesecons_materials/mod.conf b/mesecons_materials/mod.conf
new file mode 100644
index 0000000..53d1e1d
--- /dev/null
+++ b/mesecons_materials/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_materials
+depends = mesecons
diff --git a/mesecons_materials/textures/mesecons_fiber.png b/mesecons_materials/textures/mesecons_fiber.png
index e8c7b08..2a4b231 100644
Binary files a/mesecons_materials/textures/mesecons_fiber.png and b/mesecons_materials/textures/mesecons_fiber.png differ
diff --git a/mesecons_materials/textures/mesecons_glue.png b/mesecons_materials/textures/mesecons_glue.png
index 2f351d1..28171f4 100644
Binary files a/mesecons_materials/textures/mesecons_glue.png and b/mesecons_materials/textures/mesecons_glue.png differ
diff --git a/mesecons_materials/textures/mesecons_silicon.png b/mesecons_materials/textures/mesecons_silicon.png
index a7b0d52..7014f3f 100644
Binary files a/mesecons_materials/textures/mesecons_silicon.png and b/mesecons_materials/textures/mesecons_silicon.png differ
diff --git a/mesecons_microcontroller/depends.txt b/mesecons_microcontroller/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_microcontroller/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_microcontroller/mod.conf b/mesecons_microcontroller/mod.conf
new file mode 100644
index 0000000..6a18b2c
--- /dev/null
+++ b/mesecons_microcontroller/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_microcontroller
+depends = mesecons
diff --git a/mesecons_microcontroller/textures/jeija_microcontroller_top.png b/mesecons_microcontroller/textures/jeija_microcontroller_top.png
index 438c934..e8ec99e 100644
Binary files a/mesecons_microcontroller/textures/jeija_microcontroller_top.png and b/mesecons_microcontroller/textures/jeija_microcontroller_top.png differ
diff --git a/mesecons_movestones/depends.txt b/mesecons_movestones/depends.txt
deleted file mode 100644
index a596cf8..0000000
--- a/mesecons_movestones/depends.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-mesecons
-mesecons_materials
-mesecons_mvps
diff --git a/mesecons_movestones/doc/movestone/preview.png b/mesecons_movestones/doc/movestone/preview.png
index bda64db..fb6ab7c 100644
Binary files a/mesecons_movestones/doc/movestone/preview.png and b/mesecons_movestones/doc/movestone/preview.png differ
diff --git a/mesecons_movestones/doc/movestone/recipe.png b/mesecons_movestones/doc/movestone/recipe.png
index f3d45df..61165b1 100644
Binary files a/mesecons_movestones/doc/movestone/recipe.png and b/mesecons_movestones/doc/movestone/recipe.png differ
diff --git a/mesecons_movestones/doc/movestone_sticky/preview.png b/mesecons_movestones/doc/movestone_sticky/preview.png
index 85f9213..b9b2302 100644
Binary files a/mesecons_movestones/doc/movestone_sticky/preview.png and b/mesecons_movestones/doc/movestone_sticky/preview.png differ
diff --git a/mesecons_movestones/doc/movestone_sticky/recipe.png b/mesecons_movestones/doc/movestone_sticky/recipe.png
index 55338f4..4ad08d9 100644
Binary files a/mesecons_movestones/doc/movestone_sticky/recipe.png and b/mesecons_movestones/doc/movestone_sticky/recipe.png differ
diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua
index cd82294..b7fb8f1 100644
--- a/mesecons_movestones/init.lua
+++ b/mesecons_movestones/init.lua
@@ -43,10 +43,16 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
local function movestone_move(pos, node, rulename)
local direction = get_movestone_direction(rulename, is_vertical)
local frontpos = vector.add(pos, direction)
+ local meta = minetest.get_meta(pos)
+ local owner = meta:get_string("owner")
-- ### Step 1: Push nodes in front ###
- local success, stack, oldstack = mesecon.mvps_push(frontpos, direction, max_push)
+ local success, stack, oldstack = mesecon.mvps_push(frontpos, direction, max_push, owner)
if not success then
+ if stack == "protected" then
+ meta:set_string("infotext", "Can't move: protected area on the way")
+ return
+ end
minetest.get_node_timer(pos):start(timer_interval)
return
end
@@ -54,15 +60,18 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
-- ### Step 2: Move the movestone ###
minetest.set_node(frontpos, node)
+ local meta2 = minetest.get_meta(frontpos)
+ meta2:set_string("owner", owner)
minetest.remove_node(pos)
mesecon.on_dignode(pos, node)
mesecon.on_placenode(frontpos, node)
minetest.get_node_timer(frontpos):start(timer_interval)
+ minetest.sound_play("movestone", { pos = pos, max_hear_distance = 20, gain = 0.5 }, true)
-- ### Step 3: If sticky, pull stack behind ###
if is_sticky then
local backpos = vector.subtract(pos, direction)
- success, stack, oldstack = mesecon.mvps_pull_all(backpos, direction, max_pull)
+ success, stack, oldstack = mesecon.mvps_pull_all(backpos, direction, max_pull, owner)
if success then
mesecon.mvps_move_objects(backpos, vector.multiply(direction, -1), oldstack, -1)
end
@@ -83,6 +92,16 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
rules = mesecon.rules.default,
}}
+ def.after_place_node = mesecon.mvps_set_owner
+
+ def.on_punch = function(pos, node, player)
+ local player_name = player and player.get_player_name and player:get_player_name()
+ if mesecon.mvps_claim(pos, player_name) then
+ minetest.get_node_timer(pos):start(timer_interval)
+ minetest.chat_send_player(player_name, "Reclaimed movestone")
+ end
+ end
+
def.on_timer = function(pos, elapsed)
local sourcepos = mesecon.is_powered(pos)
if not sourcepos then
diff --git a/mesecons_movestones/mod.conf b/mesecons_movestones/mod.conf
new file mode 100644
index 0000000..9e0cbc1
--- /dev/null
+++ b/mesecons_movestones/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_movestones
+depends = mesecons, mesecons_materials, mesecons_mvps
diff --git a/mesecons_movestones/sounds/movestone.ogg b/mesecons_movestones/sounds/movestone.ogg
new file mode 100644
index 0000000..1910d0c
Binary files /dev/null and b/mesecons_movestones/sounds/movestone.ogg differ
diff --git a/mesecons_movestones/textures/jeija_movestone_arrows.png b/mesecons_movestones/textures/jeija_movestone_arrows.png
index 358c357..e1f2172 100644
Binary files a/mesecons_movestones/textures/jeija_movestone_arrows.png and b/mesecons_movestones/textures/jeija_movestone_arrows.png differ
diff --git a/mesecons_movestones/textures/jeija_movestone_side.png b/mesecons_movestones/textures/jeija_movestone_side.png
index de753ef..971ee76 100644
Binary files a/mesecons_movestones/textures/jeija_movestone_side.png and b/mesecons_movestones/textures/jeija_movestone_side.png differ
diff --git a/mesecons_movestones/textures/jeija_sticky_movestone.png b/mesecons_movestones/textures/jeija_sticky_movestone.png
index 8953cf1..cab3e96 100644
Binary files a/mesecons_movestones/textures/jeija_sticky_movestone.png and b/mesecons_movestones/textures/jeija_sticky_movestone.png differ
diff --git a/mesecons_mvps/depends.txt b/mesecons_mvps/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_mvps/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua
index b8abdd7..3792d26 100644
--- a/mesecons_mvps/init.lua
+++ b/mesecons_mvps/init.lua
@@ -133,31 +133,100 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky)
return nodes
end
-function mesecon.mvps_push(pos, dir, maximum)
- return mesecon.mvps_push_or_pull(pos, dir, dir, maximum)
+function mesecon.mvps_set_owner(pos, placer)
+ local meta = minetest.get_meta(pos)
+ local owner = placer and placer.get_player_name and placer:get_player_name()
+ if owner and owner ~= "" then
+ meta:set_string("owner", owner)
+ else
+ meta:set_string("owner", "$unknown") -- to distinguish from older pistons
+ end
end
-function mesecon.mvps_pull_all(pos, dir, maximum)
- return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum, true)
+function mesecon.mvps_claim(pos, player_name)
+ if not player_name or player_name == "" then return end
+ local meta = minetest.get_meta(pos)
+ if meta:get_string("infotext") == "" then return end
+ if meta:get_string("owner") == player_name then return end -- already owned
+ if minetest.is_protected(pos, player_name) then
+ minetest.chat_send_player(player_name, "Can't reclaim: protected")
+ return
+ end
+ meta:set_string("owner", player_name)
+ meta:set_string("infotext", "")
+ return true
end
-function mesecon.mvps_pull_single(pos, dir, maximum)
- return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum)
+local function add_pos(positions, pos)
+ local hash = minetest.hash_node_position(pos)
+ positions[hash] = pos
end
--- pos: pos of mvps; stackdir: direction of building the stack
+local function are_protected(positions, player_name)
+ local mode = mesecon.setting("mvps_protection_mode", "compat")
+ if mode == "ignore" then
+ return false
+ end
+ local name = player_name
+ if player_name == "" or not player_name then -- legacy MVPS
+ if mode == "normal" then
+ name = "$unknown" -- sentinel, for checking for *any* protection
+ elseif mode == "compat" then
+ return false
+ elseif mode == "restrict" then
+ return true
+ else
+ error("Invalid protection mode")
+ end
+ end
+ local is_protected = minetest.is_protected
+ for _, pos in pairs(positions) do
+ if is_protected(pos, name) then
+ return true
+ end
+ end
+ return false
+end
+
+function mesecon.mvps_push(pos, dir, maximum, player_name)
+ return mesecon.mvps_push_or_pull(pos, dir, dir, maximum, false, player_name)
+end
+
+function mesecon.mvps_pull_all(pos, dir, maximum, player_name)
+ return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum, true, player_name)
+end
+
+function mesecon.mvps_pull_single(pos, dir, maximum, player_name)
+ return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum, false, player_name)
+end
+
+-- pos: pos of mvps
+-- stackdir: direction of building the stack
-- movedir: direction of actual movement
-- maximum: maximum nodes to be pushed
-- all_pull_sticky: All nodes are sticky in the direction that they are pulled from
-function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sticky)
+-- player_name: Player responsible for the action.
+-- - empty string means legacy MVPS, actual check depends on configuration
+-- - "$unknown" is a sentinel for forcing the check
+function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sticky, player_name)
local nodes = mesecon.mvps_get_stack(pos, movedir, maximum, all_pull_sticky)
if not nodes then return end
+
+ local protection_check_set = {}
+ if vector.equals(stackdir, movedir) then -- pushing
+ add_pos(protection_check_set, pos)
+ end
-- determine if one of the nodes blocks the push / pull
for id, n in ipairs(nodes) do
if mesecon.is_mvps_stopper(n.node, movedir, nodes, id) then
return
end
+ add_pos(protection_check_set, n.pos)
+ add_pos(protection_check_set, vector.add(n.pos, movedir))
+ end
+ if are_protected(protection_check_set, player_name) then
+ return false, "protected"
end
-- remove all nodes
@@ -216,8 +285,8 @@ function mesecon.mvps_move_objects(pos, dir, nodestack, movefactor)
end
movefactor = movefactor or 1
dir = vector.multiply(dir, movefactor)
- for id, obj in pairs(minetest.object_refs) do
- local obj_pos = obj:getpos()
+ for id, obj in pairs(minetest.get_objects_inside_radius(pos, #nodestack + 1)) do
+ local obj_pos = obj:get_pos()
local cbox = obj:get_properties().collisionbox
local min_pos = vector.add(obj_pos, vector.new(cbox[1], cbox[2], cbox[3]))
local max_pos = vector.add(obj_pos, vector.new(cbox[4], cbox[5], cbox[6]))
diff --git a/mesecons_mvps/mod.conf b/mesecons_mvps/mod.conf
new file mode 100644
index 0000000..3e34787
--- /dev/null
+++ b/mesecons_mvps/mod.conf
@@ -0,0 +1,2 @@
+name = mesecons_mvps
+depends = mesecons
diff --git a/mesecons_noteblock/depends.txt b/mesecons_noteblock/depends.txt
deleted file mode 100644
index acaa924..0000000
--- a/mesecons_noteblock/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-mesecons
diff --git a/mesecons_noteblock/doc/noteblock/description.html b/mesecons_noteblock/doc/noteblock/description.html
index 729bfe1..e11724d 100644
--- a/mesecons_noteblock/doc/noteblock/description.html
+++ b/mesecons_noteblock/doc/noteblock/description.html
@@ -1,13 +1,13 @@
-This effector makes a sound if powered and can be used for making music. Normally it makes piano sounds. The sound frequency can be changed by punching the block. There are some special sounds that depend on the block below:
+This effector makes a sound if powered and can be used for making music. Normally it makes piano sounds. The sound frequency can be changed by punching the block (only works for piano). There are some special sounds that depend on the block below:
Block Below | Effect |
---|---|
Glass | Hihat |
Stone | Kick |
Chest | Snare |
Tree | Crash |
Glass | Hihat |
Wood | Lite Crash |
Coal Block | Explosion Sound |
Lava Source | Fire Sound |
Steel Block | Raises the pitch by one octave |
Glass or Obsidian Glass | Hi-hat |
Any stone | Kick |
Chest or Locked Chest | Snare |
Any tree | Crash |
Any wooden planks | Lite Crash |
Coal Block | Explosion sound |
Lava Source | Fire sound |
Steel Block | Piano (high pitch, one octave higher than normal) |
Any other block | Piano (low pitch) |