[Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Wed Jan 04, 2012 16:17

Staffs wrote:Oh plus how did you record it ?
I mean with what program. I tried recordmydesktop but it ended with a quite buggy black video :(

I used HyperCam2, but i don't know any good Recording-Program for Linux
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Wed Jan 04, 2012 16:20

Staffs wrote:
sfan5 wrote:Just made a Piston Door: http://youtu.be/MUllePYjscY

I wanted to do that but then i'd have to fatten my house walls :(

Yes, Mesecons should be able to close/open Doors from a Door Mod
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

Karol
New member
 
Posts: 2
Joined: Wed Jan 04, 2012 16:38

by Karol » Wed Jan 04, 2012 16:44

Hello, when I use two emiters and one receiver (all three of them on the same channel) - in other words: OR gate - it not always works correctly. Sometimes one of emiters doesn't activate receiver. What causes this problem? Maybe it's some kind of bug... Hope anybody helps. Thank you in advance.
Last edited by Karol on Wed Jan 04, 2012 16:44, edited 1 time in total.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Jan 04, 2012 18:44

@Karol: To make the mesecon receiver/transmitter system a bit more clear:
The on/off signal is only transmitted to the receiver when the signal at the transmitter changes. This means, that one of the receivers can be turned off although a transmitter seems to be turned on, if the last signal transmitted was an "off" signal.
If this does not refer to your problem, just make sure that the receivers and transmitters are above the same node - I don't expect to use grass/dirt because when grass turns to dirt the channel is not changed.
Redstone for minetest: Mesecons (mesecons.net)
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Wed Jan 04, 2012 18:57

Jeija wrote:@redcrab: I checked the latest git version and it works for me. Could you please post your error?
@Temperest: Nice work! But this can make the game crash when connecting a socket and an inverter. I guess you should make a delay (Minecraft redstone does not have torches/repeaters with delay for no reason)
I will include this in my mod as soon as this is fixed.


I'm sorry, I'm not sure I understand. What kind of configuration causes a crash? Could you post a diagram or example?
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Jan 04, 2012 19:05

1. I connect the plug and the inverter with a mesecon.
Loop
{
2. Power from the inverter is conducted to the plug.
3. The plug sends an "off" signal to the inverter
4. The inverter turns the mesecon off
5. The plug gets a "signal_off" and sends an "on" signal to the inverter
6. The inverter turns the mesecon on
}
--> The server is caught in this infinite loop.
The configure looks like this:
X Plug
| Mesecon
O Inverter
It would be great if you fixed this problem... I will publish a new version of my mod today, with your part disabled by default. I will enable it as soon as it does not make the server crash,
Thanks for your contribution again!
Redstone for minetest: Mesecons (mesecons.net)
 

Karol
New member
 
Posts: 2
Joined: Wed Jan 04, 2012 16:38

by Karol » Wed Jan 04, 2012 19:06

Unfortunately, Jeija, you didn't help. Let me show my problem in other way:

switch1----T
R----- out
switch2----T

,where switch1/2 are switches, Ts are transmitters, R are receivers, - is cable.

Both transmitters and receivers are on the same channel - node under them is the same, for example cobble. This 'circuit' should give out signal, unless both switches are off.
Assume, both switches are off. When I change switch1 to on, I have out signal. Now I change switch1 back to off and switch2 to on. Receiver doesn't get any signal on out.
If I change switch2 as first, problem still exists for switch1.

I hope now you understand what I mean.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Jan 04, 2012 20:11

Update to V 0.4
This new version doesn't really add new features but mainly bugfixes.
- Chests, Locked Chests and Furnaces can't be moved by pistons or movestones
- The near range/object detector only detects players (may be changed... tell me your oppinion)
- Temperest's code added, but turned off by default. You can turn it on by setting ENABLE_TEMPEREST in the init.lua to 1
- Some other bugfixes... I don't remember them all. One of them is that sticky movestones don't turn to normal ones when stopping.
Download link is in the first post above.
Do you have any feature requests? It would be nice if someone drew new textures for wireless_receivers/wireless_inverters/wireless_transmitters

Next Version, 0.41, will maybe add support for conduction through a wall and if it finally works, Temperest's code enabled by default.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Wed Jan 04, 2012 20:38

I'm working on Mese Torches.
Image
Here is my Problem:
If I power the Mese Torch, the Mese Torch turns off
But if I don't power the Mese Torch, the Mese Torch blinks
My Code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_craft({
    output = 'node "jeija_torches:mesecon_torch_off" 4',
    recipe = {
        {'node "jeija:mesecon_off"'},
        {'craft "default:stick"'},
    }
})

minetest.register_node("jeija_torches:mesecon_torch_off", {
    drawtype = "torchlike",
    tile_images = {"jeija_torches_off.png", "jeija_torches_off_ceiling.png", "jeija_torches_off_side.png"},
    inventory_image = "jeija_torches_off.png",
    sunlight_propagates = true,
    walkable = false,
    wall_mounted = true,
    material = minetest.digprop_constanttime(0.5),
})
minetest.register_node("jeija_torches:mesecon_torch_on", {
    drawtype = "torchlike",
    tile_images = {"jeija_torches_on.png", "jeija_torches_on_ceiling.png", "jeija_torches_on_side.png"},
    inventory_image = "jeija_torches_on.png",
    paramtype = "light",
    sunlight_propagates = true,
    walkable = false,
    wall_mounted = true,
    material = minetest.digprop_constanttime(0.5),
    light_source = LIGHT_MAX-5,
    dug_item = 'node "jeija_torches:mesecon_torch_off" 1',
})

mesecon:add_receptor_node("jeija_torches:mesecon_torch_on")
mesecon:add_receptor_node_off("jeija_torches:mesecon_torch_off")

minetest.register_abm({
    nodenames = {"jeija_torches:mesecon_torch_off","jeija_torches:mesecon_torch_on"},
    interval = 0.2,
    chance = 1,
    action = function(pos, node, active_object_count, active_object_count_wider)
        pa = {}
        pa.x = 0
        pa.y = 0
        pa.z = 0
        if node.param2 == 32 then
            pa.z = -1
        end
        if node.param2 == 2 then
            pa.x = -1
        end
        if node.param2 == 8 then
            pa.y = -1
        end
        if node.param2 == 16 then
            pa.z = 1
        end
        if node.param2 == 1 then
            pa.x = 1
        end
        if node.param2 == 4 then
            pa.y = 1
        end
        --print(node.param2 .. "," .. dump(pa))
        local lp = {}
        lp.x = pos.x + pa.x
        lp.y = pos.y + pa.y
        lp.z = pos.z + pa.z
        if mesecon:check_if_turnon(lp) then
            if node.name ~= "jeija_torches:mesecon_torch_off" then
                minetest.env:add_node(pos, {name="jeija_torches:mesecon_torch_off",param2=node.param2})
                mesecon:receptor_off(pos)
            end
        else
            if node.name ~= "jeija_torches:mesecon_torch_on" then
                minetest.env:add_node(pos, {name="jeija_torches:mesecon_torch_on",param2=node.param2})
                mesecon:receptor_on(pos)
            end
        end
    end
})

-- Param2 Table (Block Attached To)
-- 32 = z-1
-- 2 = x-1
-- 16 = z+1
-- 1 = x+1
-- 4 = y+1
-- 8 = y-1

Textures: http://www.mediafire.com/?kqhf1j547b5fv53
Last edited by sfan5 on Wed Jan 04, 2012 20:43, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 20:50

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
00:49:39: ERROR[main]: Failed to load and run script from /home/minetest/minetest/bin/../data/mods/jeija/init.lua:
00:49:39: ERROR[main]: [LUA]
00:49:39: ERROR[main]: [LUA] cannot open ../data/mods/jeija/movestone.lua: No such file or directory
00:49:39: ERROR[main]: stack traceback:
00:49:39: ERROR[main]:  [C]: in function 'dofile'
00:49:39: ERROR[main]:  ...me/minetest/minetest/bin/../data/mods/jeija/init.lua:1618: in main chunk
00:49:39: ERROR[main]: [LUA]
00:49:39: ERROR[main]: Server: Failed to load and run /home/minetest/minetest/bin/../data/mods/jeija/init.lua
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Jan 04, 2012 21:08

This version is supposed to work with a run-in-place installed minetest. Change the paths in the init.lua at dofile() to fit your movestone.lua and temperest.lua. Is there any better way to get the right path by default? I don't want seperate mods for each of the files.
Last edited by Jeija on Wed Jan 04, 2012 21:08, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 21:11

It's a run-in-place version.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 21:26

Ah, I understood. I had to start it throw ./minetestserver, not ./bin/minetestserver
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

Ushiua
New member
 
Posts: 4
Joined: Mon Jan 02, 2012 16:09

by Ushiua » Wed Jan 04, 2012 21:28

It says me "Invalid file handle. Error is 3". Any idees ?

Edit : btw, it also says me that Meseons is loaded...
Last edited by Ushiua on Wed Jan 04, 2012 21:30, edited 1 time in total.
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 21:31

Jeija wrote:Is there any better way to get the right path by default? I don't want seperate mods for each of the files.

The best way is to put everything in one file for now.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Wed Jan 04, 2012 21:37

Jeija wrote:The configure looks like this:
X Plug
| Mesecon
O Inverter
It would be great if you fixed this problem... I will publish a new version of my mod today, with your part disabled by default. I will enable it as soon as it does not make the server crash,
Thanks for your contribution again!


Unfortunately, I have no idea how to fix this one...

So far I've just avoided putting mesecon between the two connectors and it seems to work fine.

I think I'll verify the block between the two is air, and if it isn't the script won't transmit the power. Here's the updated version (this is the entirety of temperest.lua):

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--TEMPEREST-PLUG

minetest.register_node("jeija:mesecon_plug", {
    drawtype = "raillike",
    paramtype = "light",
    is_ground_content = true,
    tile_images = {"jeija_mesecon_plug.png"},
    inventory_image = "jeija_mesecon_plug.png",
    material = minetest.digprop_constanttime(0.1),
    walkable = false,
    selection_box = {
        type = "fixed",
    },
})

mesecon:register_on_signal_on(function(pos, node)
    if node.name=="jeija:mesecon_plug" then
        for x = -1,1 do
        for z = -1,1 do
            lpos = {x=pos.x+(x*2), y=pos.y, z=pos.z+(z*2)} --a node two nodes away from this one
            lnode = minetest.env:get_node(lpos)
        lnode1 = minetest.env:get_node({x=pos.x+x, y=pos.y, z=pos.z+z}) --a node between this node and the one two nodes away
        if lnode1.name=="air" then --the node between the two is empty
        if lnode.name=="jeija:mesecon_socket_off" then
            minetest.env:add_node(lpos, {name="jeija:mesecon_socket_on"})
            nodeupdate(lpos)
            mesecon:receptor_on(lpos)
        elseif lnode.name=="jeija:mesecon_inverter_on" then
            minetest.env:add_node(lpos, {name="jeija:mesecon_inverter_off"})
            nodeupdate(lpos)
            mesecon:receptor_off(lpos)
        end
            end
    end
        end
    end
end)

mesecon:register_on_signal_off(function(pos, node)
    if node.name=="jeija:mesecon_plug" then
        for x = -1,1 do
        for z = -1,1 do
            lpos = {x=pos.x+(x*2), y=pos.y, z=pos.z+(z*2)} --a node two nodes away from this one
            lnode = minetest.env:get_node(lpos)
        lnode1 = minetest.env:get_node({x=pos.x+x, y=pos.y, z=pos.z+z}) --a node between this node and the one two nodes away
        if lnode1.name=="air" then --the node between the two is empty
        if lnode.name=="jeija:mesecon_socket_on" then
            minetest.env:add_node(lpos, {name="jeija:mesecon_socket_off"})
            nodeupdate(lpos)
            mesecon:receptor_off(lpos)
        elseif lnode.name=="jeija:mesecon_inverter_off" then
            minetest.env:add_node(lpos, {name="jeija:mesecon_inverter_on"})
            nodeupdate(lpos)
            mesecon:receptor_on(lpos)
        end
        end
        end
        end
    end
end)

minetest.register_on_dignode(function(pos, oldnode, digger)
    if oldnode.name == "jeija:mesecon_plug" then
        for x = -1,1 do
        for z = -1,1 do
            lpos = {x=pos.x+(x*2), y=pos.y, z=pos.z+(z*2)} --a node two nodes away from this one
            lnode = minetest.env:get_node(lpos)
        lnode1 = minetest.env:get_node({x=pos.x+x, y=pos.y, z=pos.z+z}) --a node between this node and the one two nodes away
        if lnode1.name=="air" then --the node between the two is empty
        if lnode.name=="jeija:mesecon_socket_on" then
            minetest.env:add_node(lpos, {name="jeija:mesecon_socket_off"})
            nodeupdate(lpos)
            mesecon:receptor_off(lpos)
        elseif lnode.name=="jeija:mesecon_inverter_on" then
            minetest.env:add_node(lpos, {name="jeija:mesecon_inverter_off"})
            nodeupdate(lpos)
            mesecon:receptor_off(lpos)
        end
            end
    end
        end
    end
end)


minetest.register_craft({
    output = 'node "jeija:mesecon_plug" 2',
    recipe = {
        {'', 'node "jeija:mesecon_off"', ''},
        {'node "jeija:mesecon_off"', 'craft "default:steel_ingot"', 'node "jeija:mesecon_off"'},
        {'', 'node "jeija:mesecon_off"', ''},
    }
})

--TEMPEREST-SOCKET

minetest.register_node("jeija:mesecon_socket_off", {
    drawtype = "raillike",
    paramtype = "light",
    is_ground_content = true,
    tile_images = {"jeija_mesecon_socket_off.png"},
    inventory_image = "jeija_mesecon_socket_off.png",
    material = minetest.digprop_constanttime(0.1),
    walkable = false,
    selection_box = {
        type = "fixed",
    },
})

minetest.register_node("jeija:mesecon_socket_on", {
    drawtype = "raillike",
    paramtype = "light",
    is_ground_content = true,
    tile_images = {"jeija_mesecon_socket_on.png"},
    inventory_image = "jeija_mesecon_socket_on.png",
    material = minetest.digprop_constanttime(0.1),
    walkable = false,
    selection_box = {
        type = "fixed",
    },
    dug_item='node "jeija:mesecon_socket_off" 1',
})

minetest.register_on_dignode(
    function(pos, oldnode, digger)
        if oldnode.name == "jeija:mesecon_socket_on" then
            mesecon:receptor_off(pos)
        end
    end
)

mesecon:add_receptor_node("jeija:mesecon_socket_on")
mesecon:add_receptor_node_off("jeija:mesecon_socket_off")

minetest.register_craft({
    output = 'node "jeija:mesecon_socket_off" 2',
    recipe = {
        {'', 'craft "default:steel_ingot"', ''},
        {'craft "default:steel_ingot"', 'node "jeija:mesecon_off"', 'craft "default:steel_ingot"'},
        {'', 'craft "default:steel_ingot"', ''},
    }
})

--TEMPEREST-INVERTER

minetest.register_node("jeija:mesecon_inverter_off", {
    drawtype = "raillike",
    paramtype = "light",
    is_ground_content = true,
    tile_images = {"jeija_mesecon_inverter_off.png"},
    inventory_image = "jeija_mesecon_inverter_off.png",
    material = minetest.digprop_constanttime(0.1),
    walkable = false,
    selection_box = {
        type = "fixed",
    },
})

minetest.register_node("jeija:mesecon_inverter_on", {
    drawtype = "raillike",
    paramtype = "light",
    is_ground_content = true,
    tile_images = {"jeija_mesecon_inverter_on.png"},
    inventory_image = "jeija_mesecon_inverter_on.png",
    material = minetest.digprop_constanttime(0.1),
    walkable = false,
    selection_box = {
        type = "fixed",
    },
    dug_item='node "jeija:mesecon_inverter_off" 1',
})

minetest.register_on_dignode(
    function(pos, oldnode, digger)
        if oldnode.name == "jeija:mesecon_inverter_on" then
            mesecon:receptor_off(pos)
        end
    end
)

mesecon:add_receptor_node("jeija:mesecon_inverter_on")
mesecon:add_receptor_node_off("jeija:mesecon_inverter_off")

minetest.register_craft({
    output = 'node "jeija:mesecon_inverter_off" 2',
    recipe = {
        {'node "jeija:mesecon_off"', 'craft "default:steel_ingot"', 'node "jeija:mesecon_off"'},
        {'craft "default:steel_ingot"', '', 'craft "default:steel_ingot"'},
        {'node "jeija:mesecon_off"', 'craft "default:steel_ingot"', 'node "jeija:mesecon_off"'},
    }
})


Thanks for taking the time to review this.

I've also updated the instructions in one of my previous posts here:

http://c55.me/minetest/forum/viewtopic.php?pid=6290#p6290
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Wed Jan 04, 2012 22:06

Jeija wrote:Update to V 0.4
This new version doesn't really add new features but mainly bugfixes.
- Chests, Locked Chests and Furnaces can't be moved by pistons or movestones
- The near range/object detector only detects players (may be changed... tell me your oppinion)
- Temperest's code added, but turned off by default. You can turn it on by setting ENABLE_TEMPEREST in the init.lua to 1
- Some other bugfixes... I don't remember them all. One of them is that sticky movestones don't turn to normal ones when stopping.
Download link is in the first post above.
Do you have any feature requests? It would be nice if someone drew new textures for wireless_receivers/wireless_inverters/wireless_transmitters

Next Version, 0.41, will maybe add support for conduction through a wall and if it finally works, Temperest's code enabled by default.


Great work!

Feature request: pressure plate support for mobs - I can just imagine the rat traps already :). Maybe only for the wooden pressure plate? I think the others should stay as they are.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Jan 04, 2012 22:07

This won't work. What happens if you dont directly connect plug and receiver? Like this:
X__
|
O__|

In my oppinion a delay still is the best solution.

Pressure plates should already work for mobs.
Last edited by Jeija on Wed Jan 04, 2012 22:09, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Wed Jan 04, 2012 22:09

Jeija wrote:This won't work. What happens if you dont directly connect plug and receiver? Like this:
X__
|
O__|


hmm... I didn't think of that.

Do you have any suggestions? I can't think of another way to make it work.

Edit: sorry, didn't read your entire post. How do you use delays?
Last edited by Temperest on Wed Jan 04, 2012 22:09, edited 1 time in total.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Wed Jan 04, 2012 22:14

You should create a global timer and set a requested state and a request time for each of these blocks. After a certain time the action is performed.
I guess a short delay will also do it, like 0.2 seconds or so. Use the on_globalstep function for timer.
Last edited by Jeija on Wed Jan 04, 2012 22:14, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Thu Jan 05, 2012 06:32

@Sfan5:
This code should work:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_craft({
    output = 'node "jeija:mesecon_torch_off" 4',
    recipe = {
        {'node "jeija:mesecon_off"'},
        {'craft "default:stick"'},
    }
})

minetest.register_node("jeija:mesecon_torch_off", {
    drawtype = "torchlike",
    tile_images = {"jeija_torches_off.png", "jeija_torches_off_ceiling.png", "jeija_torches_off_side.png"},
    inventory_image = "jeija_torches_off.png",
    sunlight_propagates = true,
    walkable = false,
    wall_mounted = true,
    material = minetest.digprop_constanttime(0.5),
})
minetest.register_node("jeija:mesecon_torch_on", {
    drawtype = "torchlike",
    tile_images = {"jeija_torches_on.png", "jeija_torches_on_ceiling.png", "jeija_torches_on_side.png"},
    inventory_image = "jeija_torches_on.png",
    paramtype = "light",
    sunlight_propagates = true,
    walkable = false,
    wall_mounted = true,
    material = minetest.digprop_constanttime(0.5),
    light_source = LIGHT_MAX-5,
    dug_item = 'node "jeija:mesecon_torch_off" 1',
})

mesecon:add_receptor_node("jeija:mesecon_torch_on")
mesecon:add_receptor_node_off("jeija:mesecon_torch_off")

minetest.register_abm({
    nodenames = {"jeija:mesecon_torch_off","jeija:mesecon_torch_on"},
    interval = 0.2,
    chance = 1,
    action = function(pos, node, active_object_count, active_object_count_wider)
        pa = {x=0, y=0, z=0}
        if node.param2 == 32 then
            pa.z = -1
        end
        if node.param2 == 2 then
            pa.x = -1
        end
        if node.param2 == 8 then
            pa.y = -1
        end
        if node.param2 == 16 then
            pa.z = 1
        end
        if node.param2 == 1 then
            pa.x = 1
        end
        if node.param2 == 4 then
            pa.y = 1
        end
        if mesecon:is_power_on(pos, pa.x, pa.y, pa.z)==1 then
            if node.name ~= "jeija:mesecon_torch_off" then
                minetest.env:add_node(pos, {name="jeija:mesecon_torch_off",param2=node.param2})
                mesecon:receptor_off({x=pos.x-pa.x, y=pos.y-pa.y, z=pos.z-pa.z})
            end
        else
            if node.name ~= "jeija:mesecon_torch_on" then
                minetest.env:add_node(pos, {name="jeija:mesecon_torch_on",param2=node.param2})
                mesecon:receptor_on({x=pos.x-pa.x, y=pos.y-pa.y, z=pos.z-pa.z})
            end
        end
    end
})


Unfortunately, it only checks for the block it is connected to, so this has to be a mesecon or a receptor. It would be amazing if you changed that. I will include this in my mod if you agree.
Last edited by Jeija on Thu Jan 05, 2012 06:33, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
xyz
Member
 
Posts: 449
Joined: Thu Nov 10, 2011 14:25

by xyz » Thu Jan 05, 2012 06:57

Use minetest.get_modpath('modname')
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu Jan 05, 2012 07:11

Jeija wrote:@Sfan5:
This code should work:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_craft({
    output = 'node "jeija:mesecon_torch_off" 4',
    recipe = {
        {'node "jeija:mesecon_off"'},
        {'craft "default:stick"'},
    }
})

minetest.register_node("jeija:mesecon_torch_off", {
    drawtype = "torchlike",
    tile_images = {"jeija_torches_off.png", "jeija_torches_off_ceiling.png", "jeija_torches_off_side.png"},
    inventory_image = "jeija_torches_off.png",
    sunlight_propagates = true,
    walkable = false,
    wall_mounted = true,
    material = minetest.digprop_constanttime(0.5),
})
minetest.register_node("jeija:mesecon_torch_on", {
    drawtype = "torchlike",
    tile_images = {"jeija_torches_on.png", "jeija_torches_on_ceiling.png", "jeija_torches_on_side.png"},
    inventory_image = "jeija_torches_on.png",
    paramtype = "light",
    sunlight_propagates = true,
    walkable = false,
    wall_mounted = true,
    material = minetest.digprop_constanttime(0.5),
    light_source = LIGHT_MAX-5,
    dug_item = 'node "jeija:mesecon_torch_off" 1',
})

mesecon:add_receptor_node("jeija:mesecon_torch_on")
mesecon:add_receptor_node_off("jeija:mesecon_torch_off")

minetest.register_abm({
    nodenames = {"jeija:mesecon_torch_off","jeija:mesecon_torch_on"},
    interval = 0.2,
    chance = 1,
    action = function(pos, node, active_object_count, active_object_count_wider)
        pa = {x=0, y=0, z=0}
        if node.param2 == 32 then
            pa.z = -1
        end
        if node.param2 == 2 then
            pa.x = -1
        end
        if node.param2 == 8 then
            pa.y = -1
        end
        if node.param2 == 16 then
            pa.z = 1
        end
        if node.param2 == 1 then
            pa.x = 1
        end
        if node.param2 == 4 then
            pa.y = 1
        end
        if mesecon:is_power_on(pos, pa.x, pa.y, pa.z)==1 then
            if node.name ~= "jeija:mesecon_torch_off" then
                minetest.env:add_node(pos, {name="jeija:mesecon_torch_off",param2=node.param2})
                mesecon:receptor_off({x=pos.x-pa.x, y=pos.y-pa.y, z=pos.z-pa.z})
            end
        else
            if node.name ~= "jeija:mesecon_torch_on" then
                minetest.env:add_node(pos, {name="jeija:mesecon_torch_on",param2=node.param2})
                mesecon:receptor_on({x=pos.x-pa.x, y=pos.y-pa.y, z=pos.z-pa.z})
            end
        end
    end
})


Unfortunately, it only checks for the block it is connected to, so this has to be a mesecon or a receptor. It would be amazing if you changed that. I will include this in my mod if you agree.

Thanks for helping, I'll change it and then you can include it.
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Melkor
Member
 
Posts: 285
Joined: Sat Sep 24, 2011 01:03

by Melkor » Thu Jan 05, 2012 08:31

(using minetest-0.4.dev-20120102 and mesecons V 0.4)

pistons are a bit "jumpy", sometimes they go inside of the pushed block (looks ugly but work), other times they go through the block without pushing it

Image

in some cases it generates a "ghost piston" that cannot be removed

Image

another thing I find strange is that it seems that water and lava can be pushed, if we put a sticky piston and a block in the water, we can push the block, but is not possible recover it, seems as if the water took his place, pistons works wierd in water

if something is misspelled, sorry I haven't slept yet, and google translator is not a great help
Last edited by Melkor on Thu Jan 05, 2012 08:32, edited 1 time in total.
 

hijera
Member
 
Posts: 36
Joined: Sun Jun 19, 2011 13:04

by hijera » Thu Jan 05, 2012 08:41

v. 0.4 doesn't work on newest server (sources from 4 jan 2011 ) - it just won't start.
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Thu Jan 05, 2012 08:50

hijera wrote:v. 0.4 doesn't work on newest server (sources from 4 jan 2011 ) - it just won't start.

That's because of bad mod path. He has to use xyz's advice.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Thu Jan 05, 2012 09:25

I'm already using xyz's code, but I haven't published it yet. I will publish it today or tomorrow; I would like to include sfan5's buttons.
@Melkor: This may happen on slow PCs. This happens because minetest doesn't call the on_step of an entity that often, so that I cannot set a certain position for the pusher (maybe I will change that to another system, but I don't think so). You can just remove the animation if you want to.
I never had a piston that had an animation but doesn't push the block. This should only happen when trying to push a chest/a furnace.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
Melkor
Member
 
Posts: 285
Joined: Sat Sep 24, 2011 01:03

by Melkor » Thu Jan 05, 2012 10:20

thanks, that was one of the possibilities I thought. Water seem to be can be pushed by pistons, is the same thing? I can push blocks underwater at a distance as if I could use telekinesis
 

Zarberman
Member
 
Posts: 24
Joined: Mon Dec 19, 2011 16:38

by Zarberman » Thu Jan 05, 2012 19:12

i like zips
my website (still in testing) www.gameri.webs.com
 

Zarberman
Member
 
Posts: 24
Joined: Mon Dec 19, 2011 16:38

by Zarberman » Thu Jan 05, 2012 19:14

but the download never works for me. please help
my website (still in testing) www.gameri.webs.com
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 45 guests

cron