Post your modding questions here

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

Re: Comand for suicide

by BrunoMine » Post

Krock wrote:
brunob.santos wrote:there is a command for suicide? Can you show me?

Code: Select all

minetest.register_chatcommand("killme", {
	description = "Kills you",
	func = function(name, param)
		local player = minetest.get_player_by_name(name)
		player:set_hp(0)
	end
})
as if I would want that the player has an empty inventory?

Code: Select all

minetest.register_chatcommand("killme", {
   description = "Kills you",
   func = function(name, param)
      local player = minetest.get_player_by_name(name)
      local invref = player:get_inventory()
      local size = invref:get_size(name)    
          if size == nil then
              player:setpos({x = 100, y = 20, z = 100})
          end
          if size ~= nil then
              player:set_hp(0)
    end
end})
*did not work. Help!
This will serve to fix a bug (to be so)
Last edited by BrunoMine on Thu Jun 26, 2014 19:31, edited 1 time in total.

drkwv
Member
Posts: 102
Joined: Thu Jun 28, 2012 13:48
GitHub: aa6

Re: Post your modding questions here

by drkwv » Post

1. Can I rotate nodebox without rotating textures? Or rotate textures not touching the nodebox. Brick textures are drawed in a way that does not allow any texture rotating.
2. Default brick stairs are glowing in the night on the brick background because of paramtype = "light". Is there a way to fix this glowing for my nodebox brick nodes without affecting the lighting?
Attachments
textures_are_irrotatable2.png
textures_are_irrotatable2.png (602.87 KiB) Viewed 797 times

ZOOOO
New member
Posts: 2
Joined: Thu Jun 26, 2014 20:38
GitHub: ZoSahaal

Re: Post your modding questions here

by ZOOOO » Post

Is it possible to make player names not render if there is no direct sight to it? (e.g. two players separated by a solid wall)

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

Re: Post your modding questions here

by Krock » Post

ZOOOO wrote:Is it possible to make player names not render if there is no direct sight to it? (e.g. two players separated by a solid wall)
This is not possible with the current Lua API. Checking if it's glass or stone in between the two positions (other player and me) would require too much calculations.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

drkwv
Member
Posts: 102
Joined: Thu Jun 28, 2012 13:48
GitHub: aa6

Re: Post your modding questions here

by drkwv » Post

Krock wrote:Checking if it's glass or stone in between the two positions (other player and me) would require too much calculations.
As for me (nobody asked, but anyway), it's ok to not to see a nickname through the glass.

Also, player is not too big, so one can set nicknames not visible by default, then draw an imaginary line from current pos to player pos and check for an obstacles every, say 1 second (because it's okay to not to show nicknames immediately in realtime too!) and then decide if show nickname or not. If, for example, you decide to show nickname but player is not visible at this particular moment, it's okay to show his nickname for a second too, because it will just mean that you spotted him a moment before. So, I probably think that performance is not the problem at all in this type of task.

And you also could use a random probability of showing nickname in situations where it's not clear about how much % of player behind blocks is visible, so people would have a chance to play hide-and-seek still. The main rule is: you're not trying to hide nickname by cycling through all possible situations, you decide a few situations when there is clearly that you need to show it. It can be shown even using timeouts if there is many players around and you have problems with performance (or change checking time interval from 1 to 2 secs). There is no need for high-performant realtime players pos tracking.
Last edited by drkwv on Fri Jun 27, 2014 13:29, edited 2 times in total.

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

Re: Post your modding questions here

by BrunoMine » Post


golthem
Member
Posts: 43
Joined: Tue Jan 21, 2014 20:22
In-game: Golthem

Re: Post your modding questions here

by golthem » Post

Hello!

I'm trying to make a new crafting type for my mod but I'm have some problems, I started out trying to use the crafter mod but that's not working for me, what's the best way to create a new crafting type that a node can use?

ZOOOO
New member
Posts: 2
Joined: Thu Jun 26, 2014 20:38
GitHub: ZoSahaal

Re: Post your modding questions here

by ZOOOO » Post

Krock wrote:
ZOOOO wrote:Is it possible to make player names not render if there is no direct sight to it? (e.g. two players separated by a solid wall)
This is not possible with the current Lua API. Checking if it's glass or stone in between the two positions (other player and me) would require too much calculations.
Do you know which source file has code for rendering players? I have not been able to find it.

Can I use third party libraries in mods?

EDIT.Accidentally pushed submit button
EDIT2. Added another question

User avatar
addi
Member
Posts: 666
Joined: Thu Sep 20, 2012 03:16
GitHub: adrido
Location: Black-Forest, Germany

overlay textures with diffrent resolutions

by addi » Post

i know the questions was answered somewhere in the board, but i cant find it anymore

i have 2 textures i want to overlay:

default_stone.png (16x16)
my_texture.png (64x64)

if i using this: default_stone.png^my_texture.png

it does only show a part of my_texture.png

im happy for each tip i can get. thanks in advance

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

Re: overlay textures with diffrent resolutions

by stu » Post

addi wrote:i know the questions was answered somewhere in the board, but i cant find it anymore

i have 2 textures i want to overlay:

default_stone.png (16x16)
my_texture.png (64x64)

if i using this: default_stone.png^my_texture.png

it does only show a part of my_texture.png

im happy for each tip i can get. thanks in advance
You could use [combine to overlay the 16x16 image at a specific location on the 64x64 image but this is probably not what you want and scaling is not currently supported. There was, however, a pull request sometime ago for a scaling version of [combine this was closed fairly recently.

Another option might be to use a third-party image lib like Lua-GD

User avatar
addi
Member
Posts: 666
Joined: Thu Sep 20, 2012 03:16
GitHub: adrido
Location: Black-Forest, Germany

Re: Post your modding questions here

by addi » Post

ok lots of thanks
than i must look for another way

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Post your modding questions here

by Kilarin » Post

Stupid question time again.
How do I make an error beep? I can find plenty of examples of how to set a sound for a node being walked on or a node being broken, but I can't find an example of just making an "BEEP!" when the user does something wrong.

User avatar
Calinou
Moderator
Posts: 3169
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: Post your modding questions here

by Calinou » Post

Kilarin wrote:Stupid question time again.
How do I make an error beep? I can find plenty of examples of how to set a sound for a node being walked on or a node being broken, but I can't find an example of just making an "BEEP!" when the user does something wrong.

Code: Select all

minetest.sound_play("beep", {gain = 0.5})
or

Code: Select all

minetest.sound_play("beep", {gain = 0.5, pos = player:getpos()})
You need a beep.ogg sound (in mono, not in stereo). gain changes the volume. pos determines the position; if unset, the sound is played position-less throughout the world. Else, the sound will be played near the player, with other players nearby also hearing it (slightly).

When testing sounds, be sure to lower the sound volume (through the game, through the OS or through the hardware), to not end up hearing excessively loud sounds.

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Post your modding questions here

by Kilarin » Post

Thank you very much Calinou!

User avatar
srifqi
Member
Posts: 570
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi
Location: Indonesia

Re: Post your modding questions here

by srifqi » Post

Topic: How to use minetest.register_on_generated?
Reason: I want to make a mod.
More Info: I've tried but I don't know how.

Anyone know why this doesn't work (no error reported).
EDIT:
What's wrong with this code?
Why it can not run in singlenode map?

Code: Select all

minetest.register_on_generated(function(minp, maxp, seed)
	if minp.y < -50 or maxp.y > 50 then
		return
	end
	for x = minp.x, maxp.x do
	for z = minp.z, maxp.z do
		if(minetest.get_node({x = x, y = 0, z = z}).name~="default:cobble") then
			minetest.set_node({x = x, y = 1, z = z}, {name="default:dirt_with_grass"})
			minetest.set_node({x = x, y = 0, z = z}, {name="default:cobble"})
		end
	end
	end
end)
Saya dari Indonesia! · Terjemahkan Minetest! · my mods · My nickname in IPA: /es.rif.qi/

drkwv
Member
Posts: 102
Joined: Thu Jun 28, 2012 13:48
GitHub: aa6

Gracefully replace node upon digging?

by drkwv » Post

Is there a way to tell the client that i'm going to replace the block upon digging? In my mod I use several nodes for damage levels, but a lag between node digging and replacing is noticeable even on my local machine.

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Post

srifqi wrote:Topic: How to use minetest.register_on_generated?
Reason: I want to make a mod.
More Info: I've tried but I don't know how.

Anyone know why this doesn't work (no error reported)
Are you sure it doesn't work? "Generated" means blocks of the map newly created. This means it happens when they are visited for the first time. It won't just change existing pieces of the already generated map (which are loaded from the database, not "generated"). If you use this on an existing world, you will have to travel out to someplace where the map hasn't yet been generated. Otherwise, try it on a brand new world, where the mod is enabled prior to you first logging into it.

acblonde
Member
Posts: 19
Joined: Wed Feb 26, 2014 13:28

Re: Post your modding questions here

by acblonde » Post

how do you enable a mod

User avatar
Casimir
Member
Posts: 1206
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Post

When installed correctly, select a world, click "configure", double click the mod you want to enable, then save. See also: http://wiki.minetest.net/Installing_Mods

User avatar
webdesigner97
Member
Posts: 1328
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97
Location: Cologne, Germany
Contact:

Re: Post your modding questions here

by webdesigner97 » Post

Is it possible to completely disable damage within a game without having to rely on the mainmenu option?

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: Gracefully replace node upon digging?

by prestidigitator » Post

drkwv wrote:Is there a way to tell the client that i'm going to replace the block upon digging? In my mod I use several nodes for damage levels, but a lag between node digging and replacing is noticeable even on my local machine.
I assume you've tried the after_dig_node() callback? If that's not fast enough (it does remove the node before making the callback, you might need to us on_dig() instead. If you don't set this callback, the default is minetest.node_dig(). Examine that function's logic carefully in builtin/item.lua (or builtin/game/item.lua now, I guess) so you know everything your replacement callback might have to do. You'll want to have it call minetest.set_node() or minetest.swap_node() instead of minetest.remove_node().

Interesting thought. It would be a simple enough game feature to add some kind of "dig_replacement" property to the node definition and have minetest.node_dig() check for this property and do a replacement rather than a remove if it exists. A mod could replace that function, but it would be a pain to maintain it in parallel with the game code over time.

User avatar
srifqi
Member
Posts: 570
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi
Location: Indonesia

Re: Post your modding questions here

by srifqi » Post

prestidigitator wrote:try it on a brand new world, where the mod is enabled prior to you first logging into it.
If I use singlenode or math mapgen, it doesn't work (and causing server crash).
But, if i use v6, v7, or indev mapgen, it works.
Saya dari Indonesia! · Terjemahkan Minetest! · my mods · My nickname in IPA: /es.rif.qi/

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Post

srifqi wrote:If I use singlenode or math mapgen, it doesn't work (and causing server crash).
But, if i use v6, v7, or indev mapgen, it works.
Huh. Well, I'm thinking the singlenode and math mapgens don't use those nodes, but it still seems strange that you can't from a mod and that it'll cause a crash. Hmm. It's supposed to be slower outside the on_generated callback, but I'm wondering if it will cause the same crash. You might want to try registering your node changes to be called "later". For example:

Code: Select all

minetest.register_on_generated(
   function(minp, maxp, seed)
      minetest.after(0.1, myOnGeneratedCallbackFunction, minp, maxp, seed);
   end);
Either way it sounds like a defect to me. Does it spit out an error message like it usually does if a mod has an error (e.g. indexing a nil value), or just die without explanation?

User avatar
srifqi
Member
Posts: 570
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi
Location: Indonesia

Re: Post your modding questions here

by srifqi » Post

prestidigitator wrote:Does it spit out an error message like it usually does if a mod has an error (e.g. indexing a nil value), or just die without explanation?
I just type "/grant singleplayer all" and no result from server.
Is it server crash or server lag?
Saya dari Indonesia! · Terjemahkan Minetest! · my mods · My nickname in IPA: /es.rif.qi/

prestidigitator
Member
Posts: 647
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Post

srifqi wrote:I just type "/grant singleplayer all" and no result from server.
Is it server crash or server lag?
Where did you start the server? Can you see any error output in the console there, or in the log file? If you don't have access to the server, it might be difficult to debug server problems....

Locked

Who is online

Users browsing this forum: Semrush [Bot] and 7 guests