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

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 08:21

Get the latest code from Github, sfan5. The rules are not working yet for some reason, but it should be a good starting point for you,..
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 08, 2012 08:41

Jeija wrote:Get the latest code from Github, sfan5. The rules are not working yet for some reason, but it should be a good starting point for you,..

I'll first work on Buttons ^^
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi

by IPushButton2653 » Sun Jan 08, 2012 08:44

Did some testing with pistons and wiring. If this does evolve, I could really make a nice dungeon with puzzles and death traps ^^
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 08:48

There are lots of possibilities in this mod... There are like 5 ways to do the same thing ^^ There are 3 different inverters eg. ;
I'm not sure if that is good or if an easy method with only a few parts (like in minecraft) was better...
I will try to implement Basto's code as soon as possible, I can also give you the permission to implement it on github if you want (Or anyone else can also implement it). Please just ask me for the permission on github here!!

@Sfan5: Would be awesome if you made a global timer for the buttons. Just set a requested state for each button and a time when the state will be changed. Try to save it in param1/2 or so. I would also need the global timer for your mesecon torches
Last edited by Jeija on Sun Jan 08, 2012 08:52, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi

by IPushButton2653 » Sun Jan 08, 2012 08:52

I just want it to be finished so I can make some traps and challenges. I have an idea for a room, but it won't be possible until can find people to help me
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 08:54

I will upload a video of a giant self-building bridge soon. It has 3 floors: One for cars, one for trains and one for pedestrians. Just have to wait for my classmate to render the vid. It is possible using this mod and the nyanland mod.
Last edited by Jeija on Sun Jan 08, 2012 08:55, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi

by IPushButton2653 » Sun Jan 08, 2012 09:00

I'm making a room that the floor dissappears when you walk on it
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 09:06

That should not be too difficult. Just use an object detector and a Mesecon network under the removestone floor.
Btw, I love this idea, Basto:
object detectors on top of sings should only activate if player, which name is on the sign, is near to the detector
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi

by IPushButton2653 » Sun Jan 08, 2012 09:16

If I can make it work, it will be awesome
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 09:38

Amazing!! Good job!
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 08, 2012 09:46

Just fixed the Rotating-Switch-Bug! :)
It was param1 not param2.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jordach
Member
 
Posts: 4518
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Sun Jan 08, 2012 09:49


@Jordach: That sounds really interesting. If you like I would be willing to help with that. I've always wanted to try my hand at something more than an adder :).


yup I'm learning from mc vids.
viewtopic.php?f=10&t=19056 Solar Plains Dev Server
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 10:02

NIce sfan5, thx for fixing. I once tried param1 myself, but it didn't work back then :( Maybe I made a small mistake or so. NIce to know that btw.
I guess, sfan5, you should make different mesecon rules for buttons. Just put them in the get_rules function (I will maybe add a add_rules function when I have more time). Just look at the mesecon torch code for this.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 08, 2012 11:19

Jeija wrote:NIce sfan5, thx for fixing. I once tried param1 myself, but it didn't work back then :( Maybe I made a small mistake or so. NIce to know that btw.
I guess, sfan5, you should make different mesecon rules for buttons. Just put them in the get_rules function (I will maybe add a add_rules function when I have more time). Just look at the mesecon torch code for this.

Ok, I'll make a different Mesecon-Rule for buttons.
Done: https://github.com/Jeija/minetest-mod-mesecons/commit/0e3d6e95f5c29b88d6b6f1ea889c974163ebc2ee
Last edited by sfan5 on Sun Jan 08, 2012 11:49, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

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

by hijera » Sun Jan 08, 2012 15:50

what's about and/or/not/xor blocks? It's possible to make logical structures using invertor, but it become so bulky then
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 18:48

Some changes on github, check them out.
e.g. object detectors above signs indicate the player name on the sign and new mesecon button rules. Also splitted files (I'll continue doing that, so commiting will be easier)
@Sfan5: How do I delete the README~ file? I have no idea...

@hijera: These blocks would be possible, but I can't do them myself (simply don't have time). If you or someone else wants to do that, just commit it.
Last edited by Jeija on Sun Jan 08, 2012 18:49, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 08, 2012 19:32

Jeija wrote:Some changes on github, check them out.
e.g. object detectors above signs indicate the player name on the sign and new mesecon button rules. Also splitted files (I'll continue doing that, so commiting will be easier)
@Sfan5: How do I delete the README~ file? I have no idea...

@hijera: These blocks would be possible, but I can't do them myself (simply don't have time). If you or someone else wants to do that, just commit it.

"git rm README~" should work
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Sun Jan 08, 2012 19:39

didnt work. gonna retry tomorow and post the error if still not working
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 08, 2012 20:55

My Commits disappeared. I can't see them under Commits! :O
Last edited by sfan5 on Sun Jan 08, 2012 20:57, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

Baŝto
New member
 
Posts: 9
Joined: Fri Jan 06, 2012 13:46
Location: Hesse

by Baŝto » Sun Jan 08, 2012 22:44

Jeija: Am I allowed to use your code for a mod/fix?

I'll try to rebuild corefunctions from scratch.
My targets for this project:
  • flipflops and oscillator should be impossible (instead special nodes for that: blinky plant and a d-flipflop consisting of 3 blocks)
  • electricity flows from input to output
  • circuit without abm

I'll use inputs/outputs and 'virtual' input/outputs (forks, inverters ...)
Every 'input'-node knows all 'output'-nodes, which state is dependant on that node. (maximum of 6)
Every node know the flow-directions of each side: comes/goes/none.
the calculation of the flowdirection could take a while, have to use accumulators to avoid oscillators.
(only finds the next 'input' the rest of the circuit is not important)
The flow of electricity needs only the 'i/o'-nodes ... the rest is just 'decoration'.

In big circuits it'll never happen that the whole circuit must be recalculated!

And I would call the inverters esem-blocks (mese reversed)


… and don't wait for that, could take a while.
 

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

by Temperest » Sun Jan 08, 2012 23:21

Jeija wrote:For the adder: Make sure that the whole machine is in a close radius, like 30 blocks away. Unfortunately, if mesecon circuits are farer away, minetest doesn't simulate them.
@Temperest: Looks awesome! I can add you to git if you give me your name... Else, just post it here.


Is there anything that can be done about the 30 block limitation? I ran into this too when I put a flashing light on top of a tall tower.

Oh, my username at GitHub is Uberi.

And, as promised, the updated code:

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
        local set_node_on = function(pos)
        node = minetest.env:get_node(pos)
        if node.name=="jeija:mesecon_socket_off" then
            minetest.env:add_node(pos, {name="jeija:mesecon_socket_on"})
            nodeupdate(pos)
            mesecon:receptor_on(pos)
        elseif node.name=="jeija:mesecon_inverter_on" then
            minetest.env:add_node(pos, {name="jeija:mesecon_inverter_off"})
            nodeupdate(pos)
            mesecon:receptor_off(pos)
        end
    end

    lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_on({x=pos.x-2, y=pos.y, z=pos.z}) end

    lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_on({x=pos.x+2, y=pos.y, z=pos.z}) end

    lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_on({x=pos.x, y=pos.y, z=pos.z-2}) end

    lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_on({x=pos.x-2, y=pos.y, z=pos.z+2}) end
    end
end)

mesecon:register_on_signal_off(function(pos, node)
    if node.name=="jeija:mesecon_plug" then
    local set_node_off = function(pos)
        node = minetest.env:get_node(pos)
        if node.name=="jeija:mesecon_socket_on" then
            minetest.env:add_node(pos, {name="jeija:mesecon_socket_off"})
            nodeupdate(pos)
            mesecon:receptor_off(pos)
        elseif node.name=="jeija:mesecon_inverter_off" then
            minetest.env:add_node(pos, {name="jeija:mesecon_inverter_on"})
            nodeupdate(pos)
            mesecon:receptor_on(pos)
        end
    end

    lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_off({x=pos.x-2, y=pos.y, z=pos.z}) end

    lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_off({x=pos.x+2, y=pos.y, z=pos.z}) end

    lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_off({x=pos.x, y=pos.y, z=pos.z-2}) end

    lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_off({x=pos.x-2, y=pos.y, z=pos.z+2}) end
    end
end)

minetest.register_on_dignode(function(pos, oldnode, digger)
    if oldnode.name == "jeija:mesecon_plug" then
    local set_node_deactivated = function(pos)
        node = minetest.env:get_node(pos)
        if node.name=="jeija:mesecon_socket_on" then
            minetest.env:add_node(pos, {name="jeija:mesecon_socket_off"})
            nodeupdate(pos)
            mesecon:receptor_off(pos)
        elseif node.name=="jeija:mesecon_inverter_on" then
            minetest.env:add_node(pos, {name="jeija:mesecon_inverter_off"})
            nodeupdate(pos)
            mesecon:receptor_off(pos)
        end
    end

    lnode = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_deactivated({x=pos.x-2, y=pos.y, z=pos.z}) end

    lnode = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_deactivated({x=pos.x+2, y=pos.y, z=pos.z}) end

    lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_deactivated({x=pos.x, y=pos.y, z=pos.z-2}) end

    lnode = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) --a node between this node and the one two nodes away
    if lnode.name=="air" then set_node_deactivated({x=pos.x-2, y=pos.y, z=pos.z+2}) 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"'},
    }
})


Still could not get timers to work :/. This version does without it. Remember not to connect plugs to inverters directly, or MineTest may crash.

Will look into it.
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
Location: Nürtingen, Germany

by Jeija » Mon Jan 09, 2012 12:07

@Sfan5: I guess that happened because i had to --force the upload (I forgot to pull and didn't want to push). Well, I'm just new to git...
@Basto: yep, just use it
@Temperest: I added you on git, please commit your code.

If any code can make the server crash, please disable it using a setting variable please!
(Like it already is with Temperest's awesome commit. It says TEMPEREST_ENABLE=0 in init.lua)
Please also use Tabs for syntax and not spaces if possible.

Is there anything that can be done about the 30 block limitation? I ran into this too when I put a flashing light on top of a tall tower.

Any c++ dev know this?
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Moderator
 
Posts: 3772
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Mon Jan 09, 2012 13:02

Jeija wrote:@Sfan5: I guess that happened because i had to --force the upload (I forgot to pull and didn't want to push). Well, I'm just new to git...

That not the Sense of Git
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46
Location: Nürtingen, Germany

by Jeija » Mon Jan 09, 2012 13:37

I know and I found out later, but as I said I just don't know much about it. In fact, your code is in the patch, I just cloned to another directory. I hope this won't happen again.
I added you, Basto.
Redstone for minetest: Mesecons (mesecons.net)
 

PreviousNext

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 6 guests