This commit is contained in:
tchncs 2016-01-14 09:23:11 +01:00
commit 53fab125b4
41 changed files with 225 additions and 21 deletions

View File

@ -51,10 +51,9 @@ function creative_inventory.update(player_name, filter)
for name, def in pairs(minetest.registered_items) do
if not (def.groups.not_in_creative_inventory == 1) and
def.description and def.description ~= "" then
if (filter and def.name:find(filter, 1, true)) or not filter then
creative_list[#creative_list+1] = name
end
def.description and def.description ~= "" and
(not filter or def.name:find(filter, 1, true)) then
creative_list[#creative_list+1] = name
end
end
@ -136,10 +135,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local current_page = 0
local player_name = player:get_player_name()
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
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
elseif fields.creative_next or start_i < 0 then
start_i = start_i + 4*6
@ -157,9 +157,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
creative_inventory.set_creative_formspec(player, 0, 1)
end)
end
if start_i < 0 or start_i >= creative_inventory[player_name].size then
if start_i >= inv_size then
start_i = 0
elseif start_i < 0 then
start_i = inv_size - (inv_size % (6*4))
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)

View File

@ -88,6 +88,36 @@ minetest.register_craftitem("default:book_written", {
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", {
description = "Coal Lump",
inventory_image = "default_coal_lump.png",

View File

@ -2,6 +2,7 @@
-- Aliases for map generator outputs
--
minetest.register_alias("mapgen_air", "air")
minetest.register_alias("mapgen_stone", "default:stone")
minetest.register_alias("mapgen_dirt", "default:dirt")
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
@ -966,7 +967,7 @@ end
function default.register_decorations()
minetest.clear_registered_decorations()
-- Apple tree
-- Apple tree and log
minetest.register_decoration({
deco_type = "schematic",
@ -987,7 +988,33 @@ function default.register_decorations()
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({
deco_type = "schematic",
@ -1002,7 +1029,33 @@ function default.register_decorations()
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({
deco_type = "schematic",
@ -1023,7 +1076,33 @@ function default.register_decorations()
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({
deco_type = "schematic",
@ -1045,6 +1124,36 @@ function default.register_decorations()
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
minetest.register_decoration({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -6,6 +6,7 @@ License of source code:
-----------------------
Copyright (C) 2012 PilzAdam
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
the extent permitted by applicable law. You can redistribute it
@ -30,11 +31,15 @@ following textures created by celeron55 (CC BY-SA 3.0):
door_trapdoor_side.png
door_glass_a.png
door_glass_b.png
following Textures created by PenguinDad (CC BY-SA 4.0):
door_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

View File

@ -428,7 +428,19 @@ function doors.register_trapdoor(name, def)
local name_closed = name
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 sound = false
if node.name == name_closed then sound = def.sound_open end
@ -436,7 +448,7 @@ function doors.register_trapdoor(name, def)
if sound then
minetest.sound_play(sound, {pos = pos, gain = 0.3, max_hear_distance = 10})
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
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.paramtype2 = "facedir"
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_closed = table.copy(def)
@ -492,6 +516,19 @@ doors.register_trapdoor("doors:trapdoor", {
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({
output = 'doors:trapdoor 2',
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'},
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

View File

@ -70,8 +70,8 @@ function flowers.register_mgv6_decorations()
register_mgv6_flower("viola")
register_mgv6_flower("dandelion_white")
register_mgv6_mushroom("mushroom_fertile_brown")
register_mgv6_mushroom("mushroom_fertile_red")
register_mgv6_mushroom("mushroom_brown")
register_mgv6_mushroom("mushroom_red")
register_mgv6_waterlily()
end
@ -151,8 +151,8 @@ function flowers.register_decorations()
register_flower(1133, "viola")
register_flower(73133, "dandelion_white")
register_mushroom("mushroom_fertile_brown")
register_mushroom("mushroom_fertile_red")
register_mushroom("mushroom_brown")
register_mushroom("mushroom_red")
register_waterlily()
end

View File

@ -32,8 +32,20 @@ minetest.after(0, function()
end)
local function rand_pos(center, pos, radius)
pos.x = center.x + math.random(-radius, radius)
pos.z = center.z + math.random(-radius, radius)
local def
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
local function eject_drops(drops, pos, radius)