[Mod] Mesecons (= redstone) [GitHub] [minetest-mod-mesecons]
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)
(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)
Last edited by Gatharoth on Tue Jan 03, 2012 00:15, edited 1 time in total.
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.)
(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.)
- jordan4ibanez
- Member
- Posts: 1926
- Joined: Tue Sep 27, 2011 18:44
- GitHub: jordan4ibanez
- IRC: jordan4ibanez
- In-game: jordan4ibanez
jeija do you mind if i use a heavily modified section of your code in one of my mods?
gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble
- jordan4ibanez
- Member
- Posts: 1926
- Joined: Tue Sep 27, 2011 18:44
- GitHub: jordan4ibanez
- IRC: jordan4ibanez
- In-game: jordan4ibanez
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 soonJeija 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 ^^.
gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble
I tried to make an inverter since wireless inverters were a bit cumbersome:
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.
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"'},
}
})
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.
WorldEdit 1.0 released
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
@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
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
Last edited by Jeija on Tue Jan 03, 2012 17:20, edited 1 time in total.
My pleasure. You've done a great job with this and I'd really like to see this go far.Jeija wrote:@Temperest: First of all, huge thanks for (trying to) contribute/ing to the mod!!!
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: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'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.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.
Once again, keep up the great work!
WorldEdit 1.0 released
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
- jordan4ibanez
- Member
- Posts: 1926
- Joined: Tue Sep 27, 2011 18:44
- GitHub: jordan4ibanez
- IRC: jordan4ibanez
- In-game: jordan4ibanez
jeija! go to redcrabs server! the one with port 30001!
gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble gobble
wait... I'm compiling the latest git version right now
Last edited by Jeija on Tue Jan 03, 2012 17:52, edited 1 time in total.
Yeah it is pretty similar, actually, but without channels, and range limited to one block.Jeija wrote: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!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.
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.
WorldEdit 1.0 released
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
Same reason as me, I guessJeija 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.
Making single block logic gates need that capability, or they will have to be directional.
WorldEdit 1.0 released
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
Who is online
Users browsing this forum: No registered users and 6 guests