Page 65 of 169

Re: Post your modding questions here

Posted: Fri Jan 23, 2015 20:48
by stu
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?

Re: Post your modding questions here

Posted: Sun Jan 25, 2015 21:50
by mcrefugee
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.

Re: Post your modding questions here

Posted: Sun Jan 25, 2015 22:59
by TriBlade9
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.

Re: Post your modding questions here

Posted: Mon Jan 26, 2015 00:56
by Fox
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. :)

Re: Post your modding questions here

Posted: Mon Jan 26, 2015 05:23
by mectus11
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

Re: Post your modding questions here

Posted: Mon Jan 26, 2015 06:16
by Napiophelios
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)

Re: Post your modding questions here

Posted: Mon Jan 26, 2015 10:54
by mcrefugee
TriBlade9: thank you, I've got it working now.

Re: Post your modding questions here

Posted: Mon Jan 26, 2015 11:05
by mectus11
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! =)

Re: Post your modding questions here

Posted: Mon Jan 26, 2015 11:15
by TriBlade9
mcrefugee wrote:TriBlade9: thank you, I've got it working now.
Glad to hear it! Can't wait to see your mod.

Re: Post your modding questions here

Posted: Mon Jan 26, 2015 16:37
by Hybrid Dog
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.

Re: Post your modding questions here

Posted: Tue Jan 27, 2015 15:06
by Don
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

Re: Post your modding questions here

Posted: Wed Jan 28, 2015 00:51
by Kalabasa
Why can't I loop sound without an object attached to it?

Re: Post your modding questions here

Posted: Wed Jan 28, 2015 14:01
by Kalabasa
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

Re: Post your modding questions here

Posted: Wed Jan 28, 2015 20:05
by Krock
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.

Re: Post your modding questions here

Posted: Wed Jan 28, 2015 22:18
by Fox
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. :)

Re: Post your modding questions here

Posted: Thu Jan 29, 2015 03:13
by maikerumine
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.

Re: Post your modding questions here

Posted: Thu Jan 29, 2015 10:32
by lag01
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.

Re: Post your modding questions here

Posted: Thu Jan 29, 2015 14:45
by Hybrid Dog
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.

Re: Post your modding questions here

Posted: Thu Jan 29, 2015 16:52
by Fox
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.

Re: Post your modding questions here

Posted: Thu Jan 29, 2015 17:05
by Kalabasa
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.

Re: Post your modding questions here

Posted: Fri Jan 30, 2015 16:35
by Hybrid Dog
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…

Re: Post your modding questions here

Posted: Fri Jan 30, 2015 17:01
by Merlin
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.

how to declare a variable?

Posted: Fri Feb 06, 2015 20:30
by BrunoMine
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.

Re: how to declare a variable?

Posted: Fri Feb 06, 2015 20:44
by Hybrid Dog
brunob.santos wrote:It does not change value even if I change its value in a function.
Which function do you mean?

Re: how to declare a variable?

Posted: Fri Feb 06, 2015 20:55
by BrunoMine
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: