Post your modding questions here

Locked
User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

Re: Post your modding questions here

by stu » Post

Hybrid Dog wrote:
stu wrote:I would also like to know the version number when [colorize was added, ie was it before or after the release of 0.4.11?
https://github.com/minetest/minetest/co ... c/tile.cpp
ctrl+f can help you (if you use firefox)
Ah, so not part of current 'stable' then, thanks.

I still would like to know what 'mask' is for, I was kinda hoping it would allow me to colorize only a specific part of a texture but maybe I have the wrong idea altogether?

mcrefugee
New member
Posts: 4
Joined: Mon Sep 29, 2014 19:32

Re: Post your modding questions here

by mcrefugee » Post

Hi,

I'm working on a mod, and I need to know which side of a node is clicked.
To put it simply, I put a block (let's call it block_a) on the ground and when I click it with a special tool I want to put a block to the right hand side of block_a (relative to the player's position).
Of course the right hand side is different depending on where the player is standing at the moment of clicking.

Currently I can put my special block_a on the ground and click it with special tool. That is no problem. I can detect the click and put extra blocks in my world. That's no problem either.

But how to determine which block is to the right of the clicked block?

Alternatively is it possible to have a 'front' side to a node? And if that is possible, how to determine the node to the right of the 'front' side?

Any help is greatly appreciated.

TriBlade9
Member
Posts: 89
Joined: Fri Sep 05, 2014 09:35

Re: Post your modding questions here

by TriBlade9 » Post

mcrefugee, get the player's position, then the node's position, and from there it should be quite easily to calculate.

player:getpos() will give you the player position, and the node position is provided in the rightclicking callback.

User avatar
Fox
New member
Posts: 7
Joined: Mon Jan 26, 2015 00:36

Re: Post your modding questions here

by Fox » Post

Hello all,

Topic: Understanding some bits of tool capabilities?

Reason: I'd just like to understand some parts so I can know what's going on when I make my own tools.

More Info: Let's take the default stone pickaxe.

Code: Select all

minetest.register_tool("default:pick_stone", {
	description = "Stone Pickaxe",
	inventory_image = "default_tool_stonepick.png",
	tool_capabilities = {
		full_punch_interval = 1.3,
		max_drop_level=0,
		groupcaps={
			cracky = {times={[2]=2.0, [3]=1.20}, uses=20, maxlevel=1},
		},
		damage_groups = {fleshy=3},
	},
})
I understand that groupcaps handles what blocks can actually be affected by the tool and how so. I get that uses is tied to the damage inflicted on the tool with use. It's the times and maxlevel part I'm not sure I grasp.

I think the number with fleshy might work similarly?

If someone could help clear up these things, it'd be much appreciated. :)
Last edited by Fox on Wed Jan 28, 2015 22:11, edited 2 times in total.

mectus11
Member
Posts: 14
Joined: Tue Nov 12, 2013 21:32
Location: Tunisia
Contact:

Re: Post your modding questions here

by mectus11 » Post

Topic: How to disable core HUD?
Reason: I'm working on a hud overhaul mod and I'm at that point where I want to disable the core hud elements of the health and breath.
More info: here's a screenshot of the issue I'm having, you can notice it above the hotbar, this issue can be fixed if I edit the game's default core lua files but I want it as a mod so it can be disabled at anytime.
Image

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

Re: Post your modding questions here

by Napiophelios » Post

I think this is how Blockman does it with the Hud mod,
he doesnt disable it though:

local function hide_builtin(player)

local function custom_hud(player)

mcrefugee
New member
Posts: 4
Joined: Mon Sep 29, 2014 19:32

Re: Post your modding questions here

by mcrefugee » Post

TriBlade9: thank you, I've got it working now.

mectus11
Member
Posts: 14
Joined: Tue Nov 12, 2013 21:32
Location: Tunisia
Contact:

Re: Post your modding questions here

by mectus11 » Post

Napiophelios wrote:I think this is how Blockman does it with the Hud mod,
he doesnt disable it though:

local function hide_builtin(player)

local function custom_hud(player)

Know where I can find his mod or his mod's github and thanks! =)

TriBlade9
Member
Posts: 89
Joined: Fri Sep 05, 2014 09:35

Re: Post your modding questions here

by TriBlade9 » Post

mcrefugee wrote:TriBlade9: thank you, I've got it working now.
Glad to hear it! Can't wait to see your mod.

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

Re: Post your modding questions here

by Hybrid Dog » Post

mcrefugee wrote:Hi,

I'm working on a mod, and I need to know which side of a node is clicked.
To put it simply, I put a block (let's call it block_a) on the ground and when I click it with a special tool I want to put a block to the right hand side of block_a (relative to the player's position).
Of course the right hand side is different depending on where the player is standing at the moment of clicking.
l like this idea.

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

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

mectus11 wrote:
Napiophelios wrote:I think this is how Blockman does it with the Hud mod,
he doesnt disable it though:

local function hide_builtin(player)

local function custom_hud(player)

Know where I can find his mod or his mod's github and thanks! =)
viewtopic.php?id=6342
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
Kalabasa
Member
Posts: 37
Joined: Tue Jan 06, 2015 17:36
GitHub: Kalabasa
IRC: Kalabasa
In-game: Kalabasa

Re: Post your modding questions here

by Kalabasa » Post

Why can't I loop sound without an object attached to it?
insert signature here

User avatar
Kalabasa
Member
Posts: 37
Joined: Tue Jan 06, 2015 17:36
GitHub: Kalabasa
IRC: Kalabasa
In-game: Kalabasa

Re: Post your modding questions here

by Kalabasa » Post

How to get the name of an entity?

Edit:
Answered on IRC:
If object,

Code: Select all

object.get_luaentity().name
If entity

Code: Select all

entity.name
insert signature here

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

Re: Post your modding questions here

by Krock » Post

Kalabasa wrote:Why can't I loop sound without an object attached to it?
You can loop a sound if you specify an object/player or a position.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Fox
New member
Posts: 7
Joined: Mon Jan 26, 2015 00:36

Re: Post your modding questions here

by Fox » Post

Hello again,

While waiting for an answer to my previous question, I came up with another. Haha.

Topic: What is legacy_mineral for?

Reason: To know what it's for. Depending on what it does, maybe I could use it for my custom nodes.

Other Info: In case you don't know what I mean off the top of your head, here it is in the setup for stone.

Code: Select all

minetest.register_node("default:stone", {
	description = "Stone",
	tiles = {"default_stone.png"},
	is_ground_content = true,
	groups = {cracky=3, stone=1},
	drop = 'default:cobble',
	legacy_mineral = true,
	sounds = default.node_sound_stone_defaults(),
})
Thanks for taking the time to read. :)

User avatar
maikerumine
Member
Posts: 1420
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: Post your modding questions here

by maikerumine » Post

I have a real dumb question(s) but they have me in confusion.

I am currently making a variant of the simple mobs mod, with all different characters, quite a few of them all with different attributes, rewards, speeds, etc. They use the same api but the code for all the variants are different. The question is: Does having many mods kill frame rate even if using the same model file? In my mind I think it should be okay but in testing they seem to bog down my game, and I don't want that. Is there a different solution to keeping the multiple mobs in world without losing too many FPS other than reducing the draw distance and amount spawned per chunk?

I imagine no, but had to ask anyway.
Talamh Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
lag01
Member
Posts: 321
Joined: Sun Mar 16, 2014 03:41
GitHub: AndrejIT
IRC: lag01
In-game: lag
Contact:

Re: Post your modding questions here

by lag01 » Post

maikerumine wrote:I have a real dumb question(s) but they have me in confusion.

I am currently making a variant of the simple mobs mod, with all different characters, quite a few of them all with different attributes, rewards, speeds, etc. They use the same api but the code for all the variants are different. The question is: Does having many mods kill frame rate even if using the same model file? In my mind I think it should be okay but in testing they seem to bog down my game, and I don't want that. Is there a different solution to keeping the multiple mobs in world without losing too many FPS other than reducing the draw distance and amount spawned per chunk?

I imagine no, but had to ask anyway.
I think, the most load is created because some resource demanding functions are called too intensive.
For example, if at every server tick every mob call function to find all lua entities around him and checks if this entity is player. Or if at every server tick lua function is called to change every mob position and speed.
When i was tampering "simple mobs" mod for my server, i tried to make such function calls less frequent.

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

Re: Post your modding questions here

by Hybrid Dog » Post

Fox wrote:Hello again,

While waiting for an answer to my previous question, I came up with another. Haha.

Topic: What is legacy_mineral for?

Reason: To know what it's for. Depending on what it does, maybe I could use it for my custom nodes.

Other Info: In case you don't know what I mean off the top of your head, here it is in the setup for stone.

Code: Select all

minetest.register_node("default:stone", {
	description = "Stone",
	tiles = {"default_stone.png"},
	is_ground_content = true,
	groups = {cracky=3, stone=1},
	drop = 'default:cobble',
	legacy_mineral = true,
	sounds = default.node_sound_stone_defaults(),
})
Thanks for taking the time to read. :)
l tried to find "legacy_mineral" (with grep -rl) in other files but it's only in ./games/minimal/mods/default/init.lua and ./games/minetest_game/mods/default/nodes.lua. Maybe it's used for decoration.

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

User avatar
Fox
New member
Posts: 7
Joined: Mon Jan 26, 2015 00:36

Re: Post your modding questions here

by Fox » Post

Hybrid Dog wrote:l tried to find "legacy_mineral" (with grep -rl) in other files but it's only in ./games/minimal/mods/default/init.lua and ./games/minetest_game/mods/default/nodes.lua. Maybe it's used for decoration.
Hello Hybrd Dog,

Yes, I couldn't find it anywhere else either. Not a mention in lua_api.txt. I didn't know if it was maybe an outdated property, something like decoration as you said, or what. I don't seem to see it in the other mods I have either, so maybe it's something I can ignore like everyone else seems to be doing. xD That it doesn't do anything special I might want, maybe even just does nothing.

Just can't help but wonder though.

User avatar
Kalabasa
Member
Posts: 37
Joined: Tue Jan 06, 2015 17:36
GitHub: Kalabasa
IRC: Kalabasa
In-game: Kalabasa

Re: Post your modding questions here

by Kalabasa » Post

Krock wrote:
Kalabasa wrote:Why can't I loop sound without an object attached to it?
You can loop a sound if you specify an object/player or a position.
What about background music? It's a sound that loop-plays globally and not attached to an object.
insert signature here

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

Re: Post your modding questions here

by Hybrid Dog » Post

Fox wrote:
Hybrid Dog wrote:l tried to find "legacy_mineral" (with grep -rl) in other files but it's only in ./games/minimal/mods/default/init.lua and ./games/minetest_game/mods/default/nodes.lua. Maybe it's used for decoration.
Hello Hybrd Dog,

Yes, I couldn't find it anywhere else either. Not a mention in lua_api.txt. I didn't know if it was maybe an outdated property, something like decoration as you said, or what. I don't seem to see it in the other mods I have either, so maybe it's something I can ignore like everyone else seems to be doing. xD That it doesn't do anything special I might want, maybe even just does nothing.

Just can't help but wonder though.
found it: viewtopic.php?p=46658#p46658
l need to remove it from my mod…

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

User avatar
Merlin
Member
Posts: 63
Joined: Tue Dec 09, 2014 22:07
GitHub: sct-0
In-game: my
Location: germany

Re: Post your modding questions here

by Merlin » Post

Thanks for the great explanation 4aiman! :D
I will toy around with it a bit this weekend. I think I'll first do a simple mob similar to Minecrafts slime thingy.

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

how to declare a variable?

by BrunoMine » Post

I know it sounds very simple, but I can not declare variables. Only constants.
example:

Code: Select all

local day = 1;
It does not change value even if I change its value in a function.

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

Re: how to declare a variable?

by Hybrid Dog » Post

brunob.santos wrote:It does not change value even if I change its value in a function.
Which function do you mean?

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

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

Re: how to declare a variable?

by BrunoMine » Post

Hybrid Dog wrote:Which function do you mean?

Code: Select all

local slot1_image = ""

function brazutec_instalar_em_laptop(texture)
	local slot1_imagem = textura
end

brazutec_laptop = {
	desktop = "size[12,9]".. 
		"bgcolor[#080808BB;true]"..
		"image[0,0;15,10;brazutec_desktop.png]"..
		"image[0,0;5,5;"..slot1_imagem.."]",
}
in extra mod

Code: Select all


local new_image = "brazutec_botao_off.png"

minetest.register_on_joinplayer(function(player)
	brazutec_instalar_em_laptop(new_image)
end)
to sum up

Code: Select all

ERROR[main]: 	
ERROR[main]: GUIFormSpecMenu::drawMenu() Draw images unable to load texture:

Locked

Who is online

Users browsing this forum: No registered users and 8 guests