Post your modding questions here

User avatar
TumeniNodes
Member
Posts: 2879
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

sofar wrote:
TumeniNodes wrote: ehem... speaking of doors. Would anyone be able to give the nodebox/selection box coords to set doors to the center of blocks, and when open they come a bit into the next node space?
I realize not many like the idea but I would like it for personal use and I do not know how to use the / positions I'm to used to 0.5 type positions.
I already tried it a few times and cannot get it to work, I think mainly due to the hidden part for the hinges.
I also realize some may feel this will break things but I will take full blame on myself if it does :P
it's entirely possible - this is how the fence gate works. But yes, the top door part is an issue, you'll have to make a top door half to create the proper collision box.
Thank you sofar, I'll give it a try again.
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am

User avatar
D00Med
Member
Posts: 943
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: Post your modding questions here

by D00Med » Post

sofar wrote:Did you forget to add `doors` to `depends.txt` ?
Nope, it's there.
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

User avatar
DS-minetest
Member
Posts: 1147
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: Post your modding questions here

by DS-minetest » Post

D00Med wrote:

Code: Select all

local minp = {x=pos.x-5, y=pos.y, z=pos.z-5}
local maxp = {x=pos.x+5, y=pos.y, z=pos.z+5}
local doors = minetest.find_nodes_in_area(minp, maxp, "group:door")
for i = 1, #doors do
	local dpos = {x=doors[i].x, y=doors[i].y, z=doors[i].z}
	local door = doors.get(dpos)
	door:toggle(player)
end
Why does this keep crashing the game? I get this error: "attempt to call field 'get' (a nil value)"
It doesn't happen when there is no door in the area. I did get it to work after using only one position.
maybe you should name the table not doors, like this:

Code: Select all

local minp = {x=pos.x-5, y=pos.y, z=pos.z-5}
local maxp = {x=pos.x+5, y=pos.y, z=pos.z+5}
local doorss = minetest.find_nodes_in_area(minp, maxp, "group:door")
for i = 1, #doorss do
	local dpos = {x=doorss[i].x, y=doorss[i].y, z=doorss[i].z}
	local door = doors.get(dpos)
	door:toggle(player)
end
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

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

by Hybrid Dog » Post

Alternatively you could use following:
local door = _G.doors.get(dpos)

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

JackWilliam
Member
Posts: 10
Joined: Tue Dec 27, 2016 14:41

Re: Post your modding questions here

by JackWilliam » Post

Topic: How to add texture
Reason: I have an error
More Info(optional): hello everyone . I followed the tutorial but I don't understand. I call the image tutorial_decowood end the code is that :

Code: Select all

minetest.register_node("tutorial:decowood", {
	tile_images = {"tutorial_decowood.png"},
	groups={level=1},
})
and the error is :

Code: Select all

ERROR[main]: generateImage(): could not load image "tutorial_decowood.png" while building texture
ERROR[main]:  generateImage(): Creating a dummy image for "tutorial_decowood.png" 
Can anyone help me?

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

Re: Post your modding questions here

by sofar » Post

DS-minetest wrote: maybe you should name the table not doors
ahh yeah, I didn't spot that error. You just overwrote the `doors` global this way.

This kind of programming stuff can be found by luacheck. I strongly recommend you start learning how to use it - it really helps you find bugs early.

User avatar
D00Med
Member
Posts: 943
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: Post your modding questions here

by D00Med » Post

Oh ok, thankyou
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

User avatar
DS-minetest
Member
Posts: 1147
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: Post your modding questions here

by DS-minetest » Post

@JackWilliam:
as you can see in lua_api.txt line 3713:

Code: Select all

tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[
^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images)
^ List can be shortened to needed length ]]
=> its called "tiles", not "tile_images"
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

JackWilliam
Member
Posts: 10
Joined: Tue Dec 27, 2016 14:41

Re: Post your modding questions here

by JackWilliam » Post

thanks DS-minetest, I have modified the code, but the error is still there.
the node in game is like this:
error.PNG
(757.56 KiB) Not downloaded yet
and the color change when I restart minetest or when I try to mine the node.

User avatar
Krock
Developer
Posts: 4577
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Post your modding questions here

by Krock » Post

JackWilliam wrote:and the color change when I restart minetest or when I try to mine the node.
This error happens when the texture could not be found.
Check or create a texture at the location mods/tutorial/textures/tutorial_decowood.png. Make sure it's exactly that path, otherwise Minetest will not be able to find the texture.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Tmanyo
Member
Posts: 196
Joined: Mon Sep 29, 2014 01:20
GitHub: Tmanyo
IRC: Tmanyo
In-game: tmanyo
Location: United States
Contact:

Re: Post your modding questions here

by Tmanyo » Post

Is there a way to tie detached inventories into meta data?
Tmanyo
http://www.rrhmsservers.ml
Servers I Host:
Tmanyo-Realism
Mods of mine that I don't totally hate:
Bank Accounts
T-Rating
Tmusic Player

JackWilliam
Member
Posts: 10
Joined: Tue Dec 27, 2016 14:41

Re: Post your modding questions here

by JackWilliam » Post

Krock wrote: This error happens when the texture could not be found.
Check or create a texture at the location mods/tutorial/textures/tutorial_decowood.png. Make sure it's exactly that path, otherwise Minetest will not be able to find the texture.
Yes I know but the path is correct. Can be the editor?? I use Geany.

User avatar
Napiophelios
Member
Posts: 1025
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Post

try making a folder in the texture pack directory and place the image there too.
then select your new "texture pack" when you start the game.

Almost every time I get this error it's because I mispelt something somewhere.

Nyarg
Member
Posts: 276
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Post

DS-minetest wrote:as much as i know you cant save metadata in entities but you could save something in staticdata
It's looks like metadata ~= staticdata ?
orwell wrote: ... ObjectRef
... get it's luaentity (the lua table that is "self" ...)
... write stuff into it.
Thank you all now it works )
But little question still yet. What exactly data of entity will be saved in world file when server shutdown ?
Is wiki have somewhere the explanation what data structures will be save ?

Some mods and get_staticdata() seems like only scripter need carry about save and init each entity with unique data.
I am a noob. still yet. Not so noob ) [vml] WIP and a little proof for fun PlantedTorch )))
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )

User avatar
DS-minetest
Member
Posts: 1147
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: Post your modding questions here

by DS-minetest » Post

to save data from the entity for the next load you use the get_staticdata function
return <what you need (only strings, to make tables to strings use minetest.de-/serialize, note: this doesnt work with userdata)>
then write into the on_activate(self, staticdata, dtime_s)
and use staticdata as the returned string
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: Post your modding questions here

by ManElevation » Post

can some one write a block lua script. just a plain block
with a {"front.png"} a {"side.png"} and a {"top.png"} {"back.png"}

a full one pleas
My Public Mods! Discord: Rottweiler Games#3368

User avatar
Napiophelios
Member
Posts: 1025
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Post

ManElevation wrote:can some one write a block lua script. just a plain block
with a {"front.png"} a {"side.png"} and a {"top.png"} {"back.png"}
a full one pleas
test_node.zip
basic block nodes
(124.31 KiB) Downloaded 30 times
Image
basic_blocks.png
(174.38 KiB) Not downloaded yet

User avatar
GreenXenith
Member
Posts: 1334
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
IRC: GreenXenith
In-game: GreenXenith
Location: The singularity
Contact:

Re: Post your modding questions here

by GreenXenith » Post

For my Sandplus Mod, I would like to add an ability to have a recipe canceled and replaced with a grinder recipe if the technic mod is enabled. I know I would have to use something along the lines of "if minetest.get_modpath("technic") then...", and somewhere in there the technic grinding recipe (table.insert(recipes, {"modname:node1", "modname:node2"})), but I don't know how to do this. Help?
EDIT: I think I got it :P
Y▹uTube | Mods | Patre●n | Twitter | Minetest Discord | GreenXenith#3232

Hey, you. You're finally awake.
You were trying to view their profile, right? Found the rest of their signature, same as us, and that guest over there.

User avatar
BrunoMine
Member
Posts: 1076
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

Re: Post your modding questions here

by BrunoMine » Post

Is there a way to track the status of a player?

For example, if the player is in a car, bed, boat, helicoter and others.

Is there a unified way of checking this sort of thing?
I'd like to know how to control these things to prevent a player from being able to make and control multiple cars simultaneously, or even crash the server.

JackWilliam
Member
Posts: 10
Joined: Tue Dec 27, 2016 14:41

Re: Post your modding questions here

by JackWilliam » Post

Napiophelios wrote:try making a folder in the texture pack directory and place the image there too.
then select your new "texture pack" when you start the game.

Almost every time I get this error it's because I mispelt something somewhere.
Thanks a lot, now it works fine. I have another question, how can I put a node on the map such as the diamond block, coal, gold, etc.?

User avatar
yzelast
Member
Posts: 54
Joined: Sun Oct 02, 2016 01:18
GitHub: yzelast
In-game: yzelast
Location: Far Far Away

Re: Post your modding questions here

by yzelast » Post

hi guys,i have a few questions about node timers.

If a timer end in an unloaded mapblock what will happen with the code inside the on_timer function?
And how i do to make a node timer stop decreasing on night, and return to decrease on day?

If i could pause the timers at night my trees mod will benefits a lot,making the growing more precise.
G84mU6AQ9dKaNhxn6dq8P5C0y5r8NssE

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

Re: Post your modding questions here

by sofar » Post

yzelast wrote:hi guys,i have a few questions about node timers.

If a timer end in an unloaded mapblock what will happen with the code inside the on_timer function?
And how i do to make a node timer stop decreasing on night, and return to decrease on day?

If i could pause the timers at night my trees mod will benefits a lot,making the growing more precise.
You can't dynamically put code in `on_timer()`, it has to be known at init time, so the code is always known no matter what.

The default trees in the game use node timers and if the timer elapses during the night, the growth is attempted again and again every 2 minutes or so until light levels are in order.

Postponing a node timer is possible, but not on unloaded blocks, so you need to do this in the `on_timer()` function.

If a node timer expires while the block is unloaded, the node timer code for that node is run as soon as the block is loaded. Unlike ABM's, nodetimers are never skipped.

Making a node timer stop decreasing at night is pretty much not possible, not reliably anyway. You're better off finding an algorithm that works for you that doesn't require that type of mechanism.

User avatar
yzelast
Member
Posts: 54
Joined: Sun Oct 02, 2016 01:18
GitHub: yzelast
In-game: yzelast
Location: Far Far Away

Re: Post your modding questions here

by yzelast » Post

sofar wrote:
yzelast wrote:hi guys,i have a few questions about node timers.

If a timer end in an unloaded mapblock what will happen with the code inside the on_timer function?
And how i do to make a node timer stop decreasing on night, and return to decrease on day?

If i could pause the timers at night my trees mod will benefits a lot,making the growing more precise.
You can't dynamically put code in `on_timer()`, it has to be known at init time, so the code is always known no matter what.

The default trees in the game use node timers and if the timer elapses during the night, the growth is attempted again and again every 2 minutes or so until light levels are in order.

Postponing a node timer is possible, but not on unloaded blocks, so you need to do this in the `on_timer()` function.

If a node timer expires while the block is unloaded, the node timer code for that node is run as soon as the block is loaded. Unlike ABM's, nodetimers are never skipped.

Making a node timer stop decreasing at night is pretty much not possible, not reliably anyway. You're better off finding an algorithm that works for you that doesn't require that type of mechanism.
Thanks,i think that my mod will not care if a tree grow at night,taking the right time is enough for me.
I asked about the timers because i don't want to face unexpected behavior with it, because my entire mod is basically timers and abm's
G84mU6AQ9dKaNhxn6dq8P5C0y5r8NssE

petra2201
Member
Posts: 30
Joined: Fri Jun 05, 2015 14:42

Re: Post your modding questions here

by petra2201 » Post

Topic: Where to put code for stairs.
Reason: I've made a mod for indestructible obsidian and my stairs keep blowing up.

In all my other nodes I can put code in the code block marked minetest.register_node.
However in stairs that codeblock is listed in an if else and no matter where I put my code in the code blocks my stairs keep blowing up. The rest of my nodes (block, door, glass) work great.

User avatar
TumeniNodes
Member
Posts: 2879
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

petra2201 wrote:Topic: Where to put code for stairs.
Reason: I've made a mod for indestructible obsidian and my stairs keep blowing up.

In all my other nodes I can put code in the code block marked minetest.register_node.
However in stairs that codeblock is listed in an if else and no matter where I put my code in the code blocks my stairs keep blowing up. The rest of my nodes (block, door, glass) work great.
do stairs register instead. stairs is a separate mod from default
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am

Locked

Who is online

Users browsing this forum: No registered users and 2 guests