Post your modding questions here

User avatar
Ackirb
Member
 
Posts: 23
Joined: Thu Mar 27, 2014 21:01

Re: Pay Doors [please help]

by Ackirb » Mon May 12, 2014 23:49

Of course not. I'm just a bit stumped. I am semi-familiar with how to create inventories for items (such as chests), and I'm quite familiar with the code for doors. Based on that, I could make a door that also functions as a chest lol. But I just can't seem to figure out how to make the door look for a specific item in its inventory, and only open when said item is present.

I keep taking a look at the wiki though![/quote]
I think some already did something like that. It's a lock and key door.[/quote]

They did. If you have a key in your inventory, you can open the door.
But what I want is for the door itself to have an inventory. You open this inventory and add a specified item(s), and then the door will open.
 

User avatar
Ackirb
Member
 
Posts: 23
Joined: Thu Mar 27, 2014 21:01

How To Replace Nodes within a Radius

by Ackirb » Mon May 12, 2014 23:53

Hello
I am looking to create a block that replaces a certain block with another one within a radius.
For example, it would replace all of the "default:wood" blocks with "default:stone" within a 100-node radius of itself.

This is what I have, but it doesn't work. Any ideas? (feel free to completely scrap what I have if necessary)

minetest.register_abm({
nodenames = "forcefield:switch_on",
interval = 1,
chance = 1,
action = function(pos, nodenames)
local obj = minetest.find_node_near(pos, 1000, "forcefield:forcefield") --trying to replace this node
minetest.set_node(obj, "forcefield:forcefield_on") --with this one
end
})
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

Re: Post your modding questions here

by Topywo » Tue May 13, 2014 08:40

nodenames = "forcefield:switch_on",

Not sure if this is causing it not to work, but I place brackets (or however those are called) around the nodenames:

nodenames = {"forcefield:switch_on"},



Edit: Typo
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed May 14, 2014 18:06

I've got a fork of PilzAdam's cart mod that I want to publish as cartsplus. So I renamed everything from carts to cartsplus, and it works just fine. BUT, I'd like to make it so that when you include the cartsplus mod, all carts created under the old carts mod (carts:cart) become cartsplus carts (cartsplus:cartplus)

From some advice I thought that minetest.register_alias("name", "convert_to") would do this. so I put at the top of the cartsplus init.lua:

minetest.register_alias("carts:cart", "cartsplus:cartplus")

But... it does nothing. old carts in the game or your inventory still run the old carts code and do not stack with new carts. Creative inventory shows two types of carts. new carts work fine, but the old carts still work as old carts.

So, am I misunderstanding what register_alias is supposed to do, or am I just using it incorrectly? Or does it only work with nodes, not entities?

Thanks in advance for your help.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Wed May 14, 2014 18:22

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("mymod:name_is_too_long", def)
minetest.register_alias("mymod:name_is_too_long", "nameistoolong")

/giveme nameistoolong
Added mymod:name_is_too_long to the inventory.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed May 14, 2014 18:46

Krock: Thanks for the attempt, but I'm not certain I understand how to apply that to overriding the cart entity. Sometimes I'm a bit slow. :)

This:

minetest.register_alias("carts:touringrail", "cartsplus:touringrail")

works fine. But carts:touringrail is no longer defined. Aliasing it to cartsplus:touringrail makes any touringrails that were defined when they were in the carts mod work great. BUT, attempting to override the existing carts:cart chokes. Is it impossible to use register_alias to override an existing entity in another mod?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

Re: Post your modding questions here

by PilzAdam » Wed May 14, 2014 19:00

Kilarin wrote:I've got a fork of PilzAdam's cart mod that I want to publish as cartsplus. So I renamed everything from carts to cartsplus, and it works just fine. BUT, I'd like to make it so that when you include the cartsplus mod, all carts created under the old carts mod (carts:cart) become cartsplus carts (cartsplus:cartplus)

From some advice I thought that minetest.register_alias("name", "convert_to") would do this. so I put at the top of the cartsplus init.lua:

minetest.register_alias("carts:cart", "cartsplus:cartplus")

But... it does nothing. old carts in the game or your inventory still run the old carts code and do not stack with new carts. Creative inventory shows two types of carts. new carts work fine, but the old carts still work as old carts.

So, am I misunderstanding what register_alias is supposed to do, or am I just using it incorrectly? Or does it only work with nodes, not entities?

Thanks in advance for your help.

Why don't you submit a pull request to my carts mod?
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed May 14, 2014 19:05

PIlzAdam wrote:Why don't you submit a pull request to my carts mod?

Would LOVE to, I PM'd you about whether you were interested in the changes and didn't get a response, so I thought you weren't interested. I'll figure out how to do a pull and execute it today.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

Re: Post your modding questions here

by PilzAdam » Wed May 14, 2014 23:09

Kilarin wrote:
PIlzAdam wrote:Why don't you submit a pull request to my carts mod?

Would LOVE to, I PM'd you about whether you were interested in the changes and didn't get a response, so I thought you weren't interested. I'll figure out how to do a pull and execute it today.

Oh, new PMs are rather invisible with this new forum software, sorry for not seeing them.
I probably have time to review your code at the next weekend.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Thu May 15, 2014 03:31

PilzAdam wrote:sorry for not seeing them.

Nothing to apologize for!

PilzAdam wrote:I probably have time to review your code at the next weekend.

Thank you, I really appreciate the time taken. It takes a lot of time and work to review someone elses code.
 

User avatar
Ackirb
Member
 
Posts: 23
Joined: Thu Mar 27, 2014 21:01

Re: Post your modding questions here

by Ackirb » Fri May 16, 2014 14:08

Topywo wrote:nodenames = "forcefield:switch_on",

Not sure if this is causing it not to work, but I place brackets (or however those are called) around the nodenames:

nodenames = {"forcefield:switch_on"},



Edit: Typo


I tried that as well, and no luck. I think it may be a problem with the functions

minetest.register_abm({
nodenames = "forcefield:switch_on",
interval = 1,
chance = 1,
action = function(pos, nodenames)
local obj = minetest.find_node_near(pos, 1000, "forcefield:forcefield") --trying to replace this node
minetest.set_node(obj, "forcefield:forcefield_on") --with this one
end
})

I know that minetest.find_node_near returns a list of positions of the indicated nodes. As you can see, I am using that as a variable (obj), and plugging it into minetest.set_node.
Normally, the parameter for minetest.set_node is (pos, nodename). But I substituted pos with the obj variable....
is that why it won't work?
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Post your modding questions here

by Casimir » Fri May 16, 2014 20:00

nodenames is a table, so it must have brackets, even if there is only one element. In your function I think the problem is with set_node. Try this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local pos_found = minetest.find_node_near(pos, 1000, "forcefield:forcefield") --trying to replace this node
minetest.set_node(pos_found, {name="forcefield:forcefield_on"}) --with this one
 

Daven
Member
 
Posts: 26
Joined: Mon Jan 20, 2014 21:51

Re: Post your modding questions here

by Daven » Wed May 21, 2014 02:04

Can someone please post a link to the worldedit mod? It would be really helpful. Thanks.
Also, can you help me with the mod for adding a hungerbar to the world?
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: How To Replace Nodes within a Radius

by paramat » Wed May 21, 2014 03:00

Ackirb wrote:minetest.register_abm({
nodenames = "forcefield:switch_on",
interval = 1,
chance = 1,
action = function(pos, nodenames)
local obj = minetest.find_node_near(pos, 1000, "forcefield:forcefield") --trying to replace this node
minetest.set_node(obj, "forcefield:forcefield_on") --with this one
end
})

If it works it might be slow with a radius of 1000, 'find node near' is very slow even with a small radius.
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

Re: Post your modding questions here

by Topywo » Wed May 21, 2014 08:36

Daven wrote:Can someone please post a link to the worldedit mod? It would be really helpful. Thanks.
Also, can you help me with the mod for adding a hungerbar to the world?


viewtopic.php?f=11&t=572

You can find most mods under Mod Releases, the most common used ones on the first pages.
 

User avatar
Ackirb
Member
 
Posts: 23
Joined: Thu Mar 27, 2014 21:01

Re: How To Replace Nodes within a Radius

by Ackirb » Wed May 21, 2014 18:50

paramat wrote:
Ackirb wrote:minetest.register_abm({
nodenames = "forcefield:switch_on",
interval = 1,
chance = 1,
action = function(pos, nodenames)
local obj = minetest.find_node_near(pos, 1000, "forcefield:forcefield") --trying to replace this node
minetest.set_node(obj, "forcefield:forcefield_on") --with this one
end
})

If it works it might be slow with a radius of 1000, 'find node near' is very slow even with a small radius.


Hmmm - good to know. Any other suggestions?
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: How To Replace Nodes within a Radius

by Krock » Wed May 21, 2014 18:55

Ackirb wrote:Hmmm - good to know. Any other suggestions?

Try voxelmanip, maybe it's faster.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Fri May 23, 2014 02:49

So, I'm working on my own variation of TeTpaAka's awsome variation of Echo's really cool compass mod.

In order to update the compass, the original mod does a register_globalstep. But, if I am understanding this, the globastep just keeps running every cycle no matter what. If you take the compass out of your active inventory and drop it into your main inventory, the globalstep keeps running. If you put the compass into a chest and leave the region, the globalstep keeps running.

I'd LIKE for the globalstep to only run when the compass in in your active inventory. No reason to have it sucking cpu cycles when the compass isnt where you could see it. BUT, it seems to me that doing a scan at the top of the global step to see if your active inventory contains the compass would actually eat up more cpu than just leaving it as is.

Is there any way to trigger a function whenever an item is MOVED within inventory? That way I could check to see if the compass is in active inventory only when you move it, and turn off the globalstep if its not, and turn it back on if it is.

Thanks,
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri May 23, 2014 17:26

Kilarin wrote:Is there any way to trigger a function whenever an item is MOVED within inventory? That way I could check to see if the compass is in active inventory only when you move it, and turn off the globalstep if its not, and turn it back on if it is.

I don't know exactly, I think the locked_chest does something with something like on_inventory_put.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Fri May 23, 2014 20:11

I'll look at that, thank you.

Next stupid question. I've got a formspec that previously had a dropdown and a button:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
"dropdown[0,1.5;8;bookmark_list;"..list..";0]"..
"button[0,2.3;5,1;find_bookmark;find selected bookmark]"

And I want to change it to a textlist:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
"textlist[0,1.5;5,8;bookmark_list;"..list..";1]"..
"button[0,6.3;5,1;find_bookmark;find selected bookmark]"


Now, using the dropdown code, I'm able to run minetest.register_on_player_receive_fields
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if fields["find_bookmark"] then
  compass.find_bookmark(name, fields["bookmark_list"])
end

And it works just fine. But when I switch to textlist, my formspec comes up and looks great, and I'm able to select a bookmark and click on "find", but in register_on_player_recieve_fields, while the find_bookmark button is set, bookmark_list is nil.

Doesn't textlist return the value selected in it the same as dropdown does?

Thanks,

Edit: Figured a few things out since I posted the question
textlist fires as soon as you click on any element in the list, dropdown does NOT return it's results until you have clicked a button.
dropdown returns the actual string selected, textlist returns CHG:<index of item selected>
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Fri May 23, 2014 22:06

well, with a lot of work and what I suspect is some really stupid coding, I can get the textlist to find a particular bookmark whenever you click on it. (simply bypassing the find bookmark button, which is actually good)

But this still leaves me with a nonfunctioning system. Because I need to be able to select an item from the list, and then click "remove bookmark"

It seems baffling to me that a textlist field does not return the value selected in it when you click a button in the same form. Am I doing something wrong here?
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Sun May 25, 2014 05:09

Well, the workaround to the textlist problem is obvious. when the user clicks on an item in the textlist, I'll store that item in a variable, and then when the click a button, I'll use the variable to determine what item is currently selected in the textlist. It should work, but it's not elegant.

It seems to me that this is a bug. textlist should work in a manner similar to the dropdown. It should return the element selected, not the index of that element. and it should return the currently selected element when you ask for it after a button has been pressed instead of nil as it currently does.

EDIT:
Interesting, I changed my code a bit, and now textlist is NOT returning nil when you click a button, but it's passing back the value of the 1st element in the list even though a different element was selected. very strange.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Sun May 25, 2014 21:48

When i place light sources by voxelmanip their light level is correct but the light does not spread, is there a good way to update the lighting? I tried updating lighting using an ABM to remove then re'place' (not 'add') a light source, but that causes the node to drop down 1 node. I'm thinking of requesting 'update_lighting()' be added to the voxelmanip.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Mon May 26, 2014 17:12

Kilarin wrote:I changed my code a bit, and now textlist is NOT returning nil when you click a button, but it's passing back the value of the 1st element in the list even though a different element was selected. very strange.

I'm a moron. It was a bug in my code making it pass back the value of the first element. (I had two fields with the same name) Once corrected, the textlist behaves as it did before. It returns the index when you click on it, and returns nil if you query the field when a button is pressed. Very different (and less useful) behavior from dropdown which returns the value of the selected item, and will return it when queried after a button is pressed.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Mon May 26, 2014 17:35

paramat wrote:When i place light sources by voxelmanip their light level is correct but the light does not spread, is there a good way to update the lighting? I tried updating lighting using an ABM to remove then re'place' (not 'add') a light source, but that causes the node to drop down 1 node. I'm thinking of requesting 'update_lighting()' be added to the voxelmanip.

I currently use update_map with a second "manip" to fix light, liquids and show the "trees".
https://github.com/HybridDog/minetest-n ... it.lua#L82
 

User avatar
DaN
Member
 
Posts: 82
Joined: Sat Apr 06, 2013 19:09

Re: Post your modding questions here

by DaN » Tue May 27, 2014 18:45

How does sound work in Minetest 0.4? I want to try replicating it in MT 0.2.
Last edited by DaN on Wed May 28, 2014 16:40, edited 2 times in total.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Tue May 27, 2014 19:55

Thanks Hybrid Dog. I may have realised why light sources cannot be spread at chunk generation time. Since their light range is 16 nodes there would be lighting errors over chunk edges, so it's best light sources spread their light when all neighbouring chunks are generated. Perhaps this is why update_map() is only found in one version of voxelmanip.
Now i'm using nodeupdate(pos) in an abm on light sources, works well, would also be fun to cause unstable sand to collapse.
 

GaryLaw64
New member
 
Posts: 3
Joined: Sun May 25, 2014 09:20
In-game: garylaw64

Re: Post your modding questions here

by GaryLaw64 » Wed May 28, 2014 08:02

Help!

Installing mods on ubuntu.

Linux issue rather than minetest I know.

wiki page is very clear for windows installation, and it all makes complete sense. Installed and activated a number of mods. Linux does not want to let me see the files graphically likie windows.

Can anyone help with the command lines in linux to move the folders I have downloaded and renamed to the right place.

Is there a linux pro out there? Cos I can find the minetest application but no other folders.

AAAAARRRRGGGGHHHHHH!

Linux noob, but getting there. Before someone asks, I refuse to run the game on my xp computer cos the graphics are waaaay better with my linux setup.
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

Re: Post your modding questions here

by Topywo » Wed May 28, 2014 08:51

GaryLaw64 wrote:Linux does not want to let me see the files graphically likie windows.


Afaik Ubuntu has a file manager (under accessoires) and a folder icon in the task bar.

Where did you get your minetestversion from (link)?
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: Post your modding questions here

by Evergreen » Wed May 28, 2014 11:35

GaryLaw64 wrote:Help!

Installing mods on ubuntu.

Linux issue rather than minetest I know.

wiki page is very clear for windows installation, and it all makes complete sense. Installed and activated a number of mods. Linux does not want to let me see the files graphically likie windows.

Can anyone help with the command lines in linux to move the folders I have downloaded and renamed to the right place.

Is there a linux pro out there? Cos I can find the minetest application but no other folders.

AAAAARRRRGGGGHHHHHH!

Linux noob, but getting there. Before someone asks, I refuse to run the game on my xp computer cos the graphics are waaaay better with my linux setup.

First of all, yes, you shold be able to see files "graphically". Use the default file manager. And as for the mods, how did you install minetest? If your version is below 0.4.0 no mods are compatible.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 10 guests

cron