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

Post Reply
Gatharoth
Member
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Post

Jeija, in seeing pressure pads, I was thinking of adding a "portable" button. Wall mounted. So would this be the proper code, or would I need to add something else to it?

Code: Select all

minetest.register_node("jeija:wall_button", {
    drawtype = "signlike",
    tile_images = {"jeija_wall_button.png"},
    inventory_image = "jeija_wall_button.png",
    paramtype = "light",
    is_ground_content = false,
    walkable = false,
    selection_box = {
        type = "fixed",
    },
    material = minetest.digprop_constanttime(0.3),
})

minetest.register_on_dignode(
    function(pos, oldnode, digger)
        if oldnode.name == "jeija:wall_button" then
            mesecon:receptor_off(pos, "wallbutton")
        end    
    end
)
minetest.register_on_punchnode(function(pos, node, puncher)
    if node.name == "jeija:wall_button" then
        minetest.env:remove_node(pos)
        minetest.env:add_node(pos, {name="jeija:wall_button_off})
        nodeupdate(pos)
        mesecon:receptor_off(pos)
    end
end)
mesecon:add_receptor_node("jeija:wall_button")
(note: off version will be applied also. And I would need to make another rule set for the wall_button correct?)

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

by Jeija » Post

Yeah, you should make another rule for that. Let me check that out in a few minutes... You should also use an on-state and an off-state button. Unfortunately the button won't look good :(, there is no special drawtype for it. You could use something like signs for example.
Redstone for minetest: Mesecons (mesecons.net)

Gatharoth
Member
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Post

Jeija wrote:Yeah, you should make another rule for that. Let me check that out in a few minutes... You should also use an on-state and an off-state button. Unfortunately the button won't look good :(, there is no special drawtype for it. You could use something like signs for example.
There will be an on/off state, didn't you read the note at the end? XP

Why do you think the button won't look good? Because it has no special drawtype for it? And yeah, I would be using the sign drawtype.

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

by Jeija » Post

It will be a 2d button. I guess it is better to use a global timer for stuff like this than using an abm, so that the time a button stays pressed is always the same.
Redstone for minetest: Mesecons (mesecons.net)

Gatharoth
Member
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Post

Jeija wrote:It will be a 2d button. I guess it is better to use a global timer for stuff like this than using an abm, so that the time a button stays pressed is always the same.
I wasn't thinking of a timed button, more like a portable version of your switch. So its either on, or its off. Not giving it a short lifespan to generate power.

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

by Jeija » Post

I think we need something like a button with a short span to generate power...
Redstone for minetest: Mesecons (mesecons.net)

Gatharoth
Member
Posts: 196
Joined: Thu Dec 22, 2011 02:54

by Gatharoth » Post

Alright. But I haven't worked with global timer yet, so I'd pretty but be blind shooting XD

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

by Baŝto » Post

Karol wrote: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.
[…]

I had that problem when I tried to build a D-Flipflop, too.

You have to change the minetest.register_abm in line 1415… change every "wlre.requested_state==1" to a "wlre.requested_state>0"


And the function mesecon:wireless_transmit (line 1557) must be changed, too.

Code: Select all

function mesecon:wireless_transmit(channel, senderstate)
    local i = 1
    while mesecon.wireless_receivers[i]~=nil do
        if mesecon.wireless_receivers[i].channel==channel then
            if senderstate==1 then
                mesecon.wireless_receivers[i].requested_state=mesecon.wireless_receivers[i].requested_state+1
                print (mesecon.wireless_receivers[i].requested_state)
            elseif senderstate==0 then
                mesecon.wireless_receivers[i].requested_state=mesecon.wireless_receivers[i].requested_state-1
                if mesecon.wireless_receivers[i].requested_state<0 then
                    mesecon.wireless_receivers[i].requested_state=0
                end
                print (mesecon.wireless_receivers[i].requested_state)
            end
        end
        i=i+1
    end
end
With that code you are able to build complex circuits consisting of wires, OR-, NOT- and NOR-gates.

You can build an AND-gate (A*B) with inverted inputs and a NOR-gate ( ¬(¬A + ¬B) )

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

by Jeija » Post

Great work! I'm just not sure if I should keep the current system or implement yours. Maybe I will make a configuration option for this and set yours by default. Thx!
Redstone for minetest: Mesecons (mesecons.net)

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

by sfan5 » Post

@Jeija:
I can't get the Mese-Torches working.
Maybe you should add the Torches how they are, but it's a bit ugly if you place a torch on a mesecon
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 » Post

oh I forgot to change senderstate==1 to senderstate>0

And other errors occur more often than usual: transmitters should be set to off before they are digged.

problems with mesecon in general:

And when an movestone or pistons move transmitters they must be set to off, too.

In general the circuits should be recomputed after movestone or piston moved stone, because that could affect circuits.

Maybe a register_on_move or something owuld be intersting.

And some ideas for new mesecno nodes/mods:
  • a chest positioning first inventory item next to it if that node is air (directions similar to piston)
  • object detectors on top of sings should only activate if player, which name is on the sign, is near to the detector
  • movestone which moves up and down (and mabye move the player -> elevator)
I tried to modify the object detector in my own, but failed reading the sign text

In the end I wanna say thank you ... great mod. I built a castle with the help of pistons :D
And a drawbridge with movestones *_* (last time I turned it on, 2 movestones disappeared :O)

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

by sfan5 » Post

Baŝto wrote: And a drawbridge with movestones *_* (last time I turned it on, 2 movestones disappeared :O)
Happend to me too
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 » Post

Sorry, but I can't work that much on my mod in the next weeks. I will continue adding small bugfixes and small additional features. It would be awesome if someone helped me developing.
Redstone for minetest: Mesecons (mesecons.net)

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

by sfan5 » Post

Jeija wrote:Sorry, but I can't work that much on my mod in the next weeks. I will continue adding small bugfixes and small additional features. It would be awesome if someone helped me developing.
You should make a Github/Gitorious/Bitbucket Repo for this Mod, so others can help you
Last edited by sfan5 on Sat Jan 07, 2012 20:14, edited 1 time in total.
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 » Post

Good idea:
https://github.com/Jeija/minetest-mod-mesecons
I just don't know much about git :(. Tell me if something is wrong...
Redstone for minetest: Mesecons (mesecons.net)

User avatar
jordan4ibanez
Member
Posts: 1923
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Post

i have sent you an email
hello, am program. do language in rust. make computer do. okay i go now.

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

by sfan5 » Post

Jeija wrote:Good idea:
https://github.com/Jeija/minetest-mod-mesecons
I just don't know much about git :(. Tell me if something is wrong...
If you add me as a Collaborator to the Repo I can commit my changes directly.
Just add "sfan5" under Mesecons-Repo->Admin->Collaborators
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 » Post

Done! Thanks for the request ^^
Redstone for minetest: Mesecons (mesecons.net)

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

by sfan5 » Post

Jeija wrote:Done! Thanks for the request ^^
^^ I'll work on Buttons tomorrow.
And I have a solution for the Rotating-Switch Bug, you must keep the param2, then the Orientation is kept
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 » Post

I tried that and it didn't work. param2 of the button is nil :( Was there any update/patch for that?
By the way: Your mesecon torches are working, but i have to change some rules so that vertical ones work better.
Last edited by Jeija on Sat Jan 07, 2012 21:52, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)

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

by sfan5 » Post

Jeija wrote:I tried that and it didn't work. param2 of the button is nil :( Was there any update/patch for that?.
I'll try to get that working.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

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

by Jordach » Post

jeez, I can't wait for this mod to be done!! :D

edit. I could be testing soon..and I will make a calculator
Last edited by Jordach on Sat Jan 07, 2012 23:30, edited 1 time in total.

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

by Temperest » Post

Here's a screenshot showing usage of the inverter and sockets to make common logic gates (showing OR, XOR, AND, NOT, and a diode):

Image

It needed a fix to my plugs and sockets that I'll be perfecting and posting tomorrow. In the meantime there is a bug in it so I would not use it for now.

@Jeija: I've looked at some other examples of delays, but as you can see if you are doing more complex circuits the propagation delay becomes more than a little noticable. I'll add it as a flag if you want though.

@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 :).
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 » Post

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.
Last edited by Jeija on Sun Jan 08, 2012 05:57, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)

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

by sfan5 » Post

Jordach wrote:jeez, I can't wait for this mod to be done!! :D

edit. I could be testing soon..and I will make a calculator
You could use Mesecon Torches(i'm working on that)
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests