Post your modding questions here

Locked
User avatar
Hybrid Dog
Member
Posts: 2835
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

DoyleChris wrote:Im wondering if there is a way that a pipe supplying a technic grinder to know if the queue in the grinder is full or different item.

Example I have a grinder being feed by a pipe, grinder already is working on iron, i want to feed iron to it till its done. Then work on another kind and not have it send copper down the pipe when its working on iron.
I have tried it and the copper just stays in the tube.
Maybe you could use mesecons sticky pistons and a node detector.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

DoyleChris
Member
Posts: 265
Joined: Sat Jul 25, 2015 19:54
In-game: DoyleChris

Re: Post your modding questions here

by DoyleChris » Post

So use the sticky piston to control power.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Post your modding questions here

by paramat » Post

Ferk, your project sounds interesting.
Best to use mts schematics since that is Minetest's native format, it's probably faster and better maintained.
There's a parameter in .conf for the distance from a player that mapgen is triggered, see minetest.conf.

It might be best to use spawner nodes to trigger ABMs that place schematics a few seconds after mapgen, this way by the time a schematic is placed all surrounding mapchunks have already been generated, so you can add your project to a core mapgen and add large schematics without them crossing into ungenerated chunks. For an example see my infinite dungeon generator viewtopic.php?f=11&t=9896 This also splits the generation load into smaller units, possibly reducing lag.

User avatar
Ferk
Member
Posts: 337
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Post

@don @paramat thanks! I'm gonna be using mts and "spawners" now. Though I would probably need to store the metadata of the nodes in a separate file then, since mts doesn't store it.

I noticed minetest.create_schematic has a feature that allows certain nodes to have a probability for them to be placed. This would actually be interesting for my game, I might try and add a way to assign certain probability to a node from within the game.

However, I don't see an option in place_schematic to affect the probabilities, so I guess this would be one-directional, meaning that after you save the schematic there won't be a way within the game to edit it properly (the probabilities would always be already applied when you load the schematic for editing).

Btw, what is the "Slice probability"? I see that it only takes a Y coordinate. Does it mean that all nodes with that particular Y coordinate (an X-Z plane) within the schematic are affected by the probability at once?
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Post your modding questions here

by paramat » Post

Per node probability is fixed in the schematic file when you create it from a lua table (using this method viewtopic.php?f=9&t=12011)
You can imagine the schematic is placed in the world in horizontal slices from the bottom up (lowest slice = slice 0), slice probs if present affect entire slices, if the slice is skipped all above slices are moved down 1 node (so no gap) it's used in saveschems and mgv5/v7 mapgen for variable height trees.

I was wrong about catacomb placing schematics, it actually uses lua routines to create each chamber. My projects mod works a similar way and uses schematics for the apartments viewtopic.php?f=11&t=9577 there are times when a lua routine is better to use (more fine control) but of course can only be used for simple structures.

User avatar
swordpaint12
Member
Posts: 191
Joined: Sat Aug 22, 2015 00:50
In-game: [swordpaint12][Belching_Balladeer]
Location: Foobass, isle of Atlantis, castle of Bardvendelle

Re: Post your modding questions here

by swordpaint12 » Post

Okay so I launched my decay practice mod today and I got this error:

Code: Select all

2015-09-18 14:40:48: ERROR[main]: Server: Failed to load and run C:\Users\top secret.Tapestry\Desktop\minetest engines\minetest-0.4.13\bin\..\mods\decay\init.lua
2015-09-18 14:40:48: ERROR[main]: ModError: ModError: Failed to load and run C:\Users\top secret.Tapestry\Desktop\minetest engines\minetest-0.4.13\bin\..\mods\decay\init.lua
2015-09-18 14:40:48: ERROR[main]: Error from Lua:
2015-09-18 14:40:48: ERROR[main]: ...etest engines\minetest-0.4.13\bin\..\mods\decay\init.lua:17: '}' expected (to close '{' at line 14) near 'interval'
2015-09-18 14:40:48: ERROR[main]: Check debug.txt for details.
It's a very simple mod, my rendition has only one node: "decay:tree". What is my problem?
God's not dead; remember that!
Yay for MT! No MC here!
I am a human. I'm younger than 100 years old.
I've been playing Minetest since December 2014.

I'm amazed that I haven't been on here in so long! My latest minetest accomplishment was mining by hand (well, as close as you can get in a computer game) a circle 30 blocks in diameter. It took forever but it's pretty cool.

User avatar
Ben
Member
Posts: 160
Joined: Tue Mar 31, 2015 20:09

Re: Post your modding questions here

by Ben » Post

paramat wrote:
Ben wrote:A related question: I'm contemplating a teleportation mod with a delay of a second or two. After this time, I will most likely teleport a player to a given position, the server might as well have this position loaded by that time. I'd also like to query the nodes at the position being teleported to, but this is not strictly required.
As far as i know, for teleportation to an ungenerated area, …
Hi, sorry for the late reply, thanks for all the responses, and sorry for the confusion: I'm actually not talking about ungenerated areas. In my case, players teleport from a source node to a destination node, which some player has placed by hand beforehand. So the area is definitely generated.

The distance to the destination node may be quite high, so the server might have unloaded the block at some point, as servers do. My question is basically about reloading the block, for two reasons:

Firstly, before I do the actual teleport, I'd like to check that the destination node is present and unobstructed. If the block with this node in it is unloaded, I'll get "ignore" nodes, and then shrug and teleport anyway. But if I can improve this test a bit, I'd like to do so.

Secondly, teleporting will send the player into an unloaded block, at which point the server frantically struggles to load everything the player can see, and the client shows nothing but skybox until that's sorted out. Again, things would be a lot smoother if the server reloaded the area ahead of time.

User avatar
Hybrid Dog
Member
Posts: 2835
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

swordpaint12 wrote:Okay so I launched my decay practice mod today and I got this error:

Code: Select all

2015-09-18 14:40:48: ERROR[main]: Server: Failed to load and run C:\Users\top secret.Tapestry\Desktop\minetest engines\minetest-0.4.13\bin\..\mods\decay\init.lua
2015-09-18 14:40:48: ERROR[main]: ModError: ModError: Failed to load and run C:\Users\top secret.Tapestry\Desktop\minetest engines\minetest-0.4.13\bin\..\mods\decay\init.lua
2015-09-18 14:40:48: ERROR[main]: Error from Lua:
2015-09-18 14:40:48: ERROR[main]: ...etest engines\minetest-0.4.13\bin\..\mods\decay\init.lua:17: '}' expected (to close '{' at line 14) near 'interval'
2015-09-18 14:40:48: ERROR[main]: Check debug.txt for details.
It's a very simple mod, my rendition has only one node: "decay:tree". What is my problem?
maybe you forgot a comma near 'interval' or a bracket in line 17
Ben wrote:Secondly, teleporting will send the player into an unloaded block, at which point the server frantically struggles to load everything the player can see, and the client shows nothing but skybox until that's sorted out. Again, things would be a lot smoother if the server reloaded the area ahead of time.
as far as l know the client needs to load the chunk, not the server
there's a function to forceload a chunk: dev.minetest.net/minetest.forceload_block

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
swordpaint12
Member
Posts: 191
Joined: Sat Aug 22, 2015 00:50
In-game: [swordpaint12][Belching_Balladeer]
Location: Foobass, isle of Atlantis, castle of Bardvendelle

Re: Post your modding questions here

by swordpaint12 » Post

Thanks guys, I got the code to work. But apparently my texture doesn't work. That's okay though. I'll just have to work on that. So far I haven't seen it work, but hopefully I will. Thanks!
God's not dead; remember that!
Yay for MT! No MC here!
I am a human. I'm younger than 100 years old.
I've been playing Minetest since December 2014.

I'm amazed that I haven't been on here in so long! My latest minetest accomplishment was mining by hand (well, as close as you can get in a computer game) a circle 30 blocks in diameter. It took forever but it's pretty cool.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

swordpaint12 wrote:Thanks guys, I got the code to work. But apparently my texture doesn't work. That's okay though. I'll just have to work on that. So far I haven't seen it work, but hopefully I will. Thanks!
Post your code and we can help with the texture problem. Main things to remember is make sure you typed it right and have it like this

Code: Select all

tiles = {"image_name.png"},
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
TenPlus1
Member
Posts: 3722
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: Post your modding questions here

by TenPlus1 » Post

Whoops! wrong thread...
Last edited by TenPlus1 on Mon Sep 21, 2015 13:29, edited 1 time in total.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

TenPlus1 wrote:Could you please move my "Lucky Block" mod to MOD Releases :) Thanks...

viewtopic.php?f=9&t=13284

...and also my Pie mod also...

viewtopic.php?f=9&t=13285
Wrong place.
viewtopic.php?f=11&t=10418
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Sane
Member
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Mapgen function called more than once.

by Sane » Post

Hi there,

I have noticed that the function registered with minetest.register_on_generated gets called more than once. That seems a bit odd to me.

If that behaviour is intended,
what is the differnce between the calls?
which call is the one that counts? (Most probably the last one, but who knows for sure?)
are earlier calls missing information somehow? If so what is missing?
Isn't it a waste of processing time to have map sections generated several times?

To reproduce run a new minimal word with the following test code:
Spoiler

Code: Select all

local poscount = {}

minetest.register_on_generated(function(minp, maxp, seed)
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")

	local posText = minetest.pos_to_string(emin)
	poscount[posText] = (poscount[posText] or 0) + 1
	
	print("poscount:"..dump(poscount))
end)
Trying to stay me.

User avatar
Sane
Member
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Mapgen function called more than once.

by Sane » Post

Sane wrote:...
I have noticed that the function registered with minetest.register_on_generated gets called more than once. That seems a bit odd to me.
...
Nevermind, just found the solution. That thing bugged me for some days now and as it seems actually posting the question seems to have triggered someting ...

The soulution is that I've set num_emerge_threads = 4 in minetest,conf. Leaving this at 1 solves the issue.
Trying to stay me.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

I want to place a block every 1000 nodes square. It should be somewhat random. I do not want it to be exactly 1000.
The node will be placed in water on mapgen at surface height.

I am not great with mapgen and was wondering what the best way to do this is?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Sane
Member
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Post

Don wrote:I want to place a block every 1000 nodes square. It should be somewhat random. I do not want it to be exactly 1000.
The node will be placed in water on mapgen at surface height.

I am not great with mapgen and was wondering what the best way to do this is?
Will this be a new world or an exisiting one?
Trying to stay me.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

New world
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Sane
Member
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Post

Don wrote:New world
ArguablySane has posted a solution:
viewtopic.php?f=3&t=13132&p=191868#p189480
Trying to stay me.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Sane wrote:
Don wrote:New world
ArguablySane has posted a solution:
viewtopic.php?f=3&t=13132&p=191868#p189480
Thanks. I will try to modify it to make it work. Do you know if this works with all mapgens or just v5 and v7?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Sane
Member
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Post

Don wrote:
Sane wrote:
Don wrote:New world
ArguablySane has posted a solution:
viewtopic.php?f=3&t=13132&p=191868#p189480
Thanks. I will try to modify it to make it work. Do you know if this works with all mapgens or just v5 and v7?
No I don't. But singlenode does not work, the hightmap is always empty.

As I already was fiddeling with mapgen and hightmaps ...
I've patched up a thingy that places a node on the surface, at a random position in the mg block that contains a grid point defined by cell_size. If the mg block is not within y > -200 and < 200 then the node will be placed completely random.

Code: Select all

--[[ 
Node placer - Places a node on the surface, at a random position in the mg block that contains a grid point defined by cell_size

published under Creative Commons CC0 license.
--]]

-- cell_size  must be bigger then mg block size (80) to work.
local cell_size = 150
local item_id = minetest.get_content_id("default:steelblock")

minetest.register_on_generated(function(minp, maxp, seed)
	-- If the next_hotspot is not within this mg block then exit
	local next_hotspot = { 
		x = math.ceil(minp.x / cell_size) * cell_size,
		y = math.ceil(minp.y / cell_size) * cell_size,
		z = math.ceil(minp.z / cell_size) * cell_size
	}
	if next_hotspot.x > maxp.x or
		next_hotspot.y > maxp.y or
		next_hotspot.z > maxp.z then return end
	
	-- Place the object somewhere in this block

	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local va = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
	local vd = vm:get_data()
	
	local r = PcgRandom(seed) -- this ensures that you get the same results each time you generate the world anew.
	local item_pos = {
		x = r:next(minp.x, maxp.x),
		y = r:next(minp.y, maxp.y),
		z = r:next(minp.z, maxp.z),
	}

	-- This is to optimize, because getting the height map is expensive
	if minp.y > -200 and maxp.y < 200 then
		local hm = minetest.get_mapgen_object("heightmap")
		local hz = (item_pos.z - minp.z) * 80
		local hx = (item_pos.x - minp.x) % 80
		local height = hm[1 + hx + hz]
		item_pos.y = height + 1
	end

	vd[va:indexp(item_pos)] = item_id

	--
	vm:set_data(vd)
	--vm:calc_lighting()
	--vm:update_liquids()
	vm:write_to_map()
	--vm:update_map()
	--
end)
Trying to stay me.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

@Sane - Thanks. I got busy with something else and haven't tried yet. Will do it tomorrow.

I have another issue though. I have a mts schematic that contains a node with a formspec. When the schematic is placed the node does not have the formspec. I created another block and then used an abm to place the one with the formspec. This seems to work fine.
My question is, is that the best way to do it or is there a better way?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
kaadmy
Member
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Post your modding questions here

by kaadmy » Post

Don wrote:I have another issue though. I have a mts schematic that contains a node with a formspec. When the schematic is placed the node does not have the formspec. I created another block and then used an abm to place the one with the formspec. This seems to work fine.
My question is, is that the best way to do it or is there a better way?
That's how I do it, I couldn't find a better solution.
Never paint white stripes on roads near Zebra crossings.

Pixture

User avatar
Hybrid Dog
Member
Posts: 2835
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

kaadmy wrote:
Don wrote:I have another issue though. I have a mts schematic that contains a node with a formspec. When the schematic is placed the node does not have the formspec. I created another block and then used an abm to place the one with the formspec. This seems to work fine.
My question is, is that the best way to do it or is there a better way?
That's how I do it, I couldn't find a better solution.
There's another way: you could execute the function which usually becomes executed after the node appears (http://dev.minetest.net/minetest.regist ... _construct)

Code: Select all

local on_construct = minetest.registered_nodes[name].on_construct
if on_construct then
on_construct(pos)
end
You would need to loop through the positions where the schematic added nodes.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Ferk
Member
Posts: 337
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Post

-Deleted-

Yep, I didn't read properly. Sorry.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }

User avatar
GunshipPenguin
Member
Posts: 94
Joined: Tue Jan 28, 2014 00:38
GitHub: GunshipPenguin
IRC: GunshipPenguin
In-game: GunshipPenguin
Location: Vancouver, BC

Re: Post your modding questions here

by GunshipPenguin » Post

I'm having some trouble with the Voxel Manipulator.

Basically, I want the mapgen to generate nodes up to a certain point, then just have all nodes generated past that point filled with an invisible undiggable block. I'm using the following code:

Code: Select all

local SIZE = 200;

minetest.register_node("limit:limit_node", {
	diggable = false,
	sunlight_propagates = true,
	drawtype = "airlike",
})

minetest.register_on_generated(function(minp, maxp, seed)
	local c_limit = minetest.get_content_id("limit:limit_node")
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
	local data = vm:get_data(minp, maxp)
	
	for i in area:iterp(minp, maxp) do
		local currPos = area:position(i)
		if math.abs(currPos["x"]) > SIZE/2 or 
				math.abs(currPos["y"]) > SIZE/2 or
				math.abs(currPos["z"]) > SIZE/2 then
			data[i] = c_limit;
		end
	end
	vm:set_data(data)
	vm:write_to_map(data)
end)
In the code above, If the x, y or z coordinate of any generated block is > 100, it will be replaced with the node "limit:limit_node" which is simply an undiggable, invisible node. This code does work, but I find that certian nodes are not replaced by limit:limit_node like I want them to be. Here's are 2 screenshots of what I'm talking about:
Spoiler
Image
Image
As you can see in the screenshots, the map stops when x, y or z > 100 except for a few scattered unreplaced nodes. The unreplaced nodes seem to usually be liquids, dungeons and a few dirt or dirt_with_grass nodes.

I'm experiencing this using minetest 0.4.13 stable with the latest minetest_game.

Can anybody tell me why these nodes are not being replaced? Many thanks in advance.

Also, I understand that I could use map_generation_limit in minetest.conf for this, but it doesn’t exactly work with what I'm ultimately trying to do.

Locked

Who is online

Users browsing this forum: No registered users and 21 guests