Merge latest https://github.com/minetest/minetest_game changes
@ -51,10 +51,9 @@ function creative_inventory.update(player_name, filter)
|
|||||||
|
|
||||||
for name, def in pairs(minetest.registered_items) do
|
for name, def in pairs(minetest.registered_items) do
|
||||||
if not (def.groups.not_in_creative_inventory == 1) and
|
if not (def.groups.not_in_creative_inventory == 1) and
|
||||||
def.description and def.description ~= "" then
|
def.description and def.description ~= "" and
|
||||||
if (filter and def.name:find(filter, 1, true)) or not filter then
|
(not filter or def.name:find(filter, 1, true)) then
|
||||||
creative_list[#creative_list+1] = name
|
creative_list[#creative_list+1] = name
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -136,10 +135,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
local current_page = 0
|
local current_page = 0
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local formspec = player:get_inventory_formspec()
|
local formspec = player:get_inventory_formspec()
|
||||||
local start_i = formspec:match("list%[detached:creative_" .. player_name .. ";main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
|
local start_i = formspec:match("list%[detached:creative_" .. player_name .. ";.*;(%d+)%]")
|
||||||
|
local inv_size = creative_inventory[player_name].size
|
||||||
start_i = tonumber(start_i) or 0
|
start_i = tonumber(start_i) or 0
|
||||||
|
|
||||||
if fields.creative_prev or start_i >= creative_inventory[player_name].size then
|
if fields.creative_prev or start_i >= inv_size then
|
||||||
start_i = start_i - 4*6
|
start_i = start_i - 4*6
|
||||||
elseif fields.creative_next or start_i < 0 then
|
elseif fields.creative_next or start_i < 0 then
|
||||||
start_i = start_i + 4*6
|
start_i = start_i + 4*6
|
||||||
@ -158,8 +158,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if start_i < 0 or start_i >= creative_inventory[player_name].size then
|
if start_i >= inv_size then
|
||||||
start_i = 0
|
start_i = 0
|
||||||
|
elseif start_i < 0 then
|
||||||
|
start_i = inv_size - (inv_size % (6*4))
|
||||||
end
|
end
|
||||||
|
|
||||||
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
|
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
|
||||||
|
@ -88,6 +88,36 @@ minetest.register_craftitem("default:book_written", {
|
|||||||
on_use = book_on_use,
|
on_use = book_on_use,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "default:book_written",
|
||||||
|
recipe = { "default:book", "default:book_written" }
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
|
||||||
|
if itemstack:get_name() ~= "default:book_written" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local copy = ItemStack("default:book_written")
|
||||||
|
local original
|
||||||
|
local index
|
||||||
|
for i = 1, player:get_inventory():get_size("craft") do
|
||||||
|
if old_craft_grid[i]:get_name() == "default:book_written" then
|
||||||
|
original = old_craft_grid[i]
|
||||||
|
index = i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not original then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local copymeta = original:get_metadata()
|
||||||
|
-- copy of the book held by player's mouse cursor
|
||||||
|
itemstack:set_metadata(copymeta)
|
||||||
|
-- put the book with metadata back in the craft grid
|
||||||
|
craft_inv:set_stack("craft", index, original)
|
||||||
|
end)
|
||||||
|
|
||||||
minetest.register_craftitem("default:coal_lump", {
|
minetest.register_craftitem("default:coal_lump", {
|
||||||
description = "Coal Lump",
|
description = "Coal Lump",
|
||||||
inventory_image = "default_coal_lump.png",
|
inventory_image = "default_coal_lump.png",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
-- Aliases for map generator outputs
|
-- Aliases for map generator outputs
|
||||||
--
|
--
|
||||||
|
|
||||||
|
minetest.register_alias("mapgen_air", "air")
|
||||||
minetest.register_alias("mapgen_stone", "default:stone")
|
minetest.register_alias("mapgen_stone", "default:stone")
|
||||||
minetest.register_alias("mapgen_dirt", "default:dirt")
|
minetest.register_alias("mapgen_dirt", "default:dirt")
|
||||||
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
|
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
|
||||||
@ -966,7 +967,7 @@ end
|
|||||||
function default.register_decorations()
|
function default.register_decorations()
|
||||||
minetest.clear_registered_decorations()
|
minetest.clear_registered_decorations()
|
||||||
|
|
||||||
-- Apple tree
|
-- Apple tree and log
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
@ -987,7 +988,33 @@ function default.register_decorations()
|
|||||||
flags = "place_center_x, place_center_z",
|
flags = "place_center_x, place_center_z",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Jungle tree
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_grass"},
|
||||||
|
sidelen = 80,
|
||||||
|
fill_ratio = 0.0015,
|
||||||
|
biomes = {"deciduous_forest"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = {
|
||||||
|
size = { x = 3, y = 3, z = 1},
|
||||||
|
data = {
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "default:tree", param2 = 12, prob = 191 },
|
||||||
|
{ name = "default:tree", param2 = 12 },
|
||||||
|
{ name = "default:tree", param2 = 12, prob = 127 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "flowers:mushroom_brown", prob = 63 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
flags = "place_center_x",
|
||||||
|
rotation = "random",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Jungle tree and log
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
@ -1002,7 +1029,33 @@ function default.register_decorations()
|
|||||||
rotation = "random",
|
rotation = "random",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Taiga and temperate coniferous forest pine tree
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_grass", "default:dirt"},
|
||||||
|
sidelen = 80,
|
||||||
|
fill_ratio = 0.01,
|
||||||
|
biomes = {"rainforest", "rainforest_swamp"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = {
|
||||||
|
size = { x = 3, y = 3, z = 1},
|
||||||
|
data = {
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "default:jungletree", param2 = 12, prob = 191 },
|
||||||
|
{ name = "default:jungletree", param2 = 12 },
|
||||||
|
{ name = "default:jungletree", param2 = 12, prob = 127 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "flowers:mushroom_brown", prob = 127 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
flags = "place_center_x",
|
||||||
|
rotation = "random",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Taiga and temperate coniferous forest pine tree and log
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
@ -1023,7 +1076,33 @@ function default.register_decorations()
|
|||||||
flags = "place_center_x, place_center_z",
|
flags = "place_center_x, place_center_z",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Acacia tree
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
|
||||||
|
sidelen = 80,
|
||||||
|
fill_ratio = 0.003,
|
||||||
|
biomes = {"taiga", "coniferous_forest"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = {
|
||||||
|
size = { x = 3, y = 3, z = 1},
|
||||||
|
data = {
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "default:pine_tree", param2 = 12, prob = 191 },
|
||||||
|
{ name = "default:pine_tree", param2 = 12 },
|
||||||
|
{ name = "default:pine_tree", param2 = 12, prob = 127 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "flowers:mushroom_red", prob = 63 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
flags = "place_center_x",
|
||||||
|
rotation = "random",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Acacia tree and log
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
deco_type = "schematic",
|
deco_type = "schematic",
|
||||||
@ -1045,6 +1124,36 @@ function default.register_decorations()
|
|||||||
rotation = "random",
|
rotation = "random",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_dry_grass"},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 0.001,
|
||||||
|
spread = {x = 250, y = 250, z = 250},
|
||||||
|
seed = 2,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.66
|
||||||
|
},
|
||||||
|
biomes = {"savanna"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = {
|
||||||
|
size = { x = 3, y = 2, z = 1},
|
||||||
|
data = {
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "air", prob = 0 },
|
||||||
|
{ name = "default:acacia_tree", param2 = 12, prob = 191 },
|
||||||
|
{ name = "default:acacia_tree", param2 = 12 },
|
||||||
|
{ name = "default:acacia_tree", param2 = 12, prob = 127 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
flags = "place_center_x",
|
||||||
|
rotation = "random",
|
||||||
|
})
|
||||||
|
|
||||||
-- Large cactus
|
-- Large cactus
|
||||||
|
|
||||||
minetest.register_decoration({
|
minetest.register_decoration({
|
||||||
|
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 5.8 KiB |
@ -6,6 +6,7 @@ License of source code:
|
|||||||
-----------------------
|
-----------------------
|
||||||
Copyright (C) 2012 PilzAdam
|
Copyright (C) 2012 PilzAdam
|
||||||
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
|
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
|
||||||
|
Steel trapdoor added by sofar.
|
||||||
|
|
||||||
This program is free software. It comes without any warranty, to
|
This program is free software. It comes without any warranty, to
|
||||||
the extent permitted by applicable law. You can redistribute it
|
the extent permitted by applicable law. You can redistribute it
|
||||||
@ -35,6 +36,10 @@ following Textures created by PenguinDad (CC BY-SA 4.0):
|
|||||||
door_glass.png
|
door_glass.png
|
||||||
door_obsidian_glass.png
|
door_obsidian_glass.png
|
||||||
|
|
||||||
|
Steel trapdoor textures by sofar (CC-BY-SA-3.0)
|
||||||
|
doors_trapdoor_steel.png
|
||||||
|
doors_trapdoor_steel_side.png
|
||||||
|
|
||||||
All other textures (created by PilzAdam): WTFPL
|
All other textures (created by PilzAdam): WTFPL
|
||||||
|
|
||||||
|
|
||||||
|
@ -428,7 +428,19 @@ function doors.register_trapdoor(name, def)
|
|||||||
local name_closed = name
|
local name_closed = name
|
||||||
local name_opened = name.."_open"
|
local name_opened = name.."_open"
|
||||||
|
|
||||||
def.on_rightclick = function (pos, node)
|
local function check_player_priv(pos, player)
|
||||||
|
if not def.only_placer_can_open then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local pn = player:get_player_name()
|
||||||
|
return meta:get_string("doors_owner") == pn
|
||||||
|
end
|
||||||
|
|
||||||
|
def.on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
|
||||||
|
if not check_player_priv(pos, clicker) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local newname = node.name == name_closed and name_opened or name_closed
|
local newname = node.name == name_closed and name_opened or name_closed
|
||||||
local sound = false
|
local sound = false
|
||||||
if node.name == name_closed then sound = def.sound_open end
|
if node.name == name_closed then sound = def.sound_open end
|
||||||
@ -436,7 +448,7 @@ function doors.register_trapdoor(name, def)
|
|||||||
if sound then
|
if sound then
|
||||||
minetest.sound_play(sound, {pos = pos, gain = 0.3, max_hear_distance = 10})
|
minetest.sound_play(sound, {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||||
end
|
end
|
||||||
minetest.set_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
|
minetest.swap_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
|
||||||
end
|
end
|
||||||
|
|
||||||
def.on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple
|
def.on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple
|
||||||
@ -446,6 +458,18 @@ function doors.register_trapdoor(name, def)
|
|||||||
def.paramtype = "light"
|
def.paramtype = "light"
|
||||||
def.paramtype2 = "facedir"
|
def.paramtype2 = "facedir"
|
||||||
def.is_ground_content = false
|
def.is_ground_content = false
|
||||||
|
def.can_dig = check_player_priv
|
||||||
|
|
||||||
|
if def.only_placer_can_open then
|
||||||
|
def.after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
local pn = placer:get_player_name()
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("doors_owner", pn)
|
||||||
|
meta:set_string("infotext", "Owned by "..pn)
|
||||||
|
|
||||||
|
return minetest.setting_getbool("creative_mode")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local def_opened = table.copy(def)
|
local def_opened = table.copy(def)
|
||||||
local def_closed = table.copy(def)
|
local def_closed = table.copy(def)
|
||||||
@ -492,6 +516,19 @@ doors.register_trapdoor("doors:trapdoor", {
|
|||||||
sound_close = "doors_door_close"
|
sound_close = "doors_door_close"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
doors.register_trapdoor("doors:trapdoor_steel", {
|
||||||
|
description = "Steel Trapdoor",
|
||||||
|
inventory_image = "doors_trapdoor_steel.png",
|
||||||
|
wield_image = "doors_trapdoor_steel.png",
|
||||||
|
tile_front = "doors_trapdoor_steel.png",
|
||||||
|
tile_side = "doors_trapdoor_steel_side.png",
|
||||||
|
only_placer_can_open = true,
|
||||||
|
groups = {snappy=1, bendy=2, cracky=1, melty=2, level=2, door=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
sound_open = "doors_door_open",
|
||||||
|
sound_close = "doors_door_close"
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'doors:trapdoor 2',
|
output = 'doors:trapdoor 2',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -500,3 +537,12 @@ minetest.register_craft({
|
|||||||
{'', '', ''},
|
{'', '', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'doors:trapdoor_steel',
|
||||||
|
recipe = {
|
||||||
|
{'default:steel_ingot', 'default:steel_ingot'},
|
||||||
|
{'default:steel_ingot', 'default:steel_ingot'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
BIN
mods/doors/textures/doors_trapdoor_steel.png
Normal file
After Width: | Height: | Size: 153 B |
BIN
mods/doors/textures/doors_trapdoor_steel_side.png
Normal file
After Width: | Height: | Size: 101 B |
@ -70,8 +70,8 @@ function flowers.register_mgv6_decorations()
|
|||||||
register_mgv6_flower("viola")
|
register_mgv6_flower("viola")
|
||||||
register_mgv6_flower("dandelion_white")
|
register_mgv6_flower("dandelion_white")
|
||||||
|
|
||||||
register_mgv6_mushroom("mushroom_fertile_brown")
|
register_mgv6_mushroom("mushroom_brown")
|
||||||
register_mgv6_mushroom("mushroom_fertile_red")
|
register_mgv6_mushroom("mushroom_red")
|
||||||
|
|
||||||
register_mgv6_waterlily()
|
register_mgv6_waterlily()
|
||||||
end
|
end
|
||||||
@ -151,8 +151,8 @@ function flowers.register_decorations()
|
|||||||
register_flower(1133, "viola")
|
register_flower(1133, "viola")
|
||||||
register_flower(73133, "dandelion_white")
|
register_flower(73133, "dandelion_white")
|
||||||
|
|
||||||
register_mushroom("mushroom_fertile_brown")
|
register_mushroom("mushroom_brown")
|
||||||
register_mushroom("mushroom_fertile_red")
|
register_mushroom("mushroom_red")
|
||||||
|
|
||||||
register_waterlily()
|
register_waterlily()
|
||||||
end
|
end
|
||||||
|
@ -32,8 +32,20 @@ minetest.after(0, function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local function rand_pos(center, pos, radius)
|
local function rand_pos(center, pos, radius)
|
||||||
pos.x = center.x + math.random(-radius, radius)
|
local def
|
||||||
pos.z = center.z + math.random(-radius, radius)
|
local reg_nodes = minetest.registered_nodes
|
||||||
|
local i = 0
|
||||||
|
repeat
|
||||||
|
-- Give up and use the center if this takes too long
|
||||||
|
if i > 4 then
|
||||||
|
pos.x, pos.z = center.x, center.z
|
||||||
|
break
|
||||||
|
end
|
||||||
|
pos.x = center.x + math.random(-radius, radius)
|
||||||
|
pos.z = center.z + math.random(-radius, radius)
|
||||||
|
def = reg_nodes[minetest.get_node(pos).name]
|
||||||
|
i = i + 1
|
||||||
|
until def and not def.walkable
|
||||||
end
|
end
|
||||||
|
|
||||||
local function eject_drops(drops, pos, radius)
|
local function eject_drops(drops, pos, radius)
|
||||||
|