prestidigitator wrote:Where did you start the server?
prestidigitator wrote:Can you see any error output in the console there, or in the log file?
chinchow wrote:There is probably a very simple answer to this, but how would one create a flat area
of certain dimensions. For example: Say you have a hill, but you want something to
generate there via a mod. However when you generate your structure there are nodes
from the hill inside. Therefore a flat area needs to be set.
Chinchow wrote:
I apologize it seems I did not specify. I want a normal world with hills and the like, and I want a contained area to be flattened.
dev.minetest.net wrote:> drop — alternatively drop = { max_items = ..., items = { ... } }
philipbenr wrote:dev.minetest.net wrote:> drop — alternatively drop = { max_items = ..., items = { ... } }
How to use the multiple drop function? I am trying to get a node to drop more than one thing when it is dug.
drop = {
max_items = 2,
items = {
{items = {"mod:item"}, rarity = 10 },
{items = {"mod:item"}, rarity = 2 },
}
},
RHR wrote:#2: Just rename all textures in the texture folder and in the source code e.g. default_stone.png --> philipbenr_stone.png
yaman wrote:Topic - How do you get the player's position, or better, the position of the block they are standing on?
Reason - I am making a gold touch mod: it makes blocks the player walks on into gold blocks
More Info - I really want to get into coding mods and I want to succeed in making this one so I can get my self esteem up.
yourmod = {} -- global variable
local modname = "yourmod" -- local variable
local function first_func(pos, player)
-- this is a local function
end
function yourmod.second_func(pos, player)
-- this is a global function
end
Casimir wrote:@paramat
(Please anyone correct me if I'm wrong on this.)
Normally you don't need this. Only it you want that definitions made by your mod can be used by other mods too.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
yourmod = {} -- global variable
local modname = "yourmod" -- local variable
function first_func(pos, player)
-- this is a local function
end
function yourmod.second_func(pos, player)
-- this is a global function
end
From within your mod you can call both functions by there name. From an other mod you can only call yourmod.second_func because it is part of the table "yourmod" which is a global variable.
Minetest Dev Wiki wrote:singlenode:Intended to be used by mods that perform total mapgen takeovers.
prestidigitator wrote:you might need to us on_dig() instead.
paramat wrote:I've been meaning to ask a question for perhaps a year, i'm in the habit of adding 'modname = {}' to a mod's init.lua file, but i still don't know why this is done, which is why i title that with the comment 'Stuff' in my code. What is the purpose and (when) is it essential?
function mytable.myfunc(...) ... end
mytable.myfunc = function(...) ... end
yaman wrote:Topic - How do you get the player's position, or better, the position of the block they are standing on?
Reason - I am making a gold touch mod: it makes blocks the player walks on into gold blocks
More Info - I really want to get into coding mods and I want to succeed in making this one so I can get my self esteem up.
local pos = player:getpos();
...
local player = minetest.get_player_by_name(player_name);
if not player then error("player "..player_name.." not found"); end
local pos = player:getpos()
...
drkwv wrote:prestidigitator wrote:you might need to us on_dig() instead.
I have copied on_dig from builtin/item.lua and set it for my needs, but lag is still there (pushed this code to github). I have found out that even with an empty function passed to on_dig, minetest client is removing node then setting it back instead of simply doing nothing. Is there anything else I can do to get rid of the lag?
srifqi wrote:How to create my own map gen?
paramat wrote:See this thread https://forum.minetest.net/viewtopic.php?f=18&t=6396
I also have a few simplified lua mapgens meant to help people learn the methods, the most useful one is here https://forum.minetest.net/viewtopic.php?f=11&t=8628
Users browsing this forum: No registered users and 2 guests