Post your modding questions here

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

Instead of using g() you can just write
var = minetest.setting_get(value) or default
Much shorter than defining g().
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

Re: Post your modding questions here

by firefox » Post

license question:

if i use a mod or parts of a mod in my subgame,
but i edit/change the mod content, what do i write into the "license.txt"?
✨🏳️‍🌈♣️✨

User avatar
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
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 Desour » Post

pithy wrote:@DS-minetest: Your signature uses the word too. I do not think it means what you think it means.
is it better now?
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your modding questions here

by Linuxdirk » Post

pithy wrote:@Linuxdirk: To add a setting to the configuration UI see settingtypes.txt in lua_api.txt.
So settingtypes.txt isn’t for games only but mods can use it, too? But I guess with this I still have to make sure to use some kind of validation of the used configuration option actually exists in minetest.conf, right?
orwell wrote:Instead of using g() you can just write
var = minetest.setting_get(value) or default
Much shorter than defining g().
Currently it isn't for better flexibility but g() could be extended to automatically prefix the option. Writing local var = g('parameter', 'default') to me is much shorter than writing local var = minetest.setting_get('my_cool_mod_pefix_parameter') or 'default'

Of course it makes no sense to use a function when only requesting one or two parameters. But I use this function in my entire mod pack and all of the possible values are configurable through options.

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Post

DS-minetest wrote:
pithy wrote:@DS-minetest: Your signature uses the word too. I do not think it means what you think it means.
is it better now?
Yes it is better.
Linuxdirk wrote:
pithy wrote:@Linuxdirk: To add a setting to the configuration UI see settingtypes.txt in lua_api.txt.
So settingtypes.txt isn’t for games only but mods can use it, too? But I guess with this I still have to make sure to use some kind of validation of the used configuration option actually exists in minetest.conf, right?
Yes mods can have a settingtypes.txt to.

If it is not in minetest.conf then the value is nil.

Germans like to use the word too.

Image

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Post your modding questions here

by Linuxdirk » Post

pithy wrote:Yes mods can have a settingtypes.txt to.

If it is not in minetest.conf then the value is nil.
Just checked and rewrote my modpack so it uses the file. Too bad it's stated nowhere that this is possible for mods, too.
pithy wrote:Germans like to use the word too.
Wenn du willst, können wir auch gern auf Deutsch weiterdiskutieren. Ansonsten lasse mich bitte aus diesem OT-Quatsch raus. :)

ABJ
Member
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
GitHub: ABJ-MV
In-game: ABJ
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.

Re: Post your modding questions here

by ABJ » Post

idiocy mod

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Post

Linuxdirk wrote: Wenn du willst, können wir auch gern auf Deutsch weiterdiskutieren. Ansonsten lasse mich bitte aus diesem OT-Quatsch raus. :)
Google Übersetzer funktioniert gut.

Vielleicht sollte ich aufhören, ich bin sowieso schlecht.

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

Question:
If I wanted multiple blocks to be placed when I place one block, how would I make that happen? Also dependent on what direction player is facing?
eg- place one block and 2 "spawn" stacked on top and 3 "spawn" stacked next to it
[][]
[][] <------like that
[][]
^
Say that is the original block.
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

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

Re: Post your modding questions here

by D00Med » Post

When the block is placed(on_construct), check if the block beside is empty(ie: air), and then use minetest:set_node(pos, {name="nodename"}).
Like this:

Code: Select all

on_construct = function(pos, node, _)
		local under = {x=pos.x, y=pos.y-1, z=pos.z}
		if minetest.get_node(under).name == "air" then
		minetest.set_node(under, {name = "test:node"})
		end
	end,
But I don't know about making it dependant on the direction the player faces
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

User avatar
RHR
Member
Posts: 215
Joined: Mon Jan 27, 2014 20:07
GitHub: RHRhino

Re: Post your modding questions here

by RHR » Post

GreenDimond wrote:Question:
If I wanted multiple blocks to be placed when I place one block, how would I make that happen? Also dependent on what direction player is facing?
eg- place one block and 2 "spawn" stacked on top and 3 "spawn" stacked next to it
[][]
[][] <------like that
[][]
^
Say that is the original block.
D00Med wrote:When the block is placed(on_construct), check if the block beside is empty(ie: air), and then use minetest:set_node(pos, {name="nodename"}).
Like this:

Code: Select all

on_construct = function(pos, node, _)
		local under = {x=pos.x, y=pos.y-1, z=pos.z}
		if minetest.get_node(under).name == "air" then
		minetest.set_node(under, {name = "test:node"})
		end
	end,
But I don't know about making it dependant on the direction the player faces
I think it is probably better to place them as schematics

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

D00Med wrote:When the block is placed(on_construct), check if the block beside is empty(ie: air), and then use minetest:set_node(pos, {name="nodename"}).
Like this:

Code: Select all

on_construct = function(pos, node, _)
		local under = {x=pos.x, y=pos.y-1, z=pos.z}
		if minetest.get_node(under).name == "air" then
		minetest.set_node(under, {name = "test:node"})
		end
	end,
But I don't know about making it dependant on the direction the player faces
W̶h̶e̶r̶e̶ ̶d̶o̶ ̶I̶ ̶p̶u̶t̶ ̶t̶h̶a̶t̶ ̶a̶n̶d̶ ̶h̶o̶w̶?̶ ̶(̶W̶h̶e̶r̶e̶ ̶i̶n̶ ̶t̶h̶e̶ ̶c̶o̶d̶e̶)̶
I̶ ̶t̶r̶i̶e̶d̶ ̶p̶u̶t̶t̶i̶n̶g̶ ̶a̶f̶t̶e̶r̶ ̶s̶o̶u̶n̶d̶s̶ ̶b̶u̶t̶ ̶d̶i̶d̶n̶t̶ ̶w̶o̶r̶k̶ ̶:̶P̶
EDIT: Figured that out, but the amount of blocks placed is infinite in that direction until obstructed... also, sounds don't seem to work. Keeps saying 'default' is nil in the default.node_sound_wood_defaults().
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

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

Re: Post your modding questions here

by D00Med » Post

Oh yes I forgot to mention that, just make it check if there is not already a the same node 2 nodes above.
have you listed default as a dependancy?
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Post

How do I use listcolors twice in a formspec?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

You mean upper inventory blue and lower red?
I think this isn't possible as of now.
But you could make a background and make slot background transparent
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Post

^Thats what I was thinking I might have to do.

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

Re: Post your modding questions here

by Nyarg » Post

Hi folks )
Is it right if attached entity (to other entity) disappear after restart singleplayer game ?

simplified code here:
Spoiler

Code: Select all

	
local a = minetest.add_entity( pos, Proto)	
local b = minetest.add_entity( pos, Proto)	
	
b:set_attach( a, "", {  x=10,  y=0, z=0},    {x=0, y=0, z=0}) 
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
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
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 Desour » Post

i think no, it only gets detached
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

Is there an on_player_construct function or anything? Using on_construct makes an infinite tower. If there was a construct function specific to a player placing a block, I would like to know what it is.
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Post

Use "after_place_node" in the node def.

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

Gave up on what I was doing. :P
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: Post your modding questions here

by ExeterDad » Post

Is it possible to override a chat command registered by a mod to check for a condition? If so, how do I target it? Or would it be better to override the entire mod?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

Yes you can, and that's cool about lua. You should avoid this practice, but here's how:
1. depend on the mod that registers the chatcommand, so that it loads first
2. take it and modify the function:

Code: Select all

local original_func = minetest.chatcommands["chatcommandname"].func
minetest.chatcommands["chatcommandname"].func = function (name, param)
        if your condition here then
                original_func(name, param)
        end
end
It's important that you understand what you're doing:
you are saving the original function that the mod registered as local variable, then you define a new function that replaces the original chatcommand's function with the above code.
if you condition is true, you call the original function.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Big signs

by hajo » Post

For Wild-West - themed buildings, I would need big signs on houses,
such as "Bank", "Saloon", "General Store", etc.

Obviously, I could make textures with parts of such a text,
(or just single big letters) to put on blocks.

Is there a better / more general way than to do it ?
E.g. a block made of 2 different materials, and a surface-pattern,
that makes it look like those ore-blocks. but shaped like a letter/symbol.

There is a mod for traffic-signs, and an idea for a sign-making machine, but still WIP.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

You could make one big mesh and place the sign texture on it. That mesh would then span ~5 nodes but only occupies the node you placed it to.
The homedecor soda vending machine is actually a mesh being 2 nodes high and having a texture. Or have a look at the rails from my trains mod.
- model it in blender and unwrap (detailed info on how to make textures for models you find on youtube)
(1 blender unit equals 1 node)
- export as b3d and write SALOON on the texture
- make a drawtype=mesh node in MT.
Last edited by orwell on Mon Dec 05, 2016 20:34, edited 1 time in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Locked

Who is online

Users browsing this forum: No registered users and 17 guests