Initial Commit
This commit is contained in:
commit
5ea0b93529
1
1_folders/example/depends.txt
Normal file
1
1_folders/example/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
14
1_folders/example/init.lua
Normal file
14
1_folders/example/init.lua
Normal file
@ -0,0 +1,14 @@
|
||||
print("This file will be run at load time!")
|
||||
|
||||
minetest.register_node("example:node", {
|
||||
description = "This is a node",
|
||||
tiles = {
|
||||
"mymod_node.png",
|
||||
"mymod_node.png",
|
||||
"mymod_node.png",
|
||||
"mymod_node.png",
|
||||
"mymod_node.png",
|
||||
"mymod_node.png"
|
||||
},
|
||||
groups = {cracky = 1}
|
||||
})
|
0
1_folders/modpack.txt
Normal file
0
1_folders/modpack.txt
Normal file
6
3_nodes_items_crafting/basic_node/init.lua
Normal file
6
3_nodes_items_crafting/basic_node/init.lua
Normal file
@ -0,0 +1,6 @@
|
||||
minetest.register_node("mymod:diamond", {
|
||||
description = "Alien Diamond",
|
||||
tiles = {"mymod_diamond.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3, stone=1}
|
||||
})
|
13
3_nodes_items_crafting/crafting/init.lua
Normal file
13
3_nodes_items_crafting/crafting/init.lua
Normal file
@ -0,0 +1,13 @@
|
||||
minetest.register_craftitem("mymod:diamond_chair", {
|
||||
description = "Diamond Chair",
|
||||
inventory_image = "mymod_diamond_chair.png"
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mymod:diamond_chair 99",
|
||||
recipe = {
|
||||
{"mymod:diamond_fragments", "", ""},
|
||||
{"mymod:diamond_fragments", "mymod:diamond_fragments", ""},
|
||||
{"mymod:diamond_fragments", "mymod:diamond_fragments", ""}
|
||||
}
|
||||
})
|
4
3_nodes_items_crafting/craftitem/init.lua
Normal file
4
3_nodes_items_crafting/craftitem/init.lua
Normal file
@ -0,0 +1,4 @@
|
||||
minetest.register_craftitem("mymod:diamond_fragments", {
|
||||
description = "Alien Diamond Fragments",
|
||||
inventory_image = "mymod_diamond_fragments.png"
|
||||
})
|
30
3_nodes_items_crafting/food/init.lua
Normal file
30
3_nodes_items_crafting/food/init.lua
Normal file
@ -0,0 +1,30 @@
|
||||
minetest.register_craftitem("mymod:mudpie", {
|
||||
description = "Alien Mud Pie",
|
||||
inventory_image = "myfood_mudpie.png",
|
||||
on_use = minetest.item_eat(20)
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mymod:mudpie_ex", {
|
||||
description = "Alien Mud Pie Extended",
|
||||
inventory_image = "myfood_mudpie.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
hp_change = 20
|
||||
replace_with_item = nil
|
||||
|
||||
minetest.chat_send_player(user:get_player_name(), "You ate an alien mud pie!")
|
||||
|
||||
-- Support for hunger mods using minetest.register_on_item_eat
|
||||
for _, callback in pairs(minetest.registered_on_item_eats) do
|
||||
local result = callback(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
if result then
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
if itemstack:take_item() ~= nil then
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
0
3_nodes_items_crafting/modpack.txt
Normal file
0
3_nodes_items_crafting/modpack.txt
Normal file
0
4_node_drawtypes/modpack.txt
Normal file
0
4_node_drawtypes/modpack.txt
Normal file
184
4_node_drawtypes/mymod/init.lua
Normal file
184
4_node_drawtypes/mymod/init.lua
Normal file
@ -0,0 +1,184 @@
|
||||
minetest.register_node("mymod:diamond", {
|
||||
description = "Alien Diamond",
|
||||
tiles = {
|
||||
"mymod_diamond_up.png",
|
||||
"mymod_diamond_down.png",
|
||||
"mymod_diamond_right.png",
|
||||
"mymod_diamond_left.png",
|
||||
"mymod_diamond_back.png",
|
||||
"mymod_diamond_front.png"
|
||||
},
|
||||
is_ground_content = true,
|
||||
groups = {cracky = 3},
|
||||
drop = "mymod:diamond_fragments"
|
||||
})
|
||||
|
||||
minetest.register_node("mymod:air", {
|
||||
description = "MyAir (you hacker you!)",
|
||||
drawtype = "airlike",
|
||||
|
||||
paramtype = "light",
|
||||
-- ^ Allows light to propagate through the node with the
|
||||
-- light value falling by 1 per node.
|
||||
|
||||
sunlight_propagates = true, -- Sunlight shines through
|
||||
walkable = false, -- Would make the player collide with the air node
|
||||
pointable = false, -- You can't select the node
|
||||
diggable = false, -- You can't dig the node
|
||||
buildable_to = true, -- Nodes can be replace this node.
|
||||
-- (you can place a node and remove the air node
|
||||
-- that used to be there)
|
||||
|
||||
air_equivalent = true,
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory=1}
|
||||
})
|
||||
|
||||
-- Some properties have been removed as they are beyond the scope of this chapter.
|
||||
minetest.register_node(":default:water_source", {
|
||||
drawtype = "liquid",
|
||||
paramtype = "light",
|
||||
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
-- ^ this is required to stop the inventory image from being animated
|
||||
|
||||
tiles = {
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 2.0},
|
||||
backface_culling = false,
|
||||
}
|
||||
},
|
||||
|
||||
--
|
||||
-- Behavior
|
||||
--
|
||||
walkable = false, -- The player falls through
|
||||
pointable = false, -- The player can't highlight it
|
||||
diggable = false, -- The player can't dig it
|
||||
buildable_to = true, -- Nodes can be replace this node
|
||||
|
||||
alpha = 160,
|
||||
|
||||
--
|
||||
-- Liquid Properties
|
||||
--
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
|
||||
liquid_alternative_flowing = "default:water_flowing",
|
||||
-- ^ when the liquid is flowing
|
||||
|
||||
liquid_alternative_source = "default:water_source",
|
||||
-- ^ when the liquid is a source
|
||||
|
||||
liquid_viscosity = WATER_VISC,
|
||||
-- ^ how far
|
||||
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
-- ^ color of screen when the player is submerged
|
||||
})
|
||||
|
||||
minetest.register_node("mymod:obsidian_glass", {
|
||||
description = "Obsidian Glass",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"default_obsidian_glass.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("mymod:glass", {
|
||||
description = "Glass",
|
||||
drawtype = "glasslike_framed",
|
||||
|
||||
tiles = {"default_glass.png", "default_glass_detail.png"},
|
||||
inventory_image = minetest.inventorycube("default_glass.png"),
|
||||
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true, -- Sunlight can shine through block
|
||||
is_ground_content = false, -- Stops caves from being generated over this node.
|
||||
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node("mymod:leaves", {
|
||||
description = "Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
tiles = {"default_leaves.png"}
|
||||
})
|
||||
|
||||
minetest.register_node("mymod:torch", {
|
||||
description = "Foobar Torch",
|
||||
drawtype = "torchlike",
|
||||
tiles = {
|
||||
{"foobar_torch_floor.png"},
|
||||
{"foobar_torch_ceiling.png"},
|
||||
{"foobar_torch_wall.png"}
|
||||
},
|
||||
inventory_image = "foobar_torch_floor.png",
|
||||
wield_image = "default_torch_floor.png",
|
||||
light_source = LIGHT_MAX-1,
|
||||
|
||||
-- Determines how the torch is selected, ie: the wire box around it.
|
||||
-- each value is { x1, y1, z1, x2, y2, z2 }
|
||||
-- (x1, y1, y1) is the bottom front left corner
|
||||
-- (x2, y2, y2) is the opposite - top back right.
|
||||
-- Similar to the nodebox format.
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
|
||||
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
|
||||
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("mymod:stair_stone", {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("mymod:sign", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "wallmounted",
|
||||
|
||||
-- Ceiling
|
||||
wall_top = {
|
||||
{-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}
|
||||
},
|
||||
|
||||
-- Floor
|
||||
wall_bottom = {
|
||||
{-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}
|
||||
},
|
||||
|
||||
-- Wall
|
||||
wall_side = {
|
||||
{-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375}
|
||||
}
|
||||
},
|
||||
})
|
17
5_active_block_modifiers/aliens/init.lua
Normal file
17
5_active_block_modifiers/aliens/init.lua
Normal file
@ -0,0 +1,17 @@
|
||||
minetest.register_node("aliens:grass", {
|
||||
description = "Alien Grass",
|
||||
light_source = 3, -- The node radiates light. Values can be from 1 to 15
|
||||
tiles = {"aliens_grass.png"},
|
||||
groups = {choppy=1},
|
||||
on_use = minetest.item_eat(20)
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
neighbors = {"default:water_source", "default:water_flowing"},
|
||||
interval = 10.0, -- Run every 10 seconds
|
||||
chance = 50, -- Select every 1 in 50 nodes
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "aliens:grass"})
|
||||
end
|
||||
})
|
0
5_active_block_modifiers/modpack.txt
Normal file
0
5_active_block_modifiers/modpack.txt
Normal file
9
6_player_physics/antigravity/init.lua
Normal file
9
6_player_physics/antigravity/init.lua
Normal file
@ -0,0 +1,9 @@
|
||||
minetest.register_chatcommand("antigravity",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
player:set_physics_override({
|
||||
gravity = 0.1 -- set gravity to 10% of its original value
|
||||
-- (0.1 * 9.81)
|
||||
})
|
||||
end
|
||||
})
|
0
6_player_physics/modpack.txt
Normal file
0
6_player_physics/modpack.txt
Normal file
26
7_formspecs/first_formspec/init.lua
Normal file
26
7_formspecs/first_formspec/init.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- Show form when the /formspec command is used.
|
||||
minetest.register_chatcommand("formspec", {
|
||||
func = function(name, param)
|
||||
minetest.show_formspec(name, "first_formspec:form",
|
||||
"size[4,3]" ..
|
||||
"label[0,0;Hello, " .. name .. "]" ..
|
||||
"field[1,1.5;3,1;name;Name;]" ..
|
||||
"button_exit[1,2;2,1;exit;Save]")
|
||||
end
|
||||
})
|
||||
|
||||
-- Register callback
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "first_formspec:form" then
|
||||
-- Formname is not mymod:form,
|
||||
-- exit callback.
|
||||
return false
|
||||
end
|
||||
|
||||
-- Send message to player.
|
||||
minetest.chat_send_player(player:get_player_name(), "You said: " .. fields.name .. "!")
|
||||
|
||||
-- Return true to stop other minetest.register_on_player_receive_fields
|
||||
-- from receiving this submission.
|
||||
return true
|
||||
end)
|
0
7_formspecs/modpack.txt
Normal file
0
7_formspecs/modpack.txt
Normal file
51
7_formspecs/mylandowner/init.lua
Normal file
51
7_formspecs/mylandowner/init.lua
Normal file
@ -0,0 +1,51 @@
|
||||
--
|
||||
-- Step 1) set context when player requests the formspec
|
||||
--
|
||||
|
||||
-- land_formspec_context[playername] gives the player's context.
|
||||
local land_formspec_context = {}
|
||||
|
||||
minetest.register_chatcommand("land", {
|
||||
func = function(name, param)
|
||||
if param == "" then
|
||||
minetest.chat_send_player(name, "Incorrect parameters - supply a land ID")
|
||||
return
|
||||
end
|
||||
|
||||
-- Save information
|
||||
land_formspec_context[name] = {id = param}
|
||||
|
||||
minetest.show_formspec(name, "mylandowner:edit",
|
||||
"size[4,4]" ..
|
||||
"field[1,1;3,1;plot;Plot Name;]" ..
|
||||
"field[1,2;3,1;owner;Owner;]" ..
|
||||
"button_exit[1,3;2,1;exit;Save]")
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Step 2) retrieve context when player submits the form
|
||||
--
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "mylandowner:edit" then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Load information
|
||||
local context = land_formspec_context[player:get_player_name()]
|
||||
|
||||
if context then
|
||||
minetest.chat_send_player(player:get_player_name(), "Id " .. context.id .. " is now called " ..
|
||||
fields.plot .. " and owned by " .. fields.owner)
|
||||
|
||||
-- Delete context if it is no longer going to be used
|
||||
land_formspec_context[player:get_player_name()] = nil
|
||||
|
||||
return true
|
||||
else
|
||||
-- Fail gracefully if the context does not exist.
|
||||
minetest.chat_send_player(player:get_player_name(), "Something went wrong, try again.")
|
||||
end
|
||||
end)
|
9
8_hud/basic_hud/init.lua
Normal file
9
8_hud/basic_hud/init.lua
Normal file
@ -0,0 +1,9 @@
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local idx = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
position = {x = 1, y = 0},
|
||||
offset = {x=-100, y = 20},
|
||||
scale = {x = 100, y = 100},
|
||||
text = "My Text"
|
||||
})
|
||||
end)
|
0
8_hud/modpack.txt
Normal file
0
8_hud/modpack.txt
Normal file
26
9_releasing_a_mod/README.txt
Normal file
26
9_releasing_a_mod/README.txt
Normal file
@ -0,0 +1,26 @@
|
||||
My Super Special Mod
|
||||
====================
|
||||
|
||||
Adds magic, rainbows and other special things.
|
||||
|
||||
Version: 1.1
|
||||
Licence: LGPL 2.1 or later
|
||||
|
||||
Dependencies: default mod (found in minetest_game)
|
||||
|
||||
Report bugs or request help on the forum topic.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Unzip the archive, rename the folder to to modfoldername and
|
||||
place it in minetest/mods/minetest/
|
||||
|
||||
( Linux: If you have a linux system-wide installation place
|
||||
it in ~/.minetest/mods/minetest/. )
|
||||
|
||||
( If you only want this to be used in a single world, place
|
||||
the folder in worldmods/ in your worlddirectory. )
|
||||
|
||||
For further information or help see:
|
||||
http://wiki.minetest.com/wiki/Installing_Mods
|
1
9_releasing_a_mod/description.txt
Normal file
1
9_releasing_a_mod/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Adds magic, rainbows and other special things.
|
2
9_releasing_a_mod/init.lua
Normal file
2
9_releasing_a_mod/init.lua
Normal file
@ -0,0 +1,2 @@
|
||||
-- Nothing here!
|
||||
print("9_releasing_a_mod: this mod does nothing!")
|
6
README.txt
Normal file
6
README.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Examples for Minetest Modding Book
|
||||
==================================
|
||||
|
||||
Each chapter is a mod pack. As modpacks can't contain modpacks,
|
||||
you need to take all of these folders and install them into the mod location.
|
||||
For example, minetest/mods/1_folders and minetest/mods/3_nodes_items_crafting
|
Loading…
Reference in New Issue
Block a user