naming - Uberi/MineTest-API GitHub Wiki
Naming
Entities items, nodes, objects, etc.
Registered names should generally be in this format: modname:whatever
(can have characters a-zA-Z0-9_)
This is to prevent conflicting names from corrupting maps and is enforced by the mod loader.
Example: mod experimental
, ideal item/node/entity name tnt
, the name should be experimental:tnt
.
Enforcement can be overridden by prefixing the name with :
. This can be used for overriding the registrations of some other mod. For example, any mod can redefine experimental:tnt by using the name :experimental:tnt
when registering it. (also that mod is required to have experimental
in depends.txt
)
The :
prefix can also be used for maintaining backwards compatibility.
Aliases
Aliases can be added by using [minetest.register_alias](minetest.register_alias)(name, convert_to)
This will make Minetest to convert things called name to things called convert_to.
This can be used for maintaining backwards compatibility.
This can be also used for setting quick access names for things, eg. if you have an item called epiclylongmodname:stuff
, you could do [minetest.register_alias](minetest.register_alias)("stuff", "epiclylongmodname:stuff")
and be able to use the chat command /giveme stuff
.
Textures
Mods should generally prefix their textures with modname_
, eg. given the mod name foomod
, a texture could be called foomod_foothing.png
Textures are referred to by their complete name, or alternatively by stripping out the file extension. eg. foomod_foothing.png
or foomod_foothing
Sounds
Only OGG files are supported.
For positional playing of sounds, only single-channel (mono) files are supported. Otherwise OpenAL will play them non-positionally.
Mods should generally prefix their sounds with modname_
, eg. given the mod name foomod
, a sound could be called foomod_foosound.ogg
Sounds are referred to by their name with a dot, a single digit and the file extension stripped out. When a sound is played, the actual sound file is chosen randomly from the matching sounds.
When playing the sound foomod_foosound
, the sound is chosen randomly from the available ones of the following files: foomod_foosound.ogg
foomod_foosound.0.ogg
foomod_foosound.1.ogg
...
foomod_foosound.9.ogg
Examples of sound parameter tables:
-- Play locationless on all clients
{
gain = 1.0, -- default
}
-- Play locationless to a player
{
to_player = name,
gain = 1.0, -- default
}
-- Play in a location
{
pos = {x=1,y=2,z=3},
gain = 1.0, -- default
max_hear_distance = 32, -- default
}
-- Play connected to an object, looped
{
object = ,
gain = 1.0, -- default
max_hear_distance = 32, -- default
loop = true, -- only sounds connected to objects can be looped
}
SimpleSoundSpec:
eg. ""
eg. "default_place_node"
eg. {}
eg. {name="default_place_node"}
eg. {name="default_place_node", gain=1.0}
Afterword
Minetest Links
Lua Links
We're Social
Chat with us
There are developers, modders, themers, server admins and players on IRC at freenode on the channel #minetest (chatlogs)