drkwv wrote:Do minetest.get_node_light(pos) working? I'm getting 0 all the time.
pos.y = pos.y+1
brunob.santos wrote:there is a command for suicide? Can you show me?
minetest.register_chatcommand("killme", {
description = "Kills you",
func = function(name, param)
local player = minetest.get_player_by_name(name)
player:set_hp(0)
end
})
Krock wrote:brunob.santos wrote:there is a command for suicide? Can you show me?Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- 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
})
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})
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)
Krock wrote:Checking if it's glass or stone in between the two positions (other player and me) would require too much calculations.
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.
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
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.
minetest.sound_play("beep", {gain = 0.5})
minetest.sound_play("beep", {gain = 0.5, pos = player:getpos()})
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)
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)
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.
prestidigitator wrote:try it on a brand new world, where the mod is enabled prior to you first logging into it.
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.
minetest.register_on_generated(
function(minp, maxp, seed)
minetest.after(0.1, myOnGeneratedCallbackFunction, minp, maxp, seed);
end);
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?
srifqi wrote:I just type "/grant singleplayer all" and no result from server.
Is it server crash or server lag?
Users browsing this forum: No registered users and 1 guest