Post your modding questions here

User avatar
mbb
Member
 
Posts: 162
Joined: Sat Jan 17, 2015 17:47
GitHub: mbblp
IRC: mBb
In-game: MBB

Re: Post your modding questions here

by mbb » Sat Mar 25, 2017 09:17

thx for your help now i need other one
how i can generate a 1 block deep ozean per mod?
I like trains....and: minetest, blender, gaming, linux, cats, computers
 

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

Re: Post your modding questions here

by Hybrid Dog » Sat Mar 25, 2017 12:33

Philosoph228 wrote:How can I get the maximum and minimum heights of the world?

http://wiki.minetest.net/End_of_the_wor ... _the_world

mbb wrote:how i can generate a 1 block deep ozean per mod?

You can use vmanip http://dev.minetest.net/vmanip#Examples
 

RealGoldenHart
Member
 
Posts: 17
Joined: Fri Dec 23, 2016 23:27
IRC: GoldenHart
In-game: GoldenHart

Re: Post your modding questions here

by RealGoldenHart » Sun Mar 26, 2017 03:15

Three questions, I think they are all impossible, but that's what this forum is for...pro coders solving my noobish problems.

1. How would I go about setting a node to be collidable with all but one other node? To be more specfic, I want node a to be able to go through node b, but I don't want node c, or any other node, to be able to go through node b. I also want to be able to build on node b.... soo I'm confused.

2. Can I make a node able to travel up after taking a certain action, such as right clicking the node.

3. How would I go about generating a realm in the sky? For example, rather than in caverealms where the realms are spawned underground, is it possible to do that in the sky?
Now...I realize this makes the mod impossible for servers to add, because they would have to make a new world for this addition. Is there any alternative that achieves the same goal?

I am new to Lua coding, and Mt modding in general. I do have a bit of c++ experience. Not as much as most though. Thanks for reading and I hope you have some answers for me.

If this mod idea doesn't work, I will happily move on over to something else, maybe I shouldn't try something so big for my first mod, but I think I have an idea of how to develop this.
GoldenHart has entered the world. Fear the queer deer.
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Sun Mar 26, 2017 05:28

RealGoldenHart wrote:1. How would I go about setting a node to be collidable with all but one other node? To be more specfic, I want node a to be able to go through node b, but I don't want node c, or any other node, to be able to go through node b. I also want to be able to build on node b.... soo I'm confused.


Nodes can't move. Period.

Nodes can temporarily fall, but they'll stop as soon as they hit another (non-air) node.
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Sun Mar 26, 2017 05:29

RealGoldenHart wrote:2. Can I make a node able to travel up after taking a certain action, such as right clicking the node.


Nodes can't move. Period.

You can fake movement by removing the node at position A, and then making a new node that looks just like it at position B. It will look like it moved, but it didn't.

API relevant functions:

minetest.remove_node(pos)
minetest.set_node(pos, node)
 

dawgdoc
Member
 
Posts: 14
Joined: Mon Feb 27, 2017 01:10

Re: Post your modding questions here

by dawgdoc » Sun Mar 26, 2017 06:45

You may find some usable code in the Pontoons mod. I recall it is used to make under water builds float to the surface and become floating buildings. But, I think that mod converted the building to an entity, floated the entity up, and then converted it back to nodes. It is entirely possible that it will not be of any use to you. There was a distinct stopping point for the events to occur; that is when the entity had air above in instead of water. I don't know how you can change the code to suit your purposes.
 

RealGoldenHart
Member
 
Posts: 17
Joined: Fri Dec 23, 2016 23:27
IRC: GoldenHart
In-game: GoldenHart

Re: Post your modding questions here

by RealGoldenHart » Sun Mar 26, 2017 11:37

Alright thanks guys. I will try a different mod. Thanks for teaching me. I thought if you could move a vehicle around in a vehicles mod, that maybe you could move an air transport or something up. Ttyl
GoldenHart has entered the world. Fear the queer deer.
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Mon Mar 27, 2017 21:50

RealGoldenHart wrote:3. How would I go about generating a realm in the sky? For example, rather than in caverealms where the realms are spawned underground, is it possible to do that in the sky?
Now...I realize this makes the mod impossible for servers to add, because they would have to make a new world for this addition. Is there any alternative that achieves the same goal?

I, personally, have no idea of mapgen stuff of any kind.
- Mapgen v7 has floatlands. they are disabled but can be enabled
- Terrain gets generated in 3d cubes of 80 nodes in diameter, not in 2d chunks like in Minecraft. So, if no one ever flew up to the heights you want the sky realm to be generated, an existing world is no problem, because the sky terrain has not yet been generated.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Thu Mar 30, 2017 15:46

What is the best way to put the names of all files (folders) which are in one folder into a table?
(I want to get a table which contains the name of all existing texture packs (path = /.minetest/textures ))
Can your read this?
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Sat Apr 01, 2017 07:19

How can I debug lua code? I need to run a code step by step to check variables, but I don't know how. I tried to use player controls (key input), but that doesn't work, however

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 function stepkey()
   local player = minetest.get_player_by_name("singleplayer")
   repeat
   until player:get_player_control().aux1
   repeat
   until not player:get_player_control().aux1
end
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Sat Apr 01, 2017 07:28

You can write print("variable") in every line.
Can your read this?
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sat Apr 01, 2017 07:29

Can't you use print() instructions to print values after each step?
Minetest is not multithreaded, whenever a event function blocks (such as running an infinite loop) the server can't do anything else, it can't even update the player control status. So you may not wait inside callback functions using loops.
You might achieve something like you want using coroutines, but these are broken inside the callbacks for some reason
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Sat Apr 01, 2017 07:30

cx384 wrote:You can write print("variable") in every line.

That's too fast and too much. I need to stop the code to analyse the data
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sat Apr 01, 2017 07:37

maybe print just everything...
print(dump(table_of_all_relevant_data))
There is no other way
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Sat Apr 01, 2017 07:43

orwell wrote:maybe print just everything...
print(dump(table_of_all_relevant_data))
There is no other way

As I said, too fast and too much for console output. I write to a file now
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sat Apr 01, 2017 21:23

Maybe (but only maybe) this is useful for you. It's a simple ring buffer. I used it to debug a problem in my advtrains mod, because I couldn't reproduce the bug but only detect when it was happening, so I needed to let some trains run and let them trigger the dump when some component recognized that something was wrong
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 ringbuflen=200

local ringbufs={}
local ringbufcnt={}

function advtrains.drb_record(tid, msg)
   if not ringbufs[tid] then
      ringbufs[tid]={}
      ringbufcnt[tid]=0
   end
   ringbufs[tid][ringbufcnt[tid]]=msg
   ringbufcnt[tid]=ringbufcnt[tid]+1
   if ringbufcnt[tid] > ringbuflen then
      ringbufcnt[tid]=0
   end
end
function advtrains.drb_dump_and_exit(pts, tid)
   print("Train "..tid.." dumping ringbuffer at pos:", pts)
   local stopcnt=ringbufcnt[tid]
   repeat
      minetest.log("action", ringbufcnt[tid]..ringbufs[tid][ringbufcnt[tid]])
      ringbufcnt[tid]=ringbufcnt[tid]+1
      if ringbufcnt[tid] > ringbuflen then
         ringbufcnt[tid]=0
      end
   until ringbufcnt[tid]==stopcnt
   minetest.log("action", dump(advtrains.trains[tid]))
   error("Successfully dumped stuff")
end
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

Previous

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron