PilzAdam wrote:What do you mean by "them" in the last sentence? The oregen types?
I mean all of the code snippets.
Is there another useful ore_type than scatter?
PilzAdam wrote:What do you mean by "them" in the last sentence? The oregen types?
Krock wrote:Is there another useful ore_type than scatter?
ore_type = "scatter", -- See "Ore types"
All default ores are of the uniformly-distributed scatter type.
- scatter
Randomly chooses a location and generates a cluster of ore.
If noise_params is specified, the ore will be placed if the 3d perlin noise at
that point is greater than the noise_threshhold, giving the ability to create a non-equal
distribution of ore.
- sheet
Creates a sheet of ore in a blob shape according to the 2d perlin noise described by noise_params.
The relative height of the sheet can be controlled by the same perlin noise as well, by specifying
a non-zero 'scale' parameter in noise_params. IMPORTANT: The noise is not transformed by offset or
scale when comparing against the noise threshhold, but scale is used to determine relative height.
The height of the blob is randomly scattered, with a maximum height of clust_size.
clust_scarcity and clust_num_ores are ignored.
This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods.
- claylike - NOT YET IMPLEMENTED
Places ore if there are no more than clust_scarcity number of specified nodes within a Von Neumann
neighborhood of clust_size radius.
after_place_node = function (pos,placer)
mysound = minetest.sound_play("Sound_Black",
{pos = pos, gain = 1.0, max_hear_distance = 40,})
end,
on_punch = function(pos, node, player, itemstack)
if mysound then
minetest.sound_stop(mysound)
if !mysound then
mysound = minetest.sound_play("Sound_Black",
{pos = pos, gain = 1.0, max_hear_distance = 40,})
end
end
end
philipbenr wrote:Topic: Callbacks
So I want to make a nice disco/audio player mod, and yes I know there are others out there, but I want the experience.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
after_place_node = function (pos,placer)
mysound = minetest.sound_play("Sound_Black",
{pos = pos, gain = 1.0, max_hear_distance = 40,})
end,
on_punch = function(pos, node, player, itemstack)
if mysound then
minetest.sound_stop(mysound)
if !mysound then
mysound = minetest.sound_play("Sound_Black",
{pos = pos, gain = 1.0, max_hear_distance = 40,})
end
end
end
When I place the node, The sound starts, and I want it so the sound is toggled on and off by punching the node.
How do I say if not sound then play sound. I have tried if not mysound, and !mysound but none have worked. help? :\
on_punch = function(pos, node, player, itemstack)
if mysound then
minetest.sound_stop(mysound)
mysound = nil
else
mysound = minetest.sound_play("Sound_Black",
{pos = pos, gain = 1.0, max_hear_distance = 40,})
end
end
on_rightclick = function(pos, node, player, itemstack <-- Here?, pointed_thing)
--Or Somewhere down here?
main_menu_tab = server
name = pandaro
server_dedicated = false
fixed_map_seed = 1
main_menu_last_game_idx = 4
mainmenu_last_selected_world = 2
selected_world_path = /home/p/minetest/0.49.1/bin/../worlds/sdcs
enable_shaders = false
enable_damage = false
port = 30000
server_announce = true
address = 192.168.0.2
remote_port = 30000
creative_mode = true
num_emerge_threads = 2
mg_name = v7
mgv7_np_terrain = 0, 1, (1, 1 1), 1, 1, 1
mgv7_np_bgroup = 0, 1, (1, 1, 1), 1, 1, 1
mgv7_np_heat = 0, 1, (1, 1, 1), 1, 1, 1
mgv7_np_humidity = 0, 1, (1, 1, 1), 1, 1, 1
qwrwed wrote:I think you type the actual seed in the fixed_map_seed parameter.
pandaro wrote:So the question is:
I want to test a terrain generator , for example mapgenv7
I want to first of all that the world created is always the same, to do this, it is enough, when I create a world, give it a name, and select a fixed seed, such as the 1 seed.
Now the problem, I want, from file minetest. conf, the generator reads some parameters such as:
# mgv7_np_terrain = 10, 12, (350, 350, 350), 82 341, 5, 0.6
# mgv7_np_bgroup = 0.5, 0.3125, (350, 350, 350), 5923, 2, 0.6
# mgv7_np_heat = 25, 50, (500, 500, 500), 35293, 1, 0
# mgv7_np_humidity = 50, 31.25, (750, 750, 750), 12094, 2, 0.6
to do this then I compile my minetest.conf that I show it as it is:main_menu_tab = server
name = pandaro
server_dedicated = false
fixed_map_seed = 1
main_menu_last_game_idx = 4
mainmenu_last_selected_world = 2
selected_world_path = /home/p/minetest/0.49.1/bin/../worlds/sdcs
enable_shaders = false
enable_damage = false
port = 30000
server_announce = true
address = 192.168.0.2
remote_port = 30000
creative_mode = true
num_emerge_threads = 2
mg_name = v7
mgv7_np_terrain = 0, 1, (1, 1 1), 1, 1, 1
mgv7_np_bgroup = 0, 1, (1, 1, 1), 1, 1, 1
mgv7_np_heat = 0, 1, (1, 1, 1), 1, 1, 1
mgv7_np_humidity = 0, 1, (1, 1, 1), 1, 1, 1
but I realize that in spite of the parameter fixed_map_seed = 1 the map is different each time.
it seems to me that having or not having completed minetest.conf the generator of the terrain refers only on what I write in the main menu.
How do I create a map by passing minetest.conf?
fixed_map_seed = 66768767867868789
local function read_image(f, bmp, infoheader, hmin, hmax, wmin, wmax)
local i, line, height, dir
height = infoheader.biHeight
line = (height < 0) and 1 or height
dir = (height < 0) and 1 or -1
height = math.abs(height)
print(("[bmpmap.bmp] size=%dx%d bpp=%d"):format(
infoheader.biWidth,
infoheader.biHeight,
infoheader.biBitCount
))
bmp.pixels = { }
for i = 1, height do
local row = { }
if hmin <= i <= hmax then
bmp.pixels[line] = row
end
if infoheader.biBitCount == 24 then
read_24bit_line(infoheader.biWidth, f, row, wmin, wmax)
elseif infoheader.biBitCount == 32 then
read_32bit_line(infoheader.biWidth, f, row, wmin, wmax)
else
return false
end
line = line + dir
end
return true
end
13:34:58: ERROR[main]: ServerError: /root/.minetest/mods/bmpmap/loader_bmp.lua:153: attempt to compare boolean with number
13:34:58: ERROR[main]: stack traceback:
13:34:58: ERROR[main]: /root/.minetest/mods/bmpmap/loader_bmp.lua:153: in function 'read_image'
13:34:58: ERROR[main]: /root/.minetest/mods/bmpmap/loader_bmp.lua:228: in function 'load'
13:34:58: ERROR[main]: /root/.minetest/mods/bmpmap/imageloader.lua:49: in function 'load'
13:34:58: ERROR[main]: /root/.minetest/mods/bmpmap/mapgen.lua:37: in function '?'
Landrover110 wrote:How can i get my game to run faster with lots of mods
minetest.register_on_dignode(function(pos, oldnode, digger)
if pos["x"] < safeZoneCenter["x"]+limit and pos["x"] > safeZoneCenter["x"]-limit and pos["z"] < safeZoneCenter["z"]+limit and pos["z"] > safeZoneCenter["z"]-limit then -- If a node has been dug within spawn as defined with limit
if not minetest.get_player_privs(digger:get_player_name())["safezonebuild"] then -- If the player does not have the spawnbuild privilege
minetest.chat_send_player(digger:get_player_name(), "You are attempting to dig inside the safe zone, please move out of the safe zone") -- Inform player that he/she cannot dig inside spawn
minetest.set_node(pos, oldnode)
digger:get_inventory():remove_item("main", oldnode)
end
end
end)
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if pos["x"] < safeZoneCenter["x"]+limit and pos["x"] > safeZoneCenter["x"]-limit and pos["z"] < safeZoneCenter["z"]+limit and pos["z"] > safeZoneCenter["z"]-limit then -- If a node has been placed within spawn as defined with limit
if not minetest.get_player_privs(placer:get_player_name())["safezonebuild"] then -- If the player does not have the spawnbuild privilege
minetest.chat_send_player(placer:get_player_name(), "You are attempting to build inside the safe zone, please move out of the safe zone") -- Inform player that he/she cannot build inside spawn
minetest.set_node(pos, oldnode)
placer:get_inventory():add_item("main", newnode.name)
end
end
end)
GunshipPenguin wrote:I'm having a problem with a mod that I'm making to protect the area around the spawnpoint from being damaged. The code to stop people from digging nodes is as follows.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_on_dignode(function(pos, oldnode, digger)
if pos["x"] < safeZoneCenter["x"]+limit and pos["x"] > safeZoneCenter["x"]-limit and pos["z"] < safeZoneCenter["z"]+limit and pos["z"] > safeZoneCenter["z"]-limit then -- If a node has been dug within spawn as defined with limit
if not minetest.get_player_privs(digger:get_player_name())["safezonebuild"] then -- If the player does not have the spawnbuild privilege
minetest.chat_send_player(digger:get_player_name(), "You are attempting to dig inside the safe zone, please move out of the safe zone") -- Inform player that he/she cannot dig inside spawn
minetest.set_node(pos, oldnode)
digger:get_inventory():remove_item("main", oldnode)
end
end
end)
It works fine, but the code to stop players from placing nodes does not. I remove the node, inform the player that he cannot build near spawn and then try to add the node back to his/her inventory. For some reason though, the item isn't being added into the inventory.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_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if pos["x"] < safeZoneCenter["x"]+limit and pos["x"] > safeZoneCenter["x"]-limit and pos["z"] < safeZoneCenter["z"]+limit and pos["z"] > safeZoneCenter["z"]-limit then -- If a node has been placed within spawn as defined with limit
if not minetest.get_player_privs(placer:get_player_name())["safezonebuild"] then -- If the player does not have the spawnbuild privilege
minetest.chat_send_player(placer:get_player_name(), "You are attempting to build inside the safe zone, please move out of the safe zone") -- Inform player that he/she cannot build inside spawn
minetest.set_node(pos, oldnode)
placer:get_inventory():add_item("main", newnode.name)
end
end
end)
Thanks in advance for any help. I'm new to Lua and Minetest modding so I apologize if this question is a bit noobish.
Hybrid Dog wrote:setting the oldnode after adding the newnode into the inventory or "return itemstack" might help
pandaro wrote:about sneak and sneak_glitch
What changed exactly sneak and sneak_glitch in player:set_physics_override ()
I realized that if I sneak == true then the player does not come down from the block if I hold down shift.
if you sneak == false then the player goes down from the block even if I keep holding shift.
I do not understand what happens if sneak_glitch is changed from true to false.
It seems to me always the same
PilzAdam wrote:Try searching for "sneak elevator". sneak_glitch = false basically prevents that.
Krock wrote:I'm not sure but
on_rightclick itemstack should be the stack, which the player used to click right onto the node.
What exactly do you want to do?
Krock wrote:@philipbenr, post abrove:
How about defining the gloves, instead of the diffrent nodes?
like: on_use, on_place (not sure, but you can loop up the documentation)
on_use = function(itemstack, placer, pointed_thing <-- Here? )
--Or Somewhere down here?
on_use = function(itemstack, placer, audio:player_black )
on_use = function(itemstack, placer, pointed_thing)
pointed_thing="audio:player_black"
philipbenr wrote:Also, how can I define the pointed thing as one specific node?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
on_use = function(itemstack, placer, pointed_thing <-- Here? )
--Or Somewhere down here?
minetest.register_tool("audio:gloves", {
description = "xyz",
inventory_image = "xyz.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~="node" then
return
end
local node = minetest.get_node(pointed_thing.under)
--node equals the node you pointed to when using the "gloves"
Just stick this in the node definition:Gambit wrote:How would I make a block that hurts the player once he/she touches it either on the sides on standing on top of it?
damage_per_second = amount_of_damage,
Users browsing this forum: No registered users and 13 guests