Page 4 of 78

Posted: Mon Jan 02, 2012 16:08
by Staffs
I did. I guess i need new version huh ?

Posted: Mon Jan 02, 2012 16:20
by sfan5
Staffs wrote:I did. I guess i need new version huh ?
Yes

Posted: Mon Jan 02, 2012 19:34
by Gatharoth
:D I have created a basic one time delay system. I'll post how-to later. I'll be working on creating a delay system that isn't one time for now.

(note: this time delay is not another mod, or a change to the mesecons, it is just a delay system using material already in the mod)

Posted: Mon Jan 02, 2012 20:28
by Ushiua
You are my god.

Posted: Tue Jan 03, 2012 06:58
by Gatharoth
Okay found a bug, sticky movestones return to regular movestones after the first use. Well, its not a bug if that was intentional.

Posted: Tue Jan 03, 2012 07:54
by Jeija
Its a bug, I may fix that. But it will take some time... I don't have that much time for mod development at the moment.

Posted: Tue Jan 03, 2012 08:55
by Gatharoth
Ah, okays. Well, that's okay. I mean come on, mod development for a game that hasn't even hit alpha/beta stage yet isn't too important.

(I said alpha stage, because to "most" gaming companies, this does not have all it's intended features and systems, where as an alpha stage game will have them, but of course, they will be buggy.)

Posted: Tue Jan 03, 2012 13:54
by jordan4ibanez
jeija do you mind if i use a heavily modified section of your code in one of my mods?

Posted: Tue Jan 03, 2012 13:57
by Jeija
Nope! Just take it if you want. The code is under the do-what-the-f***-you-want license.
But please tell me what you needed the code for... I'm just so curious ^^.

Posted: Tue Jan 03, 2012 13:59
by jordan4ibanez
Jeija wrote:Nope! Just take it if you want. The code is under the do-what-the-f***-you-want license.
But please tell me what you needed the code for... I'm just so curious ^^.
i can't tell you right now..because i am going to release a HUGE mod maybe in a week or so..but trust me you will know soon :D

Posted: Tue Jan 03, 2012 14:02
by Jeija
:D!!!

Posted: Tue Jan 03, 2012 16:20
by Staffs
I think you should change "Object detector" crafting. Cause its SO hard to find iron :/

Posted: Tue Jan 03, 2012 16:25
by neko259
Staffs wrote:I think you should change "Object detector" crafting. Cause its SO hard to find iron :/
It's a bug, not a feature. We must be patient and pray^W wait for it to be fixed.

Posted: Tue Jan 03, 2012 17:01
by Temperest
I tried to make an inverter since wireless inverters were a bit cumbersome:

Code: Select all

--INVERTER: add this to your init.lua file, near the bottom somewhere

minetest.register_node("jeija:mesecon_inverter_off", {
    drawtype = "raillike",
    paramtype = "light",
    is_ground_content = true,
    tile_images = {"jeija_mesecon_inverter.png"},
    inventory_image = "jeija_mesecon_inverter.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.png"},
    inventory_image = "jeija_mesecon_inverter.png",
    material = minetest.digprop_constanttime(0.1),
    walkable = false,
    selection_box = {
        type = "fixed",
    },
    dug_item='node "jeija:mesecon_inverter_off" 1',
})

--mesecon:register_on_signal_on(function(pos, node)
minetest.register_on_punchnode(function(pos, node)
    if 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)

mesecon:register_on_signal_off(function(pos, node)
    if 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)

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"'},
        {'node "default:junglegrass"'},
        {'node "jeija:mesecon_off"'},
    }
})
It's not working, though - MineTest crashes due to the two signal handlers causing conflicting messages to be sent. You can see what I mean if you put in print() statement in the function bodies: "signal on signal off signal on..."

My question is, how would I write it to create a "proper" inverter? Is it possible with the current architecture? I'm new to lua and any help would be appreciated.

Posted: Tue Jan 03, 2012 17:19
by Jeija
@Temperest: First of all, huge thanks for (trying to) contribute/ing to the mod!!!
I tried the same thing, and of course this bug also happened to me...
There are two ways to handle this problem:
1) Make a delay using an ABM or - much better the on_globalstep event. (Just create a timer and put timer=timer+dtime in the globalstep func). Create a like 1 second delay so that the server can't crash. Handle the turnoff/turnon after the 1 second has passed.
--> I use this method for the wireless inverters
2) Make the inverter directional. The output is always on the other side of the input. Unfortunately, you would have to get the orientation of the node for this (im not sure if this is possible at all) or save your own orientation in param2 i guess of the inverter node.

I hope you could understand me and I could help you. If not, feel free to ask again!
Cheers, Jeija

Posted: Tue Jan 03, 2012 17:33
by Temperest
Jeija wrote:@Temperest: First of all, huge thanks for (trying to) contribute/ing to the mod!!!
My pleasure. You've done a great job with this and I'd really like to see this go far.
Jeija wrote:1) Make a delay using an ABM or - much better the on_globalstep event. (Just create a timer and put timer=timer+dtime in the globalstep func). Create a like 1 second delay so that the server can't crash. Handle the turnoff/turnon after the 1 second has passed.
Well that's kind of the problem I was trying to solve - how to avoid delays in the logic. I don't think the one second delay would allow for more complicated stuff like adders and etc.
Jeija wrote:2) Make the inverter directional. The output is always on the other side of the input. Unfortunately, you would have to get the orientation of the node for this (im not sure if this is possible at all) or save your own orientation in param2 i guess of the inverter node.
I'll give this method a try. Actually, I had an idea - a diode made out of two blocks, the input and the output, and the output block would have two variations: normal and inverted. This seems to not need a delay, I'll write back soon with my results.

Once again, keep up the great work!

Posted: Tue Jan 03, 2012 17:37
by Jeija
Actually, I had an idea - a diode made out of two blocks, the input and the output, and the output block would have two variations: normal and inverted.
Isn't this what wireless receivers/inverters/transmitters actually do? Or what do you mean by that? Sorry if I just misunderstood you. Keep on!

Posted: Tue Jan 03, 2012 17:48
by jordan4ibanez
jeija! go to redcrabs server! the one with port 30001!

Posted: Tue Jan 03, 2012 17:51
by Jeija
wait... I'm compiling the latest git version right now

Posted: Tue Jan 03, 2012 18:01
by Temperest
Jeija wrote:
Actually, I had an idea - a diode made out of two blocks, the input and the output, and the output block would have two variations: normal and inverted.
Isn't this what wireless receivers/inverters/transmitters actually do? Or what do you mean by that? Sorry if I just misunderstood you. Keep on!
Yeah it is pretty similar, actually, but without channels, and range limited to one block.

I'll study your wireless stuff for more inspiration.

Crafting should also be simpler for these blocks, I think - I'll try a steel + mesecon combo.

Posted: Tue Jan 03, 2012 18:32
by Gatharoth
Hey Jeija, is it possible for a single node to be both a receptor and an effector?

Posted: Tue Jan 03, 2012 18:53
by Jeija
@Gatharoth: It is possible, but it will make the game crash if the signal is conducted immediately. You have to set a delay.

Posted: Tue Jan 03, 2012 18:54
by Gatharoth
Alright. But that's kinda the point, delay :D

Posted: Tue Jan 03, 2012 18:56
by Jeija
Why would you need a block to be receptor and effector at the same time? In some cases it is also possible without a delay.

Posted: Tue Jan 03, 2012 18:58
by Temperest
Jeija wrote:Why would you need a block to be receptor and effector at the same time? In some cases it is also possible without a delay.
Same reason as me, I guess :)

Making single block logic gates need that capability, or they will have to be directional.