Post your modding questions here

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Thu Apr 21, 2016 16:57

Evaluate means to find or work out the value of something. So evaluating v is finding out the value of v.
 

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

by Hybrid Dog » Thu Apr 21, 2016 17:06

v is a table which means it's a reference to it l think
and the value of v is this reference, isn't it?
So if v is written, the reference to the table is searched (evaluation), thus v.name(v,args) causes two evaluations, doesn't it?
Last edited by Hybrid Dog on Sat Apr 23, 2016 14:51, edited 1 time in total.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Thu Apr 21, 2016 17:14

Hybrid Dog wrote:v is a table which means it's a reference to it l think
and the value of v is this reference, isn't it?
so if a field of v gets changed somehow, there's no difference if v was evaluated only once or more times, is it?

Consider this example:
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
a.b.c.d:func()

The alternative is:
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
a.b.c.d.func(a.b.c.d)

Evaluating a.b.c.d only once gives great savings, but is otherwise equivalent.
Now think about things like 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
somefile:read():sub(...)
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

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

by Hybrid Dog » Fri Apr 22, 2016 07:04

thanks

kaeza wrote:Now think about things like 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
somefile:read():sub(...)

This could do the same
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 txt = somefile.read(somefile)
txt.sub(txt, ...)
Last edited by Hybrid Dog on Sat Apr 23, 2016 14:51, edited 1 time in total.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Fri Apr 22, 2016 07:22

That is the best way IMHO, but my point is that evaluating some expressions may cause side-effects, so it would cause tons of bugs if evaluated more than once.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

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

by Hybrid Dog » Fri Apr 22, 2016 07:41

Obviously the sub of another text works on the text

Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print(("unused text").sub("use this",3))
e this
 

User avatar
TortueGaming
New member
 
Posts: 9
Joined: Mon Feb 02, 2015 01:03
In-game: TortueGaming

Re: Post your modding questions here

by TortueGaming » Fri Apr 22, 2016 22:25

How do I use tnt.boom from the new TNT API that's coming in 0.4.14?

I want to make a chest that has a tiny tiny chance of exploding when items are moved to and from it, I have the latest build of Minetest and Minetest_game from Git, and I have the position part of "tnt.boom(position, definition)" down, but I don't know how to fill in "definition".
 

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

Re: Post your modding questions here

by Krock » Sat Apr 23, 2016 12:13

TortueGaming wrote:but I don't know how to fill in "definition".


https://github.com/minetest/minetest_ga ... i.txt#L220
It is the same definition like you would use to register a TNT node but you won't need to define the keys "name", "description" and "tiles" for your function call.
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>
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Sat Apr 23, 2016 17:52

I use a method for to search the generated mapblock with jungletree

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
-- small algorithm to detect generation jungles.
minetest.register_on_generated(function(minp, maxp, seed)
   
   -- check height
   if maxp.y < 10 or minp.y > 90 then return end
   
   -- center pos
   local cp = vector.add(minp, 40)
   
   -- load map
   minetest.get_voxel_manip():read_from_map(minp, maxp)
   
   -- search jungle tree
   if minetest.find_node_near(cp, 40, {"default:jungletree"}) == nil then return end
   
   -- More code ...
   
end)

This algorithm seems to work fine, but does not seem to be very efficient for computer processing.
Does anyone have an algorithm that performs the same function?
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: Post your modding questions here

by MineYoshi » Sun Apr 24, 2016 19:15

A simple question, how to make when i eat, by example: "test:test_food" give me a text, heal me and be replaced by another item???
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
ErrorNull
Member
 
Posts: 94
Joined: Thu Mar 03, 2016 00:43

Re: Post your modding questions here

by ErrorNull » Sun Apr 24, 2016 22:59

Topic: Immediately halting player's movement

I'm making a mod that needs to freeze a player's movement immediately upon a timer hitting zero. However, I've found that if the player happens do be moving at that moment (up/down/left/right movement key pressed down) and when my timer hits zero.. player:set_physics_override({speed=0}) ...does not register until AFTER the player releases the input... resulting in the player sliding/gliding indefinitely until hitting an obstacle or dropping down a node.

If player was not moving at the time my timer hits, player:set_physics_override({speed=0}) functions as expected and player can longer move.

Is there anything I can do to remedy this? Is there a way to block or ignore player input?
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Mon Apr 25, 2016 00:06

ErrorNull wrote:Topic: Immediately halting player's movement

I'm making a mod that needs to freeze a player's movement immediately upon a timer hitting zero. However, I've found that if the player happens do be moving at that moment (up/down/left/right movement key pressed down) and when my timer hits zero.. player:set_physics_override({speed=0}) ...does not register until AFTER the player releases the input... resulting in the player sliding/gliding indefinitely until hitting an obstacle or dropping down a node.

If player was not moving at the time my timer hits, player:set_physics_override({speed=0}) functions as expected and player can longer move.

Is there anything I can do to remedy this? Is there a way to block or ignore player input?

Have you tried treat the player as a entity, SAO object ? (I dunno the right terminology)...
player:setacceleration({x=0, y=0, z=0})
player:setvelocity({x=0, y=0, z=0})
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
ErrorNull
Member
 
Posts: 94
Joined: Thu Mar 03, 2016 00:43

Re: Post your modding questions here

by ErrorNull » Mon Apr 25, 2016 03:23

iangp wrote:Have you tried treat the player as a entity, SAO object ? (I dunno the right terminology)...
player:setacceleration({x=0, y=0, z=0})
player:setvelocity({x=0, y=0, z=0})


Thanks for the pointers iangp. I tried inserting both into my code, but neither made any effect to the outcome. I'm still still fairly new to modding minetest and this is just my first mod. I'll need to into working with SAO entity objects. How would I treat the player as an SAO entity? The lua_api.txt states that those functions are "LuaEntitySAO-only (no-op for other objects)" .. so not sure if I can work with these?
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Mon Apr 25, 2016 06:55

It's not possible ATM to modify the player velocity, and the physics override as you say suffer from some misfeatures(though they may actually be useful).

I suggest creating a dummy, invisible entity at the player's position, and attaching the player to it. Look for `set_attach` in the Minetest API.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Mon Apr 25, 2016 11:06

MineYoshi wrote:A simple question, how to make when i eat, by example: "test:test_food" give me a text, heal me and be replaced by another item???


I think you want on_use
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Mon Apr 25, 2016 11:33

@ErrorNull and @kaeza XD I have a bad memory...
I have missed that: http://dev.minetest.net/ObjectRef
"Note that all ObjectRefs except player are actually LuaEntitySAO."
I just had misremembered ObjectRef as LuaEntitySAO...

-- thats just pseudo-pseudo-code, read the about the right syntax on api_lua.txt
-- As cabeza said try to make a dummy entity:
minetest.register_entity("dummy" ... blablabla.. invisible textures... little size... not pointable...
-- Now you just call it when the timer hit zero, If i'm not wrong... but, whatever, its computationally acceptable to test it...
dummy = minetest.entity_add( on player position, the "dummy" object...
player:set_attach(dummy, "", {0,0,0}, {0,0,0}) --set_attach(parent, bone, position, rotation)`
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
xeranas
Member
 
Posts: 99
Joined: Fri Feb 05, 2016 11:06
GitHub: xeranas

Re: Post your modding questions here

by xeranas » Mon Apr 25, 2016 20:25

How I can reset player skybox to default server? I want temporally change user skybox and then return to 'normal'.
 

User avatar
Foghrye4
Member
 
Posts: 24
Joined: Sun Mar 13, 2016 13:38
IRC: Foghrye4
In-game: Foghrye4

Re: Post your modding questions here

by Foghrye4 » Sat May 07, 2016 10:28

xeranas wrote:How I can reset player skybox to default server? I want temporally change user skybox and then return to 'normal'.

save player:get_sky() parameters somewhere, then call them back.

My question.
When i call minetest.sound_stop(whatever) in a middle of a sound i heard a nasty clicks. Calling it exactly on an end of a track is not an option, because it is looped. Is this a bug of OS audio driver or game, or Irrlicht engine? Can i workaround this somehow?
 

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

Re: Post your modding questions here

by burli » Sat May 07, 2016 12:08

I have a question about this thread. Why?

From my experience with forums (I'm hosting my own forum since 16 years) threads like this doesn't make sense.

- Any answer is lost in over 100 of pages.
- No one can find an answer with the search function
- No one can link to an answer if someone asks an already answered question
- Discussions from different questions can be mixed and confuse more then they help.

It would make more sense to make a modding question subforum instead of this monster thread.

Just my two cent
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Post your modding questions here

by benrob0329 » Tue May 10, 2016 19:00

Image

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("usable_decor:cabnet", {
   description = "Wood Cabnet",
   drawtype = "mesh",
   mesh = "usable_decor_cabnet.b3d",
   tiles = {"usable_decore_cabnet.png", "usable_decore_cabnet.png"}
})


Any ideas as to why its black when placed, but not when wielded?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Tue May 10, 2016 19:49

benrob: add: paramtype = "light", to the node definition.
 

Amaz
Member
 
Posts: 328
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: Post your modding questions here

by Amaz » Tue May 10, 2016 20:32

benrob0329 wrote:...
Any ideas as to why its black when placed, but not when wielded?


Try adding paramtype = "light", to the node def.
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Post your modding questions here

by benrob0329 » Tue May 10, 2016 20:50

That worked, now I just have to figure out how to import a b3d back into Blender because I forgot to save it as a blend too...
 

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 » Tue May 10, 2016 21:18

benrob0329 wrote:That worked, now I just have to figure out how to import a b3d back into Blender because I forgot to save it as a blend too...


If it's not animated, make it an .obj file instead (waveform object). Those can be directly opened by blender.
 

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

Re: Post your modding questions here

by Don » Tue May 10, 2016 21:54

Set paramtype = "light",
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
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Post your modding questions here

by benrob0329 » Tue May 10, 2016 22:04

sofar wrote:
benrob0329 wrote:That worked, now I just have to figure out how to import a b3d back into Blender because I forgot to save it as a blend too...


If it's not animated, make it an .obj file instead (waveform object). Those can be directly opened by blender.


That helped get rid of some weird UV distortion as well, though now I have weird connected vertices...

Image

EDIT: Never mind, figured it out.
 

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 » Tue May 10, 2016 22:38

benrob0329 wrote:
sofar wrote:
benrob0329 wrote:That worked, now I just have to figure out how to import a b3d back into Blender because I forgot to save it as a blend too...


If it's not animated, make it an .obj file instead (waveform object). Those can be directly opened by blender.


That helped get rid of some weird UV distortion as well, though now I have weird connected vertices...

EDIT: Never mind, figured it out.


UV unmapping can be challenging :)
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Post your modding questions here

by benrob0329 » Tue May 10, 2016 23:16

Everything should be lining up perfectly:

Image

But its not...

Image
 

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 » Tue May 10, 2016 23:36

benrob0329 wrote:Everything should be lining up perfectly:

But its not...


You've got triangular faces with different sizes, they don't UV unmap the way you think they do.

Split the Stone texture stuff into different faces, so that the stone side is a separate face, and the triangle stuff disappears.
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Post your modding questions here

by benrob0329 » Wed May 11, 2016 00:20

Not perfect, but MUCH better:

Image
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 10 guests

cron