Page 7 of 74

PostPosted: Fri Jan 06, 2012 05:19
by Gatharoth
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?)

PostPosted: Fri Jan 06, 2012 05:21
by Jeija
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.

PostPosted: Fri Jan 06, 2012 05:28
by Gatharoth
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.

PostPosted: Fri Jan 06, 2012 05:34
by Jeija
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.

PostPosted: Fri Jan 06, 2012 05:41
by Gatharoth
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.

PostPosted: Fri Jan 06, 2012 05:53
by Jeija
I think we need something like a button with a short span to generate power...

PostPosted: Fri Jan 06, 2012 06:08
by Gatharoth
Alright. But I haven't worked with global timer yet, so I'd pretty but be blind shooting XD

PostPosted: Fri Jan 06, 2012 14:00
by Baŝto
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) )

PostPosted: Fri Jan 06, 2012 14:25
by Jeija
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!

PostPosted: Fri Jan 06, 2012 14:37
by sfan5
@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

PostPosted: Sat Jan 07, 2012 19:37
by Baŝto
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)

PostPosted: Sat Jan 07, 2012 19:58
by sfan5
Baŝto wrote:And a drawbridge with movestones *_* (last time I turned it on, 2 movestones disappeared :O)

Happend to me too

PostPosted: Sat Jan 07, 2012 20:05
by Jeija
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.

PostPosted: Sat Jan 07, 2012 20:10
by sfan5
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

PostPosted: Sat Jan 07, 2012 20:56
by Jeija
Good idea:
https://github.com/Jeija/minetest-mod-mesecons
I just don't know much about git :(. Tell me if something is wrong...

PostPosted: Sat Jan 07, 2012 21:35
by jordan4ibanez
i have sent you an email

PostPosted: Sat Jan 07, 2012 21:44
by sfan5
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

PostPosted: Sat Jan 07, 2012 21:47
by Jeija
Done! Thanks for the request ^^

PostPosted: Sat Jan 07, 2012 21:50
by sfan5
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

PostPosted: Sat Jan 07, 2012 21:51
by Jeija
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.

PostPosted: Sat Jan 07, 2012 21:58
by sfan5
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.

PostPosted: Sat Jan 07, 2012 23:28
by Jordach
jeez, I can't wait for this mod to be done!! :D

edit. I could be testing soon..and I will make a calculator

PostPosted: Sun Jan 08, 2012 05:02
by Temperest
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 :).

PostPosted: Sun Jan 08, 2012 05:56
by Jeija
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.

PostPosted: Sun Jan 08, 2012 08:06
by sfan5
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)