1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-11 04:50:17 +01:00

[minetestforfun_game] Update

- Add new tree
- Creative mod improved
- New schematic files
This commit is contained in:
LeMagnesium 2016-01-15 19:39:01 +01:00
parent b4de154668
commit 874f854688
31 changed files with 631 additions and 193 deletions

View File

@ -1,11 +1,16 @@
-- minetest/creative/init.lua -- minetest/creative/init.lua
creative_inventory = {} creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods -- Create detached creative inventory after loading all mods
minetest.after(0, function() creative_inventory.init_creative_inventory = function(player)
local inv = minetest.create_detached_inventory("creative", { local player_name = player:get_player_name()
creative_inventory[player_name] = {}
creative_inventory[player_name].size = 0
creative_inventory[player_name].filter = nil
creative_inventory[player_name].start_i = 1
local inv = minetest.create_detached_inventory("creative_" .. player_name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then if minetest.setting_getbool("creative_mode") then
return count return count
@ -35,19 +40,41 @@ minetest.after(0, function()
end end
end, end,
}) })
creative_inventory.update(player_name, nil, 2)
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end
local function tab_category(tab_id)
local id_category = {
nil, -- Reserved for crafting tab.
minetest.registered_items,
minetest.registered_nodes,
minetest.registered_tools,
minetest.registered_craftitems
}
-- If index out of range, show default ("All") page.
return id_category[tab_id] or id_category[2]
end
function creative_inventory.update(player_name, filter, tab_id)
local creative_list = {} local creative_list = {}
for name,def in pairs(minetest.registered_items) do local inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then for name, def in pairs(tab_category(tab_id)) do
if not (def.groups.not_in_creative_inventory == 1) and
def.description and def.description ~= "" and
(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
table.sort(creative_list) table.sort(creative_list)
inv:set_size("main", #creative_list) inv:set_size("main", #creative_list)
inv:set_list("main", creative_list) inv:set_list("main", creative_list)
creative_inventory.creative_inventory_size = #creative_list creative_inventory[player_name].size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size)) end
end)
-- Create the trash field -- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", { local trash = minetest.create_detached_inventory("creative_trash", {
@ -66,70 +93,114 @@ local trash = minetest.create_detached_inventory("creative_trash", {
}) })
trash:set_size("main", 1) trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum, tab_id)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum) local player_name = player:get_player_name()
local filter = creative_inventory[player_name].filter or ""
pagenum = math.floor(pagenum) pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1) local pagemax = math.floor((creative_inventory[player_name].size - 1) / (3*8) + 1)
player:set_inventory_formspec( tab_id = tab_id or 2
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]".. player:set_inventory_formspec([[
default.gui_bg.. size[8,8.6]
default.gui_bg_img.. image[4.06,3.4;0.8,0.8;trash_icon.png]
default.gui_slots.. list[current_player;main;0,4.7;8,1;]
"list[current_player;main;5,3.5;8,1;]".. list[current_player;main;0,5.85;8,3;8]
"list[current_player;main;5,4.75;8,3;8]".. list[detached:creative_trash;main;4,3.3;1,1;]
"list[current_player;craft;8,0;3,3;]".. tablecolumns[color;text;color;text]
"list[current_player;craftpreview;12,1;1,1;]".. tableoptions[background=#00000000;highlight=#00000000;border=false]
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]".. button[5.4,3.2;0.8,0.9;creative_prev;<]
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]".. button[7.25,3.2;0.8,0.9;creative_next;>]
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]".. button[2.1,3.4;0.8,0.5;search;?]
"button[0.3,6.5;1.6,1;creative_prev;<<]".. button[2.75,3.4;0.8,0.5;clear;X]
"button[2.7,6.5;1.6,1;creative_next;>>]".. tooltip[search;Search]
"listring[current_player;main]".. tooltip[clear;Reset]
"listring[current_player;craft]".. listring[current_player;main]
"listring[current_player;main]".. ]] ..
"listring[detached:creative;main]".. "field[0.3,3.5;2.2,1;filter;;".. filter .."]"..
"label[5,1.5;Trash:]".. "listring[detached:creative_".. player_name ..";main]"..
"list[detached:creative_trash;main;5,2;1,1;]".. "tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;".. tostring(tab_id) ..";true;false]"..
default.get_hotbar_bg(5,3.5) "list[detached:creative_".. player_name ..";main;0,0;8,3;".. tostring(start_i) .."]"..
"table[6.05,3.35;1.15,0.5;pagenum;#FFFF00,".. tostring(pagenum) ..",#FFFFFF,/ ".. tostring(pagemax) .."]"..
default.get_hotbar_bg(0,4.7)..
default.gui_bg .. default.gui_bg_img .. default.gui_slots
) )
end end
creative_inventory.set_crafting_formspec = function(player)
player:set_inventory_formspec([[
size[8,7.5]
list[current_player;craft;2,0.25;3,3;]
list[current_player;craftpreview;6,1.25;1,1;]
list[current_player;main;0,3.6;8,1;]
list[current_player;main;0,4.75;8,3;8]
list[detached:creative_trash;main;0,2.25;1,1;]
image[0.06,2.35;0.8,0.8;trash_icon.png]
image[5,1.25;1,1;gui_furnace_arrow_bg.png^[transformR270]
tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;1;true;false]
listring[current_player;main]
listring[current_player;craft]
]] ..
default.get_hotbar_bg(0,3.6)..
default.gui_bg .. default.gui_bg_img .. default.gui_slots
)
end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms -- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
return return
end end
creative_inventory.set_creative_formspec(player, 0, 1) creative_inventory.init_creative_inventory(player)
creative_inventory.set_creative_formspec(player, 0, 1, 2)
end) end)
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
return return
end end
-- Figure out current page from formspec -- Figure out current page from formspec
local current_page = 0 local player_name = player:get_player_name()
local formspec = player:get_inventory_formspec() local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]") local filter = formspec:match("filter;;([%w_:]+)") or ""
local start_i = formspec:match("list%[detached:creative_".. player_name ..";.*;(%d+)%]")
local tab_id = tonumber(formspec:match("tabheader%[.*;(%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 then if fields.quit then
start_i = start_i - 4*6 if tab_id == 1 then
end creative_inventory.set_crafting_formspec(player)
if fields.creative_next then end
start_i = start_i + 4*6 elseif fields.tabs then
end if tonumber(fields.tabs) == 1 then
creative_inventory.set_crafting_formspec(player)
else
creative_inventory.update(player_name, filter, tonumber(fields.tabs))
creative_inventory.set_creative_formspec(player, 0, 1, tonumber(fields.tabs))
end
elseif fields.clear then
creative_inventory[player_name].filter = ""
creative_inventory.update(player_name, nil, tab_id)
creative_inventory.set_creative_formspec(player, 0, 1, tab_id)
elseif fields.search then
creative_inventory[player_name].filter = fields.filter:lower()
creative_inventory.update(player_name, fields.filter:lower(), tab_id)
creative_inventory.set_creative_formspec(player, 0, 1, tab_id)
else
if fields.creative_prev then
start_i = start_i - 3*8
if start_i < 0 then
start_i = inv_size - (inv_size % (3*8))
end
elseif fields.creative_next then
start_i = start_i + 3*8
if start_i >= inv_size then
start_i = 0
end
end
if start_i < 0 then creative_inventory.set_creative_formspec(player, start_i, start_i / (3*8) + 1, tab_id)
start_i = start_i + 4*6
end end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end) end)
if minetest.setting_getbool("creative_mode") then if minetest.setting_getbool("creative_mode") then
@ -137,7 +208,7 @@ if minetest.setting_getbool("creative_mode") then
minetest.register_item(":", { minetest.register_item(":", {
type = "none", type = "none",
wield_image = "wieldhand.png", wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5}, wield_scale = {x=1, y=1, z=2.5},
range = 10, range = 10,
tool_capabilities = { tool_capabilities = {
full_punch_interval = 0.5, full_punch_interval = 0.5,
@ -163,7 +234,7 @@ if minetest.setting_getbool("creative_mode") then
end end
local inv = digger:get_inventory() local inv = digger:get_inventory()
if inv then if inv then
for _,item in ipairs(drops) do for _, item in ipairs(drops) do
item = ItemStack(item):get_name() item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then if not inv:contains_item("main", item) then
inv:add_item("main", item) inv:add_item("main", item)
@ -171,5 +242,4 @@ if minetest.setting_getbool("creative_mode") then
end end
end end
end end
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@ -148,6 +148,14 @@ BlockMen (CC BY-SA 3.0):
heart.png heart.png
gui_*.png gui_*.png
sofar (CC BY-SA 3.0):
default_book_written.png, based on default_book.png
default_aspen_sapling
default_aspen_leaves
default_aspen_tree
default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
default_aspen_wood, derived from default_pine_wood (by paramat)
Neuromancer (CC BY-SA 2.0): Neuromancer (CC BY-SA 2.0):
default_cobble.png, based on texture by Brane praefect default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect default_mossycobble.png, based on texture by Brane praefect

View File

@ -35,6 +35,13 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = 'default:aspen_wood 4',
recipe = {
{'default:aspen_tree'},
}
})
minetest.register_craft({ minetest.register_craft({
output = 'default:stick 9', output = 'default:stick 9',
recipe = { recipe = {

View File

@ -85,12 +85,42 @@ minetest.register_craftitem("default:book", {
minetest.register_craftitem("default:book_written", { minetest.register_craftitem("default:book_written", {
description = "Book With Text", description = "Book With Text",
inventory_image = "default_book.png", inventory_image = "default_book_written.png",
groups = {book=1, not_in_creative_inventory=1}, groups = {book=1, not_in_creative_inventory=1},
stack_max = 1, stack_max = 1,
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",
wield_scale = {x = 1, y = 1, z = 2}, wield_scale = {x = 1, y = 1, z = 2},

View File

@ -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")
@ -74,10 +75,11 @@ function default.register_ores()
-- Sand -- Sand
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "default:sand", ore = "default:sand",
wherein = {"default:stone"}, wherein = {"default:stone", "default:sandstone",
"default:desert_stone"},
clust_scarcity = 24 * 24 * 24, clust_scarcity = 24 * 24 * 24,
clust_size = 7, clust_size = 7,
y_min = -63, y_min = -63,
@ -96,9 +98,9 @@ function default.register_ores()
-- Dirt -- Dirt
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "default:dirt", ore = "default:dirt",
wherein = {"default:stone"}, wherein = {"default:stone", "default:sandstone"},
clust_scarcity = 24 * 24 * 24, clust_scarcity = 24 * 24 * 24,
clust_size = 7, clust_size = 7,
y_min = -63, y_min = -63,
@ -117,9 +119,9 @@ function default.register_ores()
-- Gravel -- Gravel
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "default:gravel", ore = "default:gravel",
wherein = {"default:stone"}, wherein = {"default:stone"},
clust_scarcity = 24 * 24 * 24, clust_scarcity = 24 * 24 * 24,
clust_size = 7, clust_size = 7,
y_min = -31000, y_min = -31000,
@ -773,12 +775,30 @@ function default.register_biomes()
--depth_water_top = , --depth_water_top = ,
--node_water = "", --node_water = "",
--node_river_water = "", --node_river_water = "",
y_min = 5, y_min = 6,
y_max = 31000, y_max = 31000,
heat_point = 40, heat_point = 40,
humidity_point = 35, humidity_point = 35,
}) })
minetest.register_biome({
name = "stone_grassland_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 40,
humidity_point = 35,
})
minetest.register_biome({ minetest.register_biome({
name = "stone_grassland_ocean", name = "stone_grassland_ocean",
--node_dust = "", --node_dust = "",
@ -810,12 +830,30 @@ function default.register_biomes()
--depth_water_top = , --depth_water_top = ,
--node_water = "", --node_water = "",
--node_river_water = "", --node_river_water = "",
y_min = 5, y_min = 6,
y_max = 31000, y_max = 31000,
heat_point = 40, heat_point = 40,
humidity_point = 65, humidity_point = 65,
}) })
minetest.register_biome({
name = "coniferous_forest_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 40,
humidity_point = 65,
})
minetest.register_biome({ minetest.register_biome({
name = "coniferous_forest_ocean", name = "coniferous_forest_ocean",
--node_dust = "", --node_dust = "",
@ -847,12 +885,30 @@ function default.register_biomes()
--depth_water_top = , --depth_water_top = ,
--node_water = "", --node_water = "",
--node_river_water = "", --node_river_water = "",
y_min = 5, y_min = 6,
y_max = 31000, y_max = 31000,
heat_point = 60, heat_point = 60,
humidity_point = 35, humidity_point = 35,
}) })
minetest.register_biome({
name = "sandstone_grassland_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 60,
humidity_point = 35,
})
minetest.register_biome({ minetest.register_biome({
name = "sandstone_grassland_ocean", name = "sandstone_grassland_ocean",
--node_dust = "", --node_dust = "",
@ -1227,7 +1283,9 @@ local function register_grass_decoration(offset, scale, length)
persist = 0.6 persist = 0.6
}, },
biomes = {"stone_grassland", "sandstone_grassland", biomes = {"stone_grassland", "sandstone_grassland",
"deciduous_forest", "coniferous_forest"}, "deciduous_forest", "coniferous_forest",
"stone_grassland_dunes", "sandstone_grassland_dunes",
"coniferous_forest_dunes"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
decoration = "default:grass_"..length, decoration = "default:grass_"..length,
@ -1257,7 +1315,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",
@ -1278,7 +1336,40 @@ 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 = 16,
noise_params = {
offset = 0.002,
scale = 0.001,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
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",
@ -1293,7 +1384,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",
@ -1314,7 +1431,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",
@ -1336,6 +1479,90 @@ 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",
})
-- Aspen tree and log
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.01,
scale = -0.02,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"deciduous_forest"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.0005,
scale = -0.001,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
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:aspen_tree", param2 = 12 },
{ name = "default:aspen_tree", param2 = 12 },
{ name = "default:aspen_tree", param2 = 12, prob = 127 },
{ name = "flowers:mushroom_red", prob = 63 },
{ name = "flowers:mushroom_brown", prob = 63 },
{ name = "air", prob = 0 },
},
},
flags = "place_center_x",
rotation = "random",
})
-- Large cactus -- Large cactus
minetest.register_decoration({ minetest.register_decoration({

View File

@ -80,6 +80,11 @@ default:acacia_wood
default:acacia_leaves default:acacia_leaves
default:acacia_sapling default:acacia_sapling
default:aspen_tree
default:aspen_wood
default:aspen_leaves
default:aspen_sapling
default:cherry_tree default:cherry_tree
default:cherry_log default:cherry_log
default:cherry_plank default:cherry_plank
@ -822,6 +827,58 @@ minetest.register_node("default:acacia_sapling", {
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
minetest.register_node("default:aspen_tree", {
description = "Aspen Tree",
tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png",
"default_aspen_tree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node("default:aspen_wood", {
description = "Aspen Wood Planks",
tiles = {"default_aspen_wood.png"},
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("default:aspen_leaves", {
description = "Aspen Leaves",
drawtype = "allfaces_optional",
visual_scale = 1.3,
tiles = {"default_aspen_leaves.png"},
waving = 1,
paramtype = "light",
is_ground_content = false,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
drop = {
max_items = 1,
items = {
{items = {"default:aspen_sapling"}, rarity = 20},
{items = {"default:aspen_leaves"}}
}
},
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
minetest.register_node("default:aspen_sapling", {
description = "Aspen Tree Sapling",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_aspen_sapling.png"},
inventory_image = "default_aspen_sapling.png",
wield_image = "default_aspen_sapling.png",
paramtype = "light",
sunlight_propagates = true,
})
-- From BFD, cherry tree -- From BFD, cherry tree
minetest.register_node("default:cherry_tree", { minetest.register_node("default:cherry_tree", {
description = "Cherry Log", description = "Cherry Log",
@ -906,7 +963,8 @@ minetest.register_node("default:cherry_sapling", {
type = "fixed", type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
}, },
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}, groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -1376,8 +1434,8 @@ minetest.register_node("default:water_source", {
liquid_alternative_flowing = "default:water_flowing", liquid_alternative_flowing = "default:water_flowing",
liquid_alternative_source = "default:water_source", liquid_alternative_source = "default:water_source",
liquid_viscosity = 1, liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
liquid_range = 6, liquid_range = 6,
post_effect_color = {a = 120, r = 20, g = 60, b = 80},
groups = {water = 3, liquid = 3, puts_out_fire = 1}, groups = {water = 3, liquid = 3, puts_out_fire = 1},
}) })
@ -1422,8 +1480,8 @@ minetest.register_node("default:water_flowing", {
liquid_alternative_flowing = "default:water_flowing", liquid_alternative_flowing = "default:water_flowing",
liquid_alternative_source = "default:water_source", liquid_alternative_source = "default:water_source",
liquid_viscosity = 1, liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
liquid_range = 6, liquid_range = 6,
post_effect_color = {a = 120, r = 20, g = 60, b = 80},
groups = {water = 3, liquid = 3, puts_out_fire = 1, groups = {water = 3, liquid = 3, puts_out_fire = 1,
not_in_creative_inventory=1}, not_in_creative_inventory=1},
}) })
@ -1470,7 +1528,7 @@ minetest.register_node("default:river_water_source", {
liquid_viscosity = 1, liquid_viscosity = 1,
liquid_renewable = false, liquid_renewable = false,
liquid_range = 2, liquid_range = 2,
post_effect_color = {a = 64, r = 100, g = 100, b = 200}, post_effect_color = {a = 103, r = 30, g = 76, b = 90},
groups = {water = 3, liquid = 3, puts_out_fire = 1}, groups = {water = 3, liquid = 3, puts_out_fire = 1},
}) })
@ -1517,7 +1575,7 @@ minetest.register_node("default:river_water_flowing", {
liquid_viscosity = 1, liquid_viscosity = 1,
liquid_renewable = false, liquid_renewable = false,
liquid_range = 2, liquid_range = 2,
post_effect_color = {a = 64, r = 100, g = 100, b = 200}, post_effect_color = {a = 103, r = 30, g = 76, b = 90},
groups = {water = 3, liquid = 3, puts_out_fire = 1, groups = {water = 3, liquid = 3, puts_out_fire = 1,
not_in_creative_inventory = 1}, not_in_creative_inventory = 1},
}) })
@ -1566,7 +1624,7 @@ minetest.register_node("default:lava_source", {
liquid_range = 6, liquid_range = 6,
liquid_renewable = false, liquid_renewable = false,
damage_per_second = 4 * 2, damage_per_second = 4 * 2,
post_effect_color = {a = 220, r = 250, g = 70, b = 20}, post_effect_color = {a = 191, r = 255, g = 64, b = 0},
groups = {lava = 3, liquid = 2, hot = 3, igniter = 1}, groups = {lava = 3, liquid = 2, hot = 3, igniter = 1},
}) })
@ -1614,7 +1672,7 @@ minetest.register_node("default:lava_flowing", {
liquid_range = 6, liquid_range = 6,
liquid_renewable = false, liquid_renewable = false,
damage_per_second = 4 * 2, damage_per_second = 4 * 2,
post_effect_color = {a = 220, r = 250, g = 70, b = 20}, post_effect_color = {a = 191, r = 255, g = 64, b = 0},
groups = {lava = 3, liquid = 2, hot = 3, igniter = 1, groups = {lava = 3, liquid = 2, hot = 3, igniter = 1,
not_in_creative_inventory = 1}, not_in_creative_inventory = 1},
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

View File

@ -28,7 +28,8 @@ end
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:sapling", "default:junglesapling", nodenames = {"default:sapling", "default:junglesapling",
"default:pine_sapling", "default:acacia_sapling"}, "default:pine_sapling", "default:acacia_sapling",
"default:aspen_sapling"},
interval = 10, interval = 10,
chance = 50, chance = 50,
action = function(pos, node) action = function(pos, node)
@ -65,6 +66,10 @@ minetest.register_abm({
minetest.log("action", "An acacia sapling grows into a tree at ".. minetest.log("action", "An acacia sapling grows into a tree at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
default.grow_new_acacia_tree(pos) default.grow_new_acacia_tree(pos)
elseif node.name == "default:aspen_sapling" then
minetest.log("action", "An aspen sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_aspen_tree(pos)
end end
end end
}) })
@ -395,6 +400,14 @@ function default.grow_new_acacia_tree(pos)
path, random, nil, false) path, random, nil, false)
end end
-- New aspen tree
function default.grow_new_aspen_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/aspen_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, 0, nil, false)
end
-- From BFD: -- From BFD:
minetest.register_node("default:mg_cherry_sapling", { minetest.register_node("default:mg_cherry_sapling", {

View File

@ -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
@ -30,11 +31,15 @@ following textures created by celeron55 (CC BY-SA 3.0):
door_trapdoor_side.png door_trapdoor_side.png
door_glass_a.png door_glass_a.png
door_glass_b.png door_glass_b.png
following Textures created by PenguinDad (CC BY-SA 4.0): 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

View File

@ -512,7 +512,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
@ -520,7 +532,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
@ -530,6 +542,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)
@ -576,6 +600,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 = {
@ -585,6 +622,14 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = 'doors:trapdoor_steel',
recipe = {
{'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot'},
}
})
doors.register_trapdoor("doors:trapdoor_cherry", { doors.register_trapdoor("doors:trapdoor_cherry", {
description = "Cherry tree trapdoor", description = "Cherry tree trapdoor",
inventory_image = "doors_trapdoor_cherry.png", inventory_image = "doors_trapdoor_cherry.png",

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

View File

@ -147,120 +147,84 @@ minetest.register_abm({
-- Mushrooms -- Mushrooms
-- --
local mushrooms_datas = { minetest.register_node("flowers:mushroom_red", {
{"brown", 2}, description = "Red Mushroom",
{"red", -6} tiles = {"flowers_mushroom_red.png"},
} inventory_image = "flowers_mushroom_red.png",
wield_image = "flowers_mushroom_red.png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(-5),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
for _, m in pairs(mushrooms_datas) do minetest.register_node("flowers:mushroom_brown", {
local name, nut = m[1], m[2] description = "Brown Mushroom",
tiles = {"flowers_mushroom_brown.png"},
-- Register fertile mushrooms inventory_image = "flowers_mushroom_brown.png",
wield_image = "flowers_mushroom_brown.png",
-- These are placed by mapgen and the growing ABM. drawtype = "plantlike",
-- These drop an infertile mushroom, and 0 to 3 spore paramtype = "light",
-- nodes with an average of 1.25 per mushroom, for sunlight_propagates = true,
-- a slow multiplication of mushrooms when farming. walkable = false,
buildable_to = true,
minetest.register_node("flowers:mushroom_fertile_" .. name, { groups = {snappy = 3, flammable = 3, attached_node = 1},
description = string.sub(string.upper(name), 0, 1) .. sounds = default.node_sound_leaves_defaults(),
string.sub(name, 2) .. " Fertile Mushroom", on_use = minetest.item_eat(1),
tiles = {"flowers_mushroom_" .. name .. ".png"}, selection_box = {
inventory_image = "flowers_mushroom_" .. name .. ".png", type = "fixed",
wield_image = "flowers_mushroom_" .. name .. ".png", fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
drawtype = "plantlike", }
paramtype = "light", })
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1,
not_in_creative_inventory = 1},
drop = {
items = {
{items = {"flowers:mushroom_" .. name}},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 4},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 2},
{items = {"flowers:mushroom_spores_" .. name}, rarity = 2}
}
},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- Register infertile mushrooms
-- These do not drop spores, to avoid the use of repeated digging
-- and placing of a single mushroom to generate unlimited spores.
minetest.register_node("flowers:mushroom_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom",
tiles = {"flowers_mushroom_" .. name .. ".png"},
inventory_image = "flowers_mushroom_" .. name .. ".png",
wield_image = "flowers_mushroom_" .. name .. ".png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- Register mushroom spores
minetest.register_node("flowers:mushroom_spores_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom Spores",
drawtype = "signlike",
tiles = {"flowers_mushroom_spores_" .. name .. ".png"},
inventory_image = "flowers_mushroom_spores_" .. name .. ".png",
wield_image = "flowers_mushroom_spores_" .. name .. ".png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
selection_box = {
type = "wallmounted",
},
groups = {dig_immediate = 3, attached_node = 1},
})
end
-- Register growing ABM
-- mushroom spread and death
minetest.register_abm({ minetest.register_abm({
nodenames = {"flowers:mushroom_spores_brown", "flowers:mushroom_spores_red"}, nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
interval = 11, interval = 11,
chance = 50, chance = 50,
action = function(pos, node) action = function(pos, node)
local node_under = minetest.get_node_or_nil({x = pos.x, if minetest.get_node_light(pos, nil) == 15 then
y = pos.y - 1, z = pos.z}) minetest.remove_node(pos)
end
local random = {
x = pos.x + math.random(-2,2),
y = pos.y + math.random(-1,1),
z = pos.z + math.random(-2,2)
}
local random_node = minetest.get_node_or_nil(random)
if not random_node then
return
end
if random_node.name ~= "air" then
return
end
local node_under = minetest.get_node_or_nil({x = random.x,
y = random.y - 1, z = random.z})
if not node_under then if not node_under then
return return
end end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos, nil) <= 13 then minetest.get_node_light(pos, nil) <= 9 and
if node.name == "flowers:mushroom_spores_brown" then minetest.get_node_light(random, nil) <= 9 then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_brown"}) minetest.set_node(random, {name = node.name})
elseif node.name == "flowers:mushroom_spores_red" then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_red"})
end
end end
end end
}) })
-- these old mushroom related nodes can be simplified now
minetest.register_alias("flowers:mushroom_spores_brown", "flowers:mushroom_brown")
minetest.register_alias("flowers:mushroom_spores_red", "flowers:mushroom_red")
minetest.register_alias("flowers:mushroom_fertile_brown", "flowers:mushroom_brown")
minetest.register_alias("flowers:mushroom_fertile_red", "flowers:mushroom_red")
-- --
-- Waterlily -- Waterlily

View File

@ -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
@ -87,8 +87,8 @@ local function register_flower(seed, name)
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = -0.02, offset = -0.015,
scale = 0.03, scale = 0.025,
spread = {x = 200, y = 200, z = 200}, spread = {x = 200, y = 200, z = 200},
seed = seed, seed = seed,
octaves = 3, octaves = 3,
@ -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

View File

@ -36,6 +36,10 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name] local ndef = minetest.registered_nodes[node.name]
-- verify node is facedir (expected to be rotatable)
if ndef.paramtype2 ~= "facedir" then
return
end
-- Compute param2 -- Compute param2
local rotationPart = node.param2 % 32 -- get first 4 bits local rotationPart = node.param2 % 32 -- get first 4 bits
local preservePart = node.param2 - rotationPart local preservePart = node.param2 - rotationPart

View File

@ -287,6 +287,13 @@ stairs.register_stair_and_slab("acacia_wood", "default:acacia_wood",
"Acacia Wood Slab", "Acacia Wood Slab",
default.node_sound_wood_defaults()) default.node_sound_wood_defaults())
stairs.register_stair_and_slab("aspen_wood", "default:aspen_wood",
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_aspen_wood.png"},
"Aspen Wood Stair",
"Aspen Wood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("stone", "default:stone", stairs.register_stair_and_slab("stone", "default:stone",
{cracky = 3}, {cracky = 3},
{"default_stone.png"}, {"default_stone.png"},