Compare commits

...

8 Commits

Author SHA1 Message Date
loosewheel
51ab3bdc3c Add files via upload 2022-02-05 02:14:40 +10:00
loosewheel
f873bb551f Add files via upload 2022-02-05 02:08:42 +10:00
loosewheel
326275cea6 Add files via upload 2022-02-05 02:07:16 +10:00
loosewheel
f869a4c40b Add files via upload 2022-02-05 02:05:18 +10:00
loosewheel
37488db8b9 Add files via upload 2022-02-05 02:04:35 +10:00
loosewheel
cf54a3d548 Add files via upload 2022-02-05 02:03:48 +10:00
loosewheel
9519eae026 Add files via upload 2022-01-20 17:58:09 +10:00
loosewheel
5caa7b6408 Add files via upload 2022-01-08 20:03:32 +10:00
8 changed files with 136 additions and 13 deletions

View File

@@ -87,3 +87,14 @@ v0.1.14
v0.1.15 v0.1.15
* Fixed bug call to clear_map in fan on_blast. * Fixed bug call to clear_map in fan on_blast.
* Added pistons. * Added pistons.
v0.1.16
* Fixed piston interaction with non-walkable nodes.
v0.1.17
* Fixed unintended global variable in pistons.lua.
v0.1.18
* Added mesecons through wire.

View File

@@ -49,7 +49,21 @@ minetest.register_craft( {
{ "default:iron_lump", "default:coalblock" }, { "default:iron_lump", "default:coalblock" },
}, },
}) })
end end -- minetest.global_exists ("fire")
if utils.mesecon_supported then
minetest.register_craft( {
output = "lwcomponents:through_wire_off 2",
recipe = {
{ "", "mesecons:wire_00000000_off" },
{ "mesecons:wire_00000000_off", "" },
},
})
end -- utils.mesecon_supported

7
docs/through_wire.txt Normal file
View File

@@ -0,0 +1,7 @@
Mesecons Through Wire
---------------------
* This block is only available if mesecons is loaded.
Will transmit mesecons power when placed one to two blocks apart opposing
each other, through solid blocks or open space. Can also be used as a mesecons
crossover.

View File

@@ -1,4 +1,4 @@
local version = "0.1.15" local version = "0.1.18"
local mod_storage = minetest.get_mod_storage () local mod_storage = minetest.get_mod_storage ()
@@ -35,6 +35,7 @@ loadfile (modpath.."/conduit.lua") (utils, mod_storage)
loadfile (modpath.."/cannon.lua") (utils) loadfile (modpath.."/cannon.lua") (utils)
loadfile (modpath.."/cannon_shell.lua") (utils) loadfile (modpath.."/cannon_shell.lua") (utils)
loadfile (modpath.."/pistons.lua") (utils) loadfile (modpath.."/pistons.lua") (utils)
loadfile (modpath.."/through_wire.lua") (utils)
loadfile (modpath.."/extras.lua") (utils) loadfile (modpath.."/extras.lua") (utils)
loadfile (modpath.."/digiswitch.lua") (utils) loadfile (modpath.."/digiswitch.lua") (utils)
loadfile (modpath.."/movefloor.lua") (utils) loadfile (modpath.."/movefloor.lua") (utils)

View File

@@ -13,6 +13,8 @@ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
See the GNU Lesser General Public License for more details: See the GNU Lesser General Public License for more details:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
Mesecons through wire code was adapted from mesecons_receiver.
lwsiren-buzz.ogg lwsiren-buzz.ogg

View File

@@ -52,7 +52,7 @@ local function push_entities (pos, vec)
if tnode.name == "air" then if tnode.name == "air" then
can_move = true can_move = true
else else
tdef = utils.find_item_def (tnode.name) local tdef = utils.find_item_def (tnode.name)
can_move = tdef and not tdef.walkable can_move = tdef and not tdef.walkable
end end
@@ -94,7 +94,9 @@ local function push_nodes (pos, extent)
return false return false
end end
if tnode.name == "air" then local tdef = utils.find_item_def (tnode.name)
if tnode.name == "air" or (tdef and not tdef.walkable) then
count = i - 1 count = i - 1
break break
end end
@@ -150,8 +152,10 @@ local function pull_node (pos, extent)
local vec = direction_vector (node) local vec = direction_vector (node)
local cpos = vector.add (pos, vector.multiply (vec, extent)) local cpos = vector.add (pos, vector.multiply (vec, extent))
local cnode = utils.get_far_node (cpos) local cnode = utils.get_far_node (cpos)
local cdef = cnode and utils.find_item_def (cnode.name)
if cnode and cnode.name ~= "air" and cdef and cdef.walkable then
if cnode and cnode ~= "air" then
local cmeta = minetest.get_meta (cpos) local cmeta = minetest.get_meta (cpos)
if cmeta then if cmeta then
@@ -182,8 +186,11 @@ local function place_blank (pos, extent)
local vec = direction_vector (node) local vec = direction_vector (node)
local blank_pos = vector.add (pos, vector.multiply (vec, extent)) local blank_pos = vector.add (pos, vector.multiply (vec, extent))
local blank_node = utils.get_far_node (blank_pos) local blank_node = utils.get_far_node (blank_pos)
local blank_def = blank_node and utils.find_item_def (blank_node.name)
if blank_node and blank_node.name == "air" or
(blank_def and not blank_def.walkable) then
if blank_node and blank_node.name == "air" then
minetest.set_node (blank_pos, minetest.set_node (blank_pos,
{ {
name = "lwcomponents:piston_blank_"..tostring (extent), name = "lwcomponents:piston_blank_"..tostring (extent),
@@ -680,7 +687,7 @@ minetest.register_node("lwcomponents:piston_blank_2", {
minetest.register_node("lwcomponents:piston", { minetest.register_node("lwcomponents:piston", {
description = S("Piston"), description = S("Double Piston"),
tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png", tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png",
"lwcomponents_piston_right.png", "lwcomponents_piston_left.png", "lwcomponents_piston_right.png", "lwcomponents_piston_left.png",
"lwcomponents_piston_base.png", "lwcomponents_piston_pusher.png" }, "lwcomponents_piston_base.png", "lwcomponents_piston_pusher.png" },
@@ -710,7 +717,7 @@ minetest.register_node("lwcomponents:piston", {
minetest.register_node("lwcomponents:piston_1", { minetest.register_node("lwcomponents:piston_1", {
description = S("Piston"), description = S("Double Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_normal_1.obj", mesh = "piston_normal_1.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },
@@ -757,7 +764,7 @@ minetest.register_node("lwcomponents:piston_1", {
minetest.register_node("lwcomponents:piston_2", { minetest.register_node("lwcomponents:piston_2", {
description = S("Piston"), description = S("Double Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_normal_2.obj", mesh = "piston_normal_2.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },
@@ -804,7 +811,7 @@ minetest.register_node("lwcomponents:piston_2", {
minetest.register_node("lwcomponents:piston_sticky", { minetest.register_node("lwcomponents:piston_sticky", {
description = S("Sticky Piston"), description = S("Double Sticky Piston"),
tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png", tiles = { "lwcomponents_piston_top.png", "lwcomponents_piston_bottom.png",
"lwcomponents_piston_right.png", "lwcomponents_piston_left.png", "lwcomponents_piston_right.png", "lwcomponents_piston_left.png",
"lwcomponents_piston_base.png", "lwcomponents_piston_pusher_sticky.png" }, "lwcomponents_piston_base.png", "lwcomponents_piston_pusher_sticky.png" },
@@ -834,7 +841,7 @@ minetest.register_node("lwcomponents:piston_sticky", {
minetest.register_node("lwcomponents:piston_sticky_1", { minetest.register_node("lwcomponents:piston_sticky_1", {
description = S("Sticky Piston"), description = S("Double Sticky Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_sticky_1.obj", mesh = "piston_sticky_1.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },
@@ -881,7 +888,7 @@ minetest.register_node("lwcomponents:piston_sticky_1", {
minetest.register_node("lwcomponents:piston_sticky_2", { minetest.register_node("lwcomponents:piston_sticky_2", {
description = S("Sticky Piston"), description = S("Double Sticky Piston"),
drawtype = "mesh", drawtype = "mesh",
mesh = "piston_sticky_2.obj", mesh = "piston_sticky_2.obj",
tiles = { "lwcomponents_piston.png" }, tiles = { "lwcomponents_piston.png" },

View File

@@ -13,7 +13,7 @@ CC BY-SA 3.0
Version Version
======= =======
0.1.15 0.1.18
Minetest Version Minetest Version
@@ -66,6 +66,7 @@ Various components for mesecons and digilines.
* Double (optionally single) reach pistons and sticky pistons. * Double (optionally single) reach pistons and sticky pistons.
* Digiswitch, digilines controlled mesecons power. * Digiswitch, digilines controlled mesecons power.
* Movefloor, similar to vertical mesecons movestone. * Movefloor, similar to vertical mesecons movestone.
* Mesecons Through Wire, transmits through 1 to 2 solid blocks.
* Solid color conductor blocks, same as Solid Color Block but also mesecons * Solid color conductor blocks, same as Solid Color Block but also mesecons
and digilines conductor. and digilines conductor.

80
through_wire.lua Normal file
View File

@@ -0,0 +1,80 @@
local utils = ...
local S = utils.S
if utils.mesecon_supported then
local through_wire_get_rules = function (node)
local rules = { {x = -1, y = 0, z = 0},
{x = 2, y = 0, z = 0},
{x = 3, y = 0, z = 0} }
if node.param2 == 2 then
rules = mesecon.rotate_rules_left(rules)
elseif node.param2 == 3 then
rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
elseif node.param2 == 0 then
rules = mesecon.rotate_rules_right(rules)
end
return rules
end
mesecon.register_node ("lwcomponents:through_wire", {
description = S("Mesecons Through Wire"),
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
on_rotate = false,
selection_box = {
type = "fixed",
fixed = { -3/16, -8/16, -8/16, 3/16, 3/16, 8/16 }
},
node_box = {
type = "fixed",
fixed = {
{ -3/16, -3/16, 13/32 , 3/16, 3/16 , 8/16 }, -- the smaller bump
{ -1/32, -1/32, 1/2 , 1/32, 1/32 , 3/2 }, -- the wire through the block
{ -2/32, -1/2 , 0.5002-3/32 , 2/32, 0 , 0.5 }, -- the vertical wire bit
{ -2/32, -1/2 , -16/32+0.001 , 2/32, -14/32, 7/16+0.002 } -- the horizontal wire
}
},
drop = "lwcomponents:through_wire_off",
sounds = default.node_sound_defaults(),
}, {
tiles = { "mesecons_wire_off.png" },
groups = { dig_immediate = 3 },
mesecons = {
conductor = {
state = mesecon.state.off,
rules = through_wire_get_rules,
onstate = "lwcomponents:through_wire_on"
}
}
}, {
tiles = { "mesecons_wire_on.png" },
groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
mesecons = {
conductor = {
state = mesecon.state.on,
rules = through_wire_get_rules,
offstate = "lwcomponents:through_wire_off"
}
}
})
end -- utils.mesecon_supported
--