1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 01:30:38 +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
creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
creative_inventory.init_creative_inventory = function(player)
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)
if minetest.setting_getbool("creative_mode") then
return count
@ -35,19 +40,41 @@ minetest.after(0, function()
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 = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
local inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
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
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
inv:set_list("main", creative_list)
creative_inventory.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
creative_inventory[player_name].size = #creative_list
end
-- Create the trash field
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)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum, tab_id)
local player_name = player:get_player_name()
local filter = creative_inventory[player_name].filter or ""
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec(
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;5,3.5;8,1;]"..
"list[current_player;main;5,4.75;8,3;8]"..
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"listring[current_player;main]"..
"listring[current_player;craft]"..
"listring[current_player;main]"..
"listring[detached:creative;main]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]"..
default.get_hotbar_bg(5,3.5)
local pagemax = math.floor((creative_inventory[player_name].size - 1) / (3*8) + 1)
tab_id = tab_id or 2
player:set_inventory_formspec([[
size[8,8.6]
image[4.06,3.4;0.8,0.8;trash_icon.png]
list[current_player;main;0,4.7;8,1;]
list[current_player;main;0,5.85;8,3;8]
list[detached:creative_trash;main;4,3.3;1,1;]
tablecolumns[color;text;color;text]
tableoptions[background=#00000000;highlight=#00000000;border=false]
button[5.4,3.2;0.8,0.9;creative_prev;<]
button[7.25,3.2;0.8,0.9;creative_next;>]
button[2.1,3.4;0.8,0.5;search;?]
button[2.75,3.4;0.8,0.5;clear;X]
tooltip[search;Search]
tooltip[clear;Reset]
listring[current_player;main]
]] ..
"field[0.3,3.5;2.2,1;filter;;".. filter .."]"..
"listring[detached:creative_".. player_name ..";main]"..
"tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;".. tostring(tab_id) ..";true;false]"..
"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
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)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
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)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local player_name = player:get_player_name()
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
if fields.creative_prev then
start_i = start_i - 4*6
end
if fields.creative_next then
start_i = start_i + 4*6
end
if fields.quit then
if tab_id == 1 then
creative_inventory.set_crafting_formspec(player)
end
elseif fields.tabs then
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
start_i = start_i + 4*6
creative_inventory.set_creative_formspec(player, start_i, start_i / (3*8) + 1, tab_id)
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)
if minetest.setting_getbool("creative_mode") then
@ -137,7 +208,7 @@ if minetest.setting_getbool("creative_mode") then
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
wield_scale = {x=1, y=1, z=2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
@ -163,7 +234,7 @@ if minetest.setting_getbool("creative_mode") then
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
for _, item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
@ -171,5 +242,4 @@ if minetest.setting_getbool("creative_mode") then
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
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):
default_cobble.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({
output = 'default:stick 9',
recipe = {

View File

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

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")
@ -74,10 +75,11 @@ function default.register_ores()
-- Sand
minetest.register_ore({
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone"},
minetest.register_ore({
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone", "default:sandstone",
"default:desert_stone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -63,
@ -96,9 +98,9 @@ function default.register_ores()
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone"},
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone", "default:sandstone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -63,
@ -117,9 +119,9 @@ function default.register_ores()
-- Gravel
minetest.register_ore({
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -31000,
@ -773,12 +775,30 @@ function default.register_biomes()
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_min = 6,
y_max = 31000,
heat_point = 40,
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({
name = "stone_grassland_ocean",
--node_dust = "",
@ -810,12 +830,30 @@ function default.register_biomes()
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_min = 6,
y_max = 31000,
heat_point = 40,
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({
name = "coniferous_forest_ocean",
--node_dust = "",
@ -847,12 +885,30 @@ function default.register_biomes()
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_min = 6,
y_max = 31000,
heat_point = 60,
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({
name = "sandstone_grassland_ocean",
--node_dust = "",
@ -1227,7 +1283,9 @@ local function register_grass_decoration(offset, scale, length)
persist = 0.6
},
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_max = 31000,
decoration = "default:grass_"..length,
@ -1257,7 +1315,7 @@ end
function default.register_decorations()
minetest.clear_registered_decorations()
-- Apple tree
-- Apple tree and log
minetest.register_decoration({
deco_type = "schematic",
@ -1278,7 +1336,40 @@ 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 = 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({
deco_type = "schematic",
@ -1293,7 +1384,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",
@ -1314,7 +1431,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",
@ -1336,6 +1479,90 @@ 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",
})
-- 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
minetest.register_decoration({

View File

@ -80,6 +80,11 @@ default:acacia_wood
default:acacia_leaves
default:acacia_sapling
default:aspen_tree
default:aspen_wood
default:aspen_leaves
default:aspen_sapling
default:cherry_tree
default:cherry_log
default:cherry_plank
@ -822,6 +827,58 @@ minetest.register_node("default:acacia_sapling", {
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
minetest.register_node("default:cherry_tree", {
description = "Cherry Log",
@ -906,7 +963,8 @@ minetest.register_node("default:cherry_sapling", {
type = "fixed",
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(),
})
@ -1376,8 +1434,8 @@ minetest.register_node("default:water_source", {
liquid_alternative_flowing = "default:water_flowing",
liquid_alternative_source = "default:water_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
liquid_range = 6,
post_effect_color = {a = 120, r = 20, g = 60, b = 80},
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_source = "default:water_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
liquid_range = 6,
post_effect_color = {a = 120, r = 20, g = 60, b = 80},
groups = {water = 3, liquid = 3, puts_out_fire = 1,
not_in_creative_inventory=1},
})
@ -1470,7 +1528,7 @@ minetest.register_node("default:river_water_source", {
liquid_viscosity = 1,
liquid_renewable = false,
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},
})
@ -1517,7 +1575,7 @@ minetest.register_node("default:river_water_flowing", {
liquid_viscosity = 1,
liquid_renewable = false,
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,
not_in_creative_inventory = 1},
})
@ -1566,7 +1624,7 @@ minetest.register_node("default:lava_source", {
liquid_range = 6,
liquid_renewable = false,
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},
})
@ -1614,7 +1672,7 @@ minetest.register_node("default:lava_flowing", {
liquid_range = 6,
liquid_renewable = false,
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,
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({
nodenames = {"default:sapling", "default:junglesapling",
"default:pine_sapling", "default:acacia_sapling"},
"default:pine_sapling", "default:acacia_sapling",
"default:aspen_sapling"},
interval = 10,
chance = 50,
action = function(pos, node)
@ -65,6 +66,10 @@ minetest.register_abm({
minetest.log("action", "An acacia sapling grows into a tree at "..
minetest.pos_to_string(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
})
@ -395,6 +400,14 @@ function default.grow_new_acacia_tree(pos)
path, random, nil, false)
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:
minetest.register_node("default:mg_cherry_sapling", {

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

@ -512,7 +512,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
@ -520,7 +532,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
@ -530,6 +542,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)
@ -576,6 +600,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 = {
@ -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", {
description = "Cherry tree trapdoor",
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
--
local mushrooms_datas = {
{"brown", 2},
{"red", -6}
}
minetest.register_node("flowers:mushroom_red", {
description = "Red Mushroom",
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
local name, nut = m[1], m[2]
-- Register fertile mushrooms
-- These are placed by mapgen and the growing ABM.
-- These drop an infertile mushroom, and 0 to 3 spore
-- nodes with an average of 1.25 per mushroom, for
-- a slow multiplication of mushrooms when farming.
minetest.register_node("flowers:mushroom_fertile_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Fertile 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,
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
minetest.register_node("flowers:mushroom_brown", {
description = "Brown Mushroom",
tiles = {"flowers_mushroom_brown.png"},
inventory_image = "flowers_mushroom_brown.png",
wield_image = "flowers_mushroom_brown.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(1),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- mushroom spread and death
minetest.register_abm({
nodenames = {"flowers:mushroom_spores_brown", "flowers:mushroom_spores_red"},
nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
interval = 11,
chance = 50,
action = function(pos, node)
local node_under = minetest.get_node_or_nil({x = pos.x,
y = pos.y - 1, z = pos.z})
if minetest.get_node_light(pos, nil) == 15 then
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
return
end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos, nil) <= 13 then
if node.name == "flowers:mushroom_spores_brown" then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_brown"})
elseif node.name == "flowers:mushroom_spores_red" then
minetest.set_node(pos, {name = "flowers:mushroom_fertile_red"})
end
minetest.get_node_light(pos, nil) <= 9 and
minetest.get_node_light(random, nil) <= 9 then
minetest.set_node(random, {name = node.name})
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

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

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

View File

@ -287,6 +287,13 @@ stairs.register_stair_and_slab("acacia_wood", "default:acacia_wood",
"Acacia Wood Slab",
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",
{cracky = 3},
{"default_stone.png"},