[mp_minetest] Downgrade to stable version

This commit is contained in:
AntumDeluge 2017-05-24 13:29:30 -07:00
parent 04266fd789
commit 1b0e93bc36
97 changed files with 743 additions and 2013 deletions

View File

@ -209,6 +209,8 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* barn
* mobf
* mobf_settings
* [minetest][minetest_game] ([LGPL][lic.lgpl2.1] / [CC BY-SA][lic.ccbysa3.0]) -- version: [0.4.15 (3c9d089 Git)][ver.minetest_game] *2016-12-21*
* mp_minetest/
* [moremesecons][] ([MPL][lic.mpl2.0]) -- version: [e1d2e84 Git][ver.moremesecons] *2017-05-02* ([patched][patch.moremesecons])
* mp_moremesecons/
* [mydoors][] ([CC-BY / CC-BY-SA][lic.mydoors] / [WTFPL][lic.wtfpl] / [DWYWFPL][lic.dwywpl]) -- version: [63aef13 Git][ver.mydoors] *2017-03-31* ([patched][patch.mydoors])
@ -281,6 +283,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[kpgmobs]: https://forum.minetest.net/viewtopic.php?t=8798
[lightning]: https://forum.minetest.net/viewtopic.php?t=13886
[mesecons]: https://forum.minetest.net/viewtopic.php?t=628
[minetest_game]: https://github.com/minetest/minetest_game
[mobs_goblins]: https://forum.minetest.net/viewtopic.php?t=13004
[mobs_monster]: https://github.com/tenplus1/mobs_monster
[mobs_redo]: https://forum.minetest.net/viewtopic.php?t=9917
@ -289,6 +292,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[moremesecons]: https://forum.minetest.net/viewtopic.php?t=13150
[moreores]: https://forum.minetest.net/viewtopic.php?t=549
[moretrees]: https://forum.minetest.net/viewtopic.php?t=4394
[mthudclock]: https://forum.minetest.net/viewtopic.php?t=11879
[mydoors]: https://forum.minetest.net/viewtopic.php?t=10626
[mywoodslopes]: https://forum.minetest.net/viewtopic.php?t=11433
[nether]: https://forum.minetest.net/viewtopic.php?t=5790
@ -476,6 +480,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.jukebox]: https://github.com/minetest-mods/jukebox/tree/e6a507f
[ver.lightning]: https://github.com/minetest-mods/lightning/tree/39bd36c
[ver.mesecons]: https://github.com/minetest-mods/mesecons/tree/564bdc2
[ver.minetest_game]: https://github.com/minetest/minetest_game/tree/3c9d089
[ver.mobf_core]: https://github.com/sapier/mobf_core/tree/1199ca9
[ver.mobs_goblins]: https://github.com/FreeLikeGNU/mobs_goblins/tree/a346f85
[ver.mobs_monster]: https://github.com/tenplus1/mobs_monster/tree/f6d0e01
@ -484,6 +489,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.moreblocks]: https://github.com/minetest-mods/moreblocks/tree/fbfb079
[ver.moremesecons]: https://github.com/minetest-mods/MoreMesecons/tree/e1d2e84
[ver.moreores]: https://github.com/minetest-mods/moreores/tree/0842b4f
[ver.mthudclock]: https://github.com/Rochambeau/mthudclock/tree/b3e2142
[ver.mydoors]: https://github.com/minetest-mods/mydoors/tree/63aef13
[ver.mywoodslopes]: https://github.com/minetest-mods/mywoodslopes/tree/3a1b531
[ver.nether]: https://github.com/PilzAdam/nether/tree/bc2ccfb

View File

@ -34,7 +34,7 @@ function beds.register_bed(name, def)
is_ground_content = false,
stack_max = 1,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = def.sounds or default.node_sound_wood_defaults(),
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.bottom,
@ -46,14 +46,6 @@ function beds.register_bed(name, def)
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
local pos
if minetest.registered_items[minetest.get_node(under).name].buildable_to then
pos = under
@ -89,8 +81,7 @@ function beds.register_bed(name, def)
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
@ -147,7 +138,7 @@ function beds.register_bed(name, def)
is_ground_content = false,
pointable = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = def.sounds or default.node_sound_wood_defaults(),
sounds = default.node_sound_wood_defaults(),
drop = name .. "_bottom",
node_box = {
type = "fixed",

View File

@ -29,7 +29,6 @@ local function is_night_skip_enabled()
return enable_night_skip
end
--[[
local function check_in_beds(players)
local in_bed = beds.player
if not players then
@ -45,12 +44,6 @@ local function check_in_beds(players)
return #players > 0
end
]]--
-- Allow night skip if any player is in bed
local function check_in_beds(players)
return true
end
local function lay_down(player, pos, bed_pos, state, skip)
local name = player:get_player_name()

View File

@ -110,8 +110,7 @@ function boat.on_punch(self, puncher)
if not self.driver then
self.removed = true
local inv = puncher:get_inventory()
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(puncher:get_player_name()))
if not minetest.setting_getbool("creative_mode")
or not inv:contains_item("main", "boats:boat") then
local leftover = inv:add_item("main", "boats:boat")
-- if no room in inventory add a replacement boat to the world
@ -226,15 +225,6 @@ minetest.register_craftitem("boats:boat", {
groups = {flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
@ -245,8 +235,7 @@ minetest.register_craftitem("boats:boat", {
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
if boat then
boat:setyaw(placer:get_look_horizontal())
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
end

View File

@ -167,8 +167,7 @@ minetest.register_on_dieplayer(function(player)
end
-- return if keep inventory set or in creative mode
if bones_mode == "keep" or (creative and creative.is_enabled_for
and creative.is_enabled_for(player:get_player_name())) then
if bones_mode == "keep" or minetest.setting_getbool("creative_mode") then
return
end

View File

@ -92,8 +92,7 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
end
-- Pick up cart
local inv = puncher:get_inventory()
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(puncher:get_player_name()))
if not minetest.setting_getbool("creative_mode")
or not inv:contains_item("main", "carts:cart") then
local leftover = inv:add_item("main", "carts:cart")
-- If no room in inventory add a replacement cart to the world
@ -363,15 +362,6 @@ minetest.register_craftitem("carts:cart", {
inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"),
wield_image = "carts_cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if not pointed_thing.type == "node" then
return
end
@ -386,8 +376,7 @@ minetest.register_craftitem("carts:cart", {
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
{pos = pointed_thing.above})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack

View File

@ -181,8 +181,8 @@ function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
return false
end
function carts:register_rail(name, def_overwrite, railparams)
local def = {
function carts:register_rail(name, def, railparams)
local def_default = {
drawtype = "raillike",
paramtype = "light",
sunlight_propagates = true,
@ -194,7 +194,7 @@ function carts:register_rail(name, def_overwrite, railparams)
},
sounds = default.node_sound_metal_defaults()
}
for k, v in pairs(def_overwrite) do
for k, v in pairs(def_default) do
def[k] = v
end
if not def.inventory_image then

View File

@ -10,11 +10,11 @@ carts:register_rail("carts:rail", {
}, {})
minetest.register_craft({
output = "carts:rail 18",
output = "carts:rail 16",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
}
})
@ -31,11 +31,11 @@ carts:register_rail("carts:powerrail", {
}, {acceleration = 5})
minetest.register_craft({
output = "carts:powerrail 18",
output = "carts:powerrail 8",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
}
})
@ -50,10 +50,10 @@ carts:register_rail("carts:brakerail", {
}, {acceleration = -3})
minetest.register_craft({
output = "carts:brakerail 18",
output = "carts:brakerail 8",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
}
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,14 +1,6 @@
creative = {}
local creative_mode_cache = minetest.setting_getbool("creative_mode")
function creative.is_enabled_for(name)
return creative_mode_cache
end
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
if creative_mode_cache then
if minetest.setting_getbool("creative_mode") then
-- Dig time is modified according to difference (leveldiff) between tool
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
-- leveldiff and 1.
@ -36,27 +28,22 @@ if creative_mode_cache then
damage_groups = {fleshy = 10},
}
})
end
-- Unlimited node placement
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return creative.is_enabled_for(placer:get_player_name())
end)
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return true
end)
-- Don't pick up if the item is already in the inventory
local old_handle_node_drops = minetest.handle_node_drops
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
if not creative.is_enabled_for(digger:get_player_name()) then
return old_handle_node_drops(pos, drops, digger)
end
local inv = digger:get_inventory()
if inv then
for _, item in ipairs(drops) do
if not inv:contains_item("main", item, true) then
inv:add_item("main", item)
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _, item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
end
end
end
end

View File

@ -1,3 +1,4 @@
creative = {}
local player_inventory = {}
function creative.init_creative_inventory(player)
@ -78,7 +79,7 @@ function creative.register_tab(name, title, items)
sfinv.register_page("creative:" .. name, {
title = title,
is_in_nav = function(self, player, context)
return creative.is_enabled_for(player:get_player_name())
return minetest.setting_getbool("creative_mode")
end,
get = function(self, player, context)
local player_name = player:get_player_name()
@ -171,7 +172,7 @@ creative.register_tab("craftitems", "Items", minetest.registered_craftitems)
local old_homepage_name = sfinv.get_homepage_name
function sfinv.get_homepage_name(player)
if creative.is_enabled_for(player:get_player_name()) then
if minetest.setting_getbool("creative_mode") then
return "creative:all"
else
return old_homepage_name(player)

View File

@ -17,7 +17,6 @@ Cisoun's texture pack (CC BY-SA 3.0):
default_lava.png
default_leaves.png
default_sapling.png
default_bush_sapling.png
default_stone.png
default_tree.png
default_tree_top.png
@ -78,6 +77,10 @@ Splizard (CC BY-SA 3.0):
Zeg9 (CC BY-SA 3.0):
default_coal_block.png
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
paramat (CC BY-SA 3.0):
wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0)
@ -87,7 +90,6 @@ paramat (CC BY-SA 3.0):
default_acacia_leaves.png
default_acacia_leaves_simple.png
default_acacia_sapling.png
default_acacia_bush_sapling.png
default_acacia_tree.png
default_acacia_tree_top.png
default_acacia_wood.png
@ -113,18 +115,11 @@ paramat (CC BY-SA 3.0):
default_grass_side.png
default_mese_block.png
default_silver_sand.png
default_mese_post_light_side.png
default_mese_post_light_side_dark.png
default_mese_post_light_top.png
default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_aspen_leaves.png -- Derived from Sofar's texture
default_wood.png
default_clay_brick.png
default_iron_ingot.png
@ -136,10 +131,10 @@ BlockMen (CC BY-SA 3.0):
default_lava_source_animated.png
default_lava_flowing_animated.png
default_stick.png
default_chest_front.png -- Texture kept for mod compability
default_chest_lock.png -- Texture kept for mod compability
default_chest_side.png -- Texture kept for mod compability
default_chest_top.png -- Texture kept for mod compability
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_mineral_mese.png
default_meselamp.png
bubble.png
@ -151,12 +146,10 @@ Wuzzy (CC BY-SA 3.0):
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)
default_chest_wood, default_chest_wood_locked derived from default_chest_* textures by BlockMen
sofar (WTFPL):
default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel
Neuromancer (CC BY-SA 2.0):
@ -202,25 +195,6 @@ Ferk (CC0 1.0)
default_item_smoke.png
default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart
npx (CC BY-SA 3.0)
default_rainforest_litter.png
default_rainforest_litter_side.png
kaeza (CC-BY-SA 3.0):
default_desert_sandstone.png
default_desert_sandstone_brick.png
default_desert_sandstone_block.png
kilbith (CC BY-SA 3.0):
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
default_tin_block.png
default_mineral_tin.png
default_tin_ingot.png
default_tin_lump.png
Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
2: http://www.freesound.org/people/Tomlija/sounds/97669/
@ -288,13 +262,3 @@ https://www.freesound.org/people/AGFX/packs/1253/
blukotek (CC0 1.0)
https://www.freesound.org/people/blukotek/sounds/251660/
default_dig_snappy.ogg
Chests sounds added by sofar, derived of several files mixed together:
default_chest_open.ogg
default_chest_close.ogg
- http://www.freesound.org/people/Sevin7/sounds/269722/ CC0
- http://www.freesound.org/people/Percy%20Duke/sounds/23448/ CC-BY-3.0
- http://www.freesound.org/people/kingsamas/sounds/135576/ CC-BY-3.0
- http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0
- http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0

View File

@ -392,6 +392,12 @@ minetest.register_craft({
}
})
minetest.register_craft({
type = "shapeless",
output = "default:bronze_ingot",
recipe = {"default:steel_ingot", "default:copper_ingot"},
})
minetest.register_craft({
output = 'default:coalblock',
recipe = {
@ -440,31 +446,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "default:tinblock",
recipe = {
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
}
})
minetest.register_craft({
output = "default:tin_ingot 9",
recipe = {
{"default:tinblock"},
}
})
minetest.register_craft({
output = "default:bronze_ingot 9",
recipe = {
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
{"default:copper_ingot", "default:tin_ingot", "default:copper_ingot"},
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
}
})
minetest.register_craft({
output = 'default:bronzeblock',
recipe = {
@ -514,98 +495,34 @@ minetest.register_craft({
})
minetest.register_craft({
output = "default:sandstone",
output = 'default:sandstone',
recipe = {
{"default:sand", "default:sand"},
{"default:sand", "default:sand"},
{'group:sand', 'group:sand'},
{'group:sand', 'group:sand'},
}
})
minetest.register_craft({
output = "default:sand 4",
output = 'default:sand 4',
recipe = {
{"default:sandstone"},
{'default:sandstone'},
}
})
minetest.register_craft({
output = "default:sandstonebrick 4",
output = 'default:sandstonebrick 4',
recipe = {
{"default:sandstone", "default:sandstone"},
{"default:sandstone", "default:sandstone"},
{'default:sandstone', 'default:sandstone'},
{'default:sandstone', 'default:sandstone'},
}
})
minetest.register_craft({
output = "default:sandstone_block 9",
output = 'default:sandstone_block 9',
recipe = {
{"default:sandstone", "default:sandstone", "default:sandstone"},
{"default:sandstone", "default:sandstone", "default:sandstone"},
{"default:sandstone", "default:sandstone", "default:sandstone"},
}
})
minetest.register_craft({
output = "default:desert_sandstone",
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
}
})
minetest.register_craft({
output = "default:desert_sand 4",
recipe = {
{"default:desert_sandstone"},
}
})
minetest.register_craft({
output = "default:desert_sandstone_brick 4",
recipe = {
{"default:desert_sandstone", "default:desert_sandstone"},
{"default:desert_sandstone", "default:desert_sandstone"},
}
})
minetest.register_craft({
output = "default:desert_sandstone_block 9",
recipe = {
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
}
})
minetest.register_craft({
output = "default:silver_sandstone",
recipe = {
{"default:silver_sand", "default:silver_sand"},
{"default:silver_sand", "default:silver_sand"},
}
})
minetest.register_craft({
output = "default:silver_sand 4",
recipe = {
{"default:silver_sandstone"},
}
})
minetest.register_craft({
output = "default:silver_sandstone_brick 4",
recipe = {
{"default:silver_sandstone", "default:silver_sandstone"},
{"default:silver_sandstone", "default:silver_sandstone"},
}
})
minetest.register_craft({
output = "default:silver_sandstone_block 9",
recipe = {
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
{'default:sandstone', 'default:sandstone', 'default:sandstone'},
{'default:sandstone', 'default:sandstone', 'default:sandstone'},
{'default:sandstone', 'default:sandstone', 'default:sandstone'},
}
})
@ -665,11 +582,11 @@ minetest.register_craft({
})
minetest.register_craft({
output = "default:ladder_wood 5",
output = 'default:ladder_wood 3',
recipe = {
{"group:stick", "", "group:stick"},
{"group:stick", "group:stick", "group:stick"},
{"group:stick", "", "group:stick"},
{'group:stick', '', 'group:stick'},
{'group:stick', 'group:stick', 'group:stick'},
{'group:stick', '', 'group:stick'},
}
})
@ -715,19 +632,10 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:meselamp',
output = 'default:meselamp 1',
recipe = {
{'default:glass'},
{'default:mese_crystal'},
}
})
minetest.register_craft({
output = "default:mese_post_light 3",
recipe = {
{"", "default:glass", ""},
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
{"", "group:wood", ""},
{'', 'default:mese_crystal',''},
{'default:mese_crystal', 'default:glass', 'default:mese_crystal'},
}
})
@ -868,12 +776,6 @@ minetest.register_craft({
recipe = "default:copper_lump",
})
minetest.register_craft({
type = "cooking",
output = "default:tin_ingot",
recipe = "default:tin_lump",
})
minetest.register_craft({
type = "cooking",
output = "default:gold_ingot",
@ -991,18 +893,6 @@ minetest.register_craft({
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "default:bush_sapling",
burntime = 6,
})
minetest.register_craft({
type = "fuel",
recipe = "default:acacia_bush_sapling",
burntime = 7,
})
minetest.register_craft({
type = "fuel",
recipe = "default:aspen_sapling",

View File

@ -12,23 +12,14 @@ minetest.register_craftitem("default:paper", {
groups = {flammable = 3},
})
local lpp = 14 -- Lines per book's page
local function book_on_use(itemstack, user)
local player_name = user:get_player_name()
local meta = itemstack:get_meta()
local data = minetest.deserialize(itemstack:get_metadata())
local title, text, owner = "", "", player_name
local page, page_max, lines, string = 1, 1, {}, ""
-- Backwards compatibility
local old_data = minetest.deserialize(itemstack:get_metadata())
if old_data then
meta:from_table({ fields = old_data })
end
local data = meta:to_table().fields
if data.owner then
if data then
title = data.title
text = data.text
owner = data.owner
@ -72,7 +63,6 @@ local function book_on_use(itemstack, user)
end
minetest.show_formspec(player_name, "default:book", formspec)
return itemstack
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
@ -91,42 +81,35 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
new_stack = ItemStack("default:book_written")
end
else
data = stack:get_meta():to_table().fields
end
if data and data.owner and data.owner ~= player:get_player_name() then
return
data = minetest.deserialize(stack:get_metadata())
end
if not data then data = {} end
data.title = fields.title
data.owner = player:get_player_name()
data.description = "\""..fields.title.."\" by "..data.owner
data.text = fields.text
data.text_len = #data.text
data.page = 1
data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)
data.owner = player:get_player_name()
local data_str = minetest.serialize(data)
if new_stack then
new_stack:get_meta():from_table({ fields = data })
new_stack:set_metadata(data_str)
if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack)
else
minetest.add_item(player:getpos(), new_stack)
end
else
stack:get_meta():from_table({ fields = data })
stack:set_metadata(data_str)
end
elseif fields.book_next or fields.book_prev then
local data = stack:get_meta():to_table().fields
local data = minetest.deserialize(stack:get_metadata())
if not data or not data.page then
return
end
data.page = tonumber(data.page)
data.page_max = tonumber(data.page_max)
if fields.book_next then
data.page = data.page + 1
if data.page > data.page_max then
@ -139,11 +122,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
stack:get_meta():from_table({fields = data})
stack = book_on_use(stack, player)
local data_str = minetest.serialize(data)
stack:set_metadata(data_str)
book_on_use(stack, player)
end
-- Update stack
player:set_wielded_item(stack)
end)
@ -184,69 +167,13 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
if not original then
return
end
local copymeta = original:get_meta():to_table()
local copymeta = original:get_metadata()
-- copy of the book held by player's mouse cursor
itemstack:get_meta():from_table(copymeta)
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:skeleton_key", {
description = "Skeleton Key",
inventory_image = "default_key_skeleton.png",
groups = {key = 1},
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if not node then
return itemstack
end
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
if not on_skeleton_key_use then
return itemstack
end
-- make a new key secret in case the node callback needs it
local random = math.random
local newsecret = string.format(
"%04x%04x%04x%04x",
random(2^16) - 1, random(2^16) - 1,
random(2^16) - 1, random(2^16) - 1)
local secret, _, _ = on_skeleton_key_use(pos, user, newsecret)
if secret then
local inv = minetest.get_inventory({type="player", name=user:get_player_name()})
-- update original itemstack
itemstack:take_item()
-- finish and return the new key
local new_stack = ItemStack("default:key")
local meta = new_stack:get_meta()
meta:set_string("secret", secret)
meta:set_string("description", "Key to "..user:get_player_name().."'s "
..minetest.registered_nodes[node.name].description)
if itemstack:get_count() == 0 then
itemstack = new_stack
else
if inv:add_item("main", new_stack):get_count() > 0 then
minetest.add_item(user:getpos(), new_stack)
end -- else: added to inventory successfully
end
return itemstack
end
end
})
minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump",
inventory_image = "default_coal_lump.png",
@ -263,11 +190,6 @@ minetest.register_craftitem("default:copper_lump", {
inventory_image = "default_copper_lump.png",
})
minetest.register_craftitem("default:tin_lump", {
description = "Tin Lump",
inventory_image = "default_tin_lump.png",
})
minetest.register_craftitem("default:mese_crystal", {
description = "Mese Crystal",
inventory_image = "default_mese_crystal.png",
@ -298,11 +220,6 @@ minetest.register_craftitem("default:copper_ingot", {
inventory_image = "default_copper_ingot.png",
})
minetest.register_craftitem("default:tin_ingot", {
description = "Tin Ingot",
inventory_image = "default_tin_ingot.png",
})
minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot",
inventory_image = "default_bronze_ingot.png",
@ -332,3 +249,4 @@ minetest.register_craftitem("default:flint", {
description = "Flint",
inventory_image = "default_flint.png"
})

View File

@ -1 +0,0 @@
craft_guide?

View File

@ -77,6 +77,8 @@ function default.node_sound_leaves_defaults(table)
{name = "default_grass_footstep", gain = 0.45}
table.dug = table.dug or
{name = "default_grass_footstep", gain = 0.7}
table.dig = table.dig or
{name = "default_dig_crumbly", gain = 0.4}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
default.node_sound_defaults(table)
@ -131,19 +133,18 @@ default.cool_lava = function(pos, node)
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
if minetest.setting_getbool("enable_lavacooling") ~= false then
minetest.register_abm({
label = "Lava cooling",
nodenames = {"default:lava_source", "default:lava_flowing"},
neighbors = {"group:cools_lava", "group:water"},
interval = 1,
chance = 2,
catch_up = false,
action = function(...)
default.cool_lava(...)
end,
})
end
minetest.register_abm({
label = "Lava cooling",
nodenames = {"default:lava_source", "default:lava_flowing"},
neighbors = {"group:cools_lava", "group:water"},
interval = 1,
chance = 1,
catch_up = false,
action = function(...)
default.cool_lava(...)
end,
})
--
-- optimized helper to put all items in an inventory into a drops list
@ -185,9 +186,6 @@ function default.grow_cactus(pos, node)
if height == 4 or node.name ~= "air" then
return
end
if minetest.get_node_light(pos) < 13 then
return
end
minetest.set_node(pos, {name = "default:cactus"})
return true
end
@ -211,9 +209,6 @@ function default.grow_papyrus(pos, node)
if height == 4 or node.name ~= "air" then
return
end
if minetest.get_node_light(pos) < 13 then
return
end
minetest.set_node(pos, {name = "default:papyrus"})
return true
end
@ -326,65 +321,47 @@ default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
end
end
-- Leafdecay
local function leafdecay_after_destruct(pos, oldnode, def)
for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius),
vector.add(pos, def.radius), def.leaves)) do
local node = minetest.get_node(v)
local timer = minetest.get_node_timer(v)
if node.param2 == 0 and not timer:is_started() then
timer:start(math.random(20, 120) / 10)
-- Leafdecay ABM
minetest.register_abm({
label = "Leaf decay",
nodenames = {"group:leafdecay"},
neighbors = {"air"},
interval = 2,
chance = 10,
catch_up = false,
action = function(pos, node, _, _)
-- Check if leaf is placed
if node.param2 ~= 0 then
return
end
end
end
local function leafdecay_on_timer(pos, def)
if minetest.find_node_near(pos, def.radius, def.trunks) then
return false
end
local node = minetest.get_node(pos)
local drops = minetest.get_node_drops(node.name)
for _, item in ipairs(drops) do
local is_leaf
for _, v in pairs(def.leaves) do
if v == item then
is_leaf = true
local rad = minetest.registered_nodes[node.name].groups.leafdecay
-- Assume ignore is a trunk, to make this
-- work at the border of a loaded area
if minetest.find_node_near(pos, rad, {"ignore", "group:tree"}) then
return
end
-- Drop stuff
local itemstacks = minetest.get_node_drops(node.name)
for _, itemname in ipairs(itemstacks) do
if itemname ~= node.name or
minetest.get_item_group(node.name, "leafdecay_drop") ~= 0 then
local p_drop = {
x = pos.x - 0.5 + math.random(),
y = pos.y - 0.5 + math.random(),
z = pos.z - 0.5 + math.random(),
}
minetest.add_item(p_drop, itemname)
end
end
if minetest.get_item_group(item, "leafdecay_drop") ~= 0 or
not is_leaf then
minetest.add_item({
x = pos.x - 0.5 + math.random(),
y = pos.y - 0.5 + math.random(),
z = pos.z - 0.5 + math.random(),
}, item)
end
-- Remove node
minetest.remove_node(pos)
minetest.check_for_falling(pos)
end
})
minetest.remove_node(pos)
minetest.check_for_falling(pos)
end
function default.register_leafdecay(def)
assert(def.leaves)
assert(def.trunks)
assert(def.radius)
for _, v in pairs(def.trunks) do
minetest.override_item(v, {
after_destruct = function(pos, oldnode)
leafdecay_after_destruct(pos, oldnode, def)
end,
})
end
for _, v in pairs(def.leaves) do
minetest.override_item(v, {
on_timer = function(pos)
leafdecay_on_timer(pos, def)
end,
})
end
end
--
-- Convert dirt to something that fits the environment
@ -535,46 +512,3 @@ minetest.register_abm({
minetest.set_node(pos, {name = "default:coral_skeleton"})
end,
})
--
-- NOTICE: This method is not an official part of the API yet!
-- This method may change in future.
--
function default.can_interact_with_node(player, pos)
if player then
if minetest.check_player_privs(player, "protection_bypass") then
return true
end
else
return false
end
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if not owner or owner == "" or owner == player:get_player_name() then
return true
end
-- is player wielding the right key?
local item = player:get_wielded_item()
if item:get_name() == "default:key" then
local key_meta = item:get_meta()
if key_meta:get_string("secret") == "" then
local key_oldmeta = item:get_metadata()
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
return false
end
key_meta:set_string("secret", minetest.parse_json(key_oldmeta).secret)
item:set_metadata("")
end
return meta:get_string("key_lock_secret") == key_meta:get_string("secret")
end
return false
end

View File

@ -41,9 +41,6 @@ Copyright (C) 2010-2016:
asl97
KevDoy
Mito551
GreenXenith
kaeza
kilbith
You are free to:
Share — copy and redistribute the material in any medium or format.

View File

@ -1,5 +1,5 @@
--
-- Aliases for map generators
-- Aliases for map generator outputs
--
minetest.register_alias("mapgen_stone", "default:stone")
@ -34,21 +34,18 @@ minetest.register_alias("mapgen_pine_needles", "default:pine_needles")
minetest.register_alias("mapgen_cobble", "default:cobble")
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone")
minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick")
minetest.register_alias("mapgen_stair_sandstone_block", "stairs:stair_sandstone_block")
minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebrick")
--
-- Register ores
--
-- Blob ores
-- These first to avoid other ores in blobs
-- Mgv6
function default.register_mgv6_blob_ores()
function default.register_ores()
minetest.clear_registered_ores()
-- Blob ores
-- These first to avoid other ores in blobs
-- Clay
-- This first to avoid clay in sand blobs
@ -77,7 +74,8 @@ function default.register_mgv6_blob_ores()
minetest.register_ore({
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone", "default:desert_stone"},
wherein = {"default:stone", "default:sandstone",
"default:desert_stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
@ -95,104 +93,6 @@ function default.register_mgv6_blob_ores()
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 17676,
octaves = 1,
persist = 0.0
},
})
-- Gravel
minetest.register_ore({
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31000,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
})
end
-- All mapgens except mgv6
function default.register_blob_ores()
-- Clay
minetest.register_ore({
ore_type = "blob",
ore = "default:clay",
wherein = {"default:sand"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -15,
y_max = 0,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = -316,
octaves = 1,
persist = 0.0
},
})
-- Silver sand
minetest.register_ore({
ore_type = "blob",
ore = "default:silver_sand",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31000,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 2316,
octaves = 1,
persist = 0.0
},
biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean",
"taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean",
"grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest",
"coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest",
"deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert",
"cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean",
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground",
"floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"}
})
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "default:dirt",
@ -211,9 +111,7 @@ function default.register_blob_ores()
persist = 0.0
},
biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest",
"deciduous_forest", "deciduous_forest_shore", "savanna", "savanna_shore",
"rainforest", "rainforest_swamp", "floatland_grassland",
"floatland_coniferous_forest"}
"deciduous_forest", "savanna", "rainforest"}
})
-- Gravel
@ -235,22 +133,9 @@ function default.register_blob_ores()
octaves = 1,
persist = 0.0
},
biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean",
"taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean",
"grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest",
"coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest",
"deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert",
"cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean",
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground",
"floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"}
})
end
-- Scatter ores
-- All mapgens
function default.register_ores()
-- Scatter ores
-- Coal
@ -357,41 +242,6 @@ function default.register_ores()
y_max = -64,
})
-- Tin
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_tin",
wherein = "default:stone",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 5,
clust_size = 3,
y_min = 1025,
y_max = 31000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_tin",
wherein = "default:stone",
clust_scarcity = 13 * 13 * 13,
clust_num_ores = 4,
clust_size = 3,
y_min = -127,
y_max = -32,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_tin",
wherein = "default:stone",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -128,
})
-- Gold
minetest.register_ore({
@ -527,9 +377,10 @@ end
-- Register biomes
--
-- All mapgens except mgv6
-- All mapgens except mgv6 and singlenode
function default.register_biomes(upper_limit)
function default.register_biomes()
minetest.clear_registered_biomes()
-- Icesheet
@ -548,7 +399,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:gravel",
depth_riverbed = 2,
y_min = -8,
y_max = upper_limit,
y_max = 31000,
heat_point = 0,
humidity_point = 73,
})
@ -588,7 +439,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:gravel",
depth_riverbed = 2,
y_min = 2,
y_max = upper_limit,
y_max = 31000,
heat_point = 0,
humidity_point = 40,
})
@ -650,7 +501,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 2,
y_max = upper_limit,
y_max = 31000,
heat_point = 25,
humidity_point = 70,
})
@ -692,7 +543,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 5,
y_max = upper_limit,
y_max = 31000,
heat_point = 20,
humidity_point = 35,
})
@ -734,7 +585,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 6,
y_max = upper_limit,
y_max = 31000,
heat_point = 50,
humidity_point = 35,
})
@ -796,7 +647,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 6,
y_max = upper_limit,
y_max = 31000,
heat_point = 45,
humidity_point = 70,
})
@ -858,7 +709,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 1,
y_max = upper_limit,
y_max = 31000,
heat_point = 60,
humidity_point = 68,
})
@ -920,7 +771,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 5,
y_max = upper_limit,
y_max = 31000,
heat_point = 92,
humidity_point = 16,
})
@ -953,7 +804,7 @@ function default.register_biomes(upper_limit)
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 1,
depth_filler = 0,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
@ -962,7 +813,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 5,
y_max = upper_limit,
y_max = 31000,
heat_point = 60,
humidity_point = 0,
})
@ -1004,7 +855,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 5,
y_max = upper_limit,
y_max = 31000,
heat_point = 40,
humidity_point = 0,
})
@ -1046,7 +897,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 1,
y_max = upper_limit,
y_max = 31000,
heat_point = 89,
humidity_point = 42,
})
@ -1096,7 +947,7 @@ function default.register_biomes(upper_limit)
minetest.register_biome({
name = "rainforest",
--node_dust = "",
node_top = "default:dirt_with_rainforest_litter",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
@ -1108,7 +959,7 @@ function default.register_biomes(upper_limit)
node_riverbed = "default:sand",
depth_riverbed = 2,
y_min = 1,
y_max = upper_limit,
y_max = 31000,
heat_point = 86,
humidity_point = 65,
})
@ -1175,100 +1026,6 @@ function default.register_biomes(upper_limit)
end
-- Biomes for floatlands
function default.register_floatland_biomes(floatland_level, shadow_limit)
-- Coniferous forest
minetest.register_biome({
name = "floatland_coniferous_forest",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = floatland_level + 2,
y_max = 31000,
heat_point = 50,
humidity_point = 70,
})
-- Grassland
minetest.register_biome({
name = "floatland_grassland",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 1,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = floatland_level + 2,
y_max = 31000,
heat_point = 50,
humidity_point = 35,
})
-- Sandstone desert
minetest.register_biome({
name = "floatland_sandstone_desert",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 1,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = floatland_level + 2,
y_max = 31000,
heat_point = 50,
humidity_point = 0,
})
-- Floatland ocean / underground
minetest.register_biome({
name = "floatland_ocean",
--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 = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = shadow_limit,
y_max = floatland_level + 1,
heat_point = 50,
humidity_point = 50,
})
end
--
-- Register decorations
--
@ -1276,6 +1033,7 @@ end
-- Mgv6
function default.register_mgv6_decorations()
minetest.clear_registered_decorations()
-- Papyrus
@ -1379,8 +1137,7 @@ local function register_grass_decoration(offset, scale, length)
persist = 0.6
},
biomes = {"grassland", "grassland_dunes", "deciduous_forest",
"coniferous_forest", "coniferous_forest_dunes",
"floatland_grassland", "floatland_coniferous_forest"},
"coniferous_forest", "coniferous_forest_dunes"},
y_min = 1,
y_max = 31000,
decoration = "default:grass_" .. length,
@ -1409,6 +1166,7 @@ end
function default.register_decorations()
minetest.clear_registered_decorations()
-- Apple tree and log
@ -1429,7 +1187,6 @@ function default.register_decorations()
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
@ -1447,7 +1204,20 @@ function default.register_decorations()
biomes = {"deciduous_forest"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/apple_log.mts",
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",
})
@ -1456,8 +1226,8 @@ function default.register_decorations()
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_rainforest_litter", "default:dirt"},
sidelen = 16,
place_on = {"default:dirt_with_grass", "default:dirt"},
sidelen = 80,
fill_ratio = 0.1,
biomes = {"rainforest", "rainforest_swamp"},
y_min = -1,
@ -1469,13 +1239,26 @@ function default.register_decorations()
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_rainforest_litter", "default:dirt"},
sidelen = 16,
place_on = {"default:dirt_with_grass", "default:dirt"},
sidelen = 80,
fill_ratio = 0.005,
biomes = {"rainforest", "rainforest_swamp"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/jungle_log.mts",
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",
})
@ -1494,7 +1277,7 @@ function default.register_decorations()
octaves = 3,
persist = 0.66
},
biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
biomes = {"taiga", "coniferous_forest"},
y_min = 2,
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts",
@ -1516,7 +1299,20 @@ function default.register_decorations()
biomes = {"taiga", "coniferous_forest"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts",
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",
})
@ -1558,7 +1354,17 @@ function default.register_decorations()
biomes = {"savanna"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/acacia_log.mts",
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",
})
@ -1599,7 +1405,20 @@ function default.register_decorations()
biomes = {"deciduous_forest"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/aspen_log.mts",
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",
})
@ -1682,8 +1501,7 @@ function default.register_decorations()
octaves = 3,
persist = 0.7,
},
biomes = {"snowy_grassland", "grassland", "deciduous_forest",
"floatland_grassland"},
biomes = {"snowy_grassland", "grassland", "deciduous_forest"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/bush.mts",
@ -1731,8 +1549,8 @@ function default.register_decorations()
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_rainforest_litter"},
sidelen = 16,
place_on = {"default:dirt_with_grass"},
sidelen = 80,
fill_ratio = 0.1,
biomes = {"rainforest"},
y_min = 1,
@ -1767,9 +1585,9 @@ function default.register_decorations()
deco_type = "schematic",
place_on = {"default:sand"},
noise_params = {
offset = -0.15,
offset = -0.1,
scale = 0.1,
spread = {x = 100, y = 100, z = 100},
spread = {x = 200, y = 200, z = 200},
seed = 7013,
octaves = 3,
persist = 1,
@ -1789,38 +1607,15 @@ end
--
-- Detect mapgen, flags and parameters to select functions
-- Detect mapgen to select functions
--
-- Get setting or default
local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or
"mountains, ridges, nofloatlands"
local captures_float = string.match(mgv7_spflags, "floatlands")
local captures_nofloat = string.match(mgv7_spflags, "nofloatlands")
local mgv7_floatland_level = minetest.get_mapgen_setting("mgv7_floatland_level") or 1280
local mgv7_shadow_limit = minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024
minetest.clear_registered_biomes()
minetest.clear_registered_ores()
minetest.clear_registered_decorations()
local mg_name = minetest.get_mapgen_setting("mg_name")
if mg_name == "v6" then
default.register_mgv6_blob_ores()
default.register_ores()
default.register_mgv6_decorations()
elseif mg_name == "v7" and captures_float == "floatlands" and
captures_nofloat ~= "nofloatlands" then
-- Mgv7 with floatlands
default.register_biomes(mgv7_shadow_limit - 1)
default.register_floatland_biomes(mgv7_floatland_level, mgv7_shadow_limit)
default.register_blob_ores()
default.register_ores()
default.register_decorations()
else
default.register_biomes(31000)
default.register_blob_ores()
default.register_biomes()
default.register_ores()
default.register_decorations()
end

View File

@ -1,88 +0,0 @@
# Blender v2.78 (sub 0) OBJ File: 'chest_open.blend'
# www.blender.org
mtllib chest_open.mtl
o Bottom_Cube.001
v -0.500000 -0.500000 0.500000
v -0.500000 0.187500 0.500000
v -0.500000 -0.500000 -0.500000
v -0.500000 0.187500 -0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 0.187500 0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 0.187500 -0.500000
vt 0.7500 0.3438
vt 0.5000 0.3438
vt 0.5000 0.0000
vt 0.7500 0.0000
vt 0.2500 0.3438
vt 0.2500 0.0000
vt 0.0000 0.3438
vt 0.0000 0.0000
vt 0.7500 0.8438
vt 0.5000 0.8438
vt 0.5000 0.5000
vt 0.7500 0.5000
vt 0.2500 0.5000
vt 0.2500 1.0000
vt 0.0000 1.0000
vt 0.0000 0.5000
vt 0.7500 -0.0000
vt 0.7500 0.5000
vt 1.0000 0.5000
vt 1.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
g Bottom_Cube.001_None
usemtl None
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/2/2 8/5/2 7/6/2 3/3/2
f 8/5/3 6/7/3 5/8/3 7/6/3
f 6/9/4 2/10/4 1/11/4 5/12/4
f 1/13/5 3/14/5 7/15/5 5/16/5
f 6/17/6 8/18/6 4/19/6 2/20/6
o Top_Cube.002
v -0.500000 0.187501 0.499999
v -0.500000 0.408471 0.720970
v -0.500000 0.894607 -0.207108
v -0.500000 1.115578 0.013863
v 0.500000 0.187501 0.499999
v 0.500000 0.408471 0.720970
v 0.500000 0.894607 -0.207108
v 0.500000 1.115578 0.013863
vt 0.7500 0.5000
vt 0.5000 0.5000
vt 0.5000 0.3438
vt 0.7500 0.3438
vt 0.2500 0.5000
vt 0.2500 0.3438
vt 0.0000 0.5000
vt 0.0000 0.3438
vt 0.7500 1.0000
vt 0.5000 1.0000
vt 0.5000 0.8438
vt 0.7500 0.8438
vt 1.0000 0.5000
vt 1.0000 1.0000
vt 0.7500 1.0000
vt 0.7500 0.5000
vt 0.2500 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.7071 -0.7071
vn 1.0000 0.0000 0.0000
vn 0.0000 -0.7071 0.7071
vn 0.0000 -0.7071 -0.7071
vn 0.0000 0.7071 0.7071
g Top_Cube.002_None
usemtl None
s off
f 10/21/7 12/22/7 11/23/7 9/24/7
f 12/22/8 16/25/8 15/26/8 11/23/8
f 16/25/9 14/27/9 13/28/9 15/26/9
f 14/29/10 10/30/10 9/31/10 13/32/10
f 9/33/11 11/34/11 15/35/11 13/36/11
f 14/37/12 16/25/12 12/22/12 10/30/12

View File

@ -1,38 +0,0 @@
# Blender v2.76 (sub 0) OBJ File: 'chest_close.blend'
# www.blender.org
mtllib chest_close.mtl
o Cube_Cube.001
v -0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 0.500000 0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -0.500000
vt 0.750000 0.500000
vt 0.500000 0.500000
vt 0.500000 -0.000000
vt 0.750000 0.000000
vt 0.250000 0.500000
vt 0.250000 0.000000
vt 0.000000 0.500000
vt -0.000000 0.000000
vt 0.750000 1.000000
vt 0.500000 1.000000
vt 0.250000 1.000000
vt -0.000000 1.000000
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
usemtl None
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/2/2 8/5/2 7/6/2 3/3/2
f 8/5/3 6/7/3 5/8/3 7/6/3
f 6/9/4 2/10/4 1/2/4 5/1/4
f 1/5/5 3/11/5 7/12/5 5/7/5
f 6/11/6 8/5/6 4/2/6 2/10/6

View File

@ -30,12 +30,6 @@ default:desert_stone_block
default:sandstone
default:sandstonebrick
default:sandstone_block
default:desert_sandstone
default:desert_sandstone_brick
default:desert_sandstone_block
default:silver_sandstone
default:silver_sandstone_brick
default:silver_sandstone_block
default:obsidian
default:obsidianbrick
@ -50,7 +44,6 @@ default:dirt_with_grass
default:dirt_with_grass_footsteps
default:dirt_with_dry_grass
default:dirt_with_snow
default:dirt_with_rainforest_litter
default:sand
default:desert_sand
@ -107,10 +100,6 @@ default:steelblock
default:stone_with_copper
default:copperblock
default:stone_with_tin
default:tinblock
default:bronzeblock
default:stone_with_gold
@ -144,10 +133,8 @@ default:dry_grass_5
default:bush_stem
default:bush_leaves
default:bush_sapling
default:acacia_bush_stem
default:acacia_bush_leaves
default:acacia_bush_sapling
Corals
------
@ -195,7 +182,6 @@ default:obsidian_glass
default:brick
default:meselamp
default:mese_post_light
Misc
----
@ -287,6 +273,7 @@ minetest.register_node("default:desert_stone_block", {
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:sandstone", {
description = "Sandstone",
tiles = {"default_sandstone.png"},
@ -312,55 +299,6 @@ minetest.register_node("default:sandstone_block", {
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:desert_sandstone", {
description = "Desert Sandstone",
tiles = {"default_desert_sandstone.png"},
groups = {crumbly = 1, cracky = 3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:desert_sandstone_brick", {
description = "Desert Sandstone Brick",
paramtype2 = "facedir",
place_param2 = 0,
tiles = {"default_desert_sandstone_brick.png"},
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:desert_sandstone_block", {
description = "Desert Sandstone Block",
tiles = {"default_desert_sandstone_block.png"},
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:silver_sandstone", {
description = "Silver Sandstone",
tiles = {"default_silver_sandstone.png"},
groups = {crumbly = 1, cracky = 3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:silver_sandstone_brick", {
description = "Silver Sandstone Brick",
paramtype2 = "facedir",
place_param2 = 0,
tiles = {"default_silver_sandstone_brick.png"},
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:silver_sandstone_block", {
description = "Silver Sandstone Block",
tiles = {"default_silver_sandstone_block.png"},
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:obsidian", {
description = "Obsidian",
@ -440,28 +378,13 @@ minetest.register_node("default:dirt_with_snow", {
tiles = {"default_snow.png", "default_dirt.png",
{name = "default_dirt.png^default_snow_side.png",
tileable_vertical = false}},
groups = {crumbly = 3, spreading_dirt_type = 1, snowy = 1},
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.15},
}),
})
minetest.register_node("default:dirt_with_rainforest_litter", {
description = "Dirt with Rainforest Litter",
tiles = {
"default_rainforest_litter.png",
"default_dirt.png",
{name = "default_dirt.png^default_rainforest_litter_side.png",
tileable_vertical = false}
},
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1},
drop = "default:dirt",
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_grass_footstep", gain = 0.4},
}),
})
minetest.register_node("default:sand", {
description = "Sand",
tiles = {"default_sand.png"},
@ -522,7 +445,7 @@ minetest.register_node("default:snow", {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
},
},
groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 1},
groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1},
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.15},
dug = {name = "default_snow_footstep", gain = 0.2},
@ -540,7 +463,7 @@ minetest.register_node("default:snow", {
minetest.register_node("default:snowblock", {
description = "Snow Block",
tiles = {"default_snow.png"},
groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1},
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.15},
dug = {name = "default_snow_footstep", gain = 0.2},
@ -592,6 +515,7 @@ minetest.register_node("default:wood", {
minetest.register_node("default:sapling", {
description = "Sapling",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_sapling.png"},
inventory_image = "default_sapling.png",
wield_image = "default_sapling.png",
@ -657,6 +581,7 @@ minetest.register_node("default:leaves", {
minetest.register_node("default:apple", {
description = "Apple",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_apple.png"},
inventory_image = "default_apple.png",
paramtype = "light",
@ -726,6 +651,7 @@ minetest.register_node("default:jungleleaves", {
minetest.register_node("default:junglesapling", {
description = "Jungle Sapling",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_junglesapling.png"},
inventory_image = "default_junglesapling.png",
wield_image = "default_junglesapling.png",
@ -805,6 +731,7 @@ minetest.register_node("default:pine_needles",{
minetest.register_node("default:pine_sapling", {
description = "Pine Sapling",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_pine_sapling.png"},
inventory_image = "default_pine_sapling.png",
wield_image = "default_pine_sapling.png",
@ -885,6 +812,7 @@ minetest.register_node("default:acacia_leaves", {
minetest.register_node("default:acacia_sapling", {
description = "Acacia Tree Sapling",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_acacia_sapling.png"},
inventory_image = "default_acacia_sapling.png",
wield_image = "default_acacia_sapling.png",
@ -963,6 +891,7 @@ minetest.register_node("default:aspen_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",
@ -1050,24 +979,6 @@ minetest.register_node("default:copperblock", {
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node("default:stone_with_tin", {
description = "Tin Ore",
tiles = {"default_stone.png^default_mineral_tin.png"},
groups = {cracky = 2},
drop = "default:tin_lump",
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:tinblock", {
description = "Tin Block",
tiles = {"default_tin_block.png"},
is_ground_content = false,
groups = {cracky = 1, level = 2},
sounds = default.node_sound_metal_defaults(),
})
minetest.register_node("default:bronzeblock", {
description = "Bronze Block",
tiles = {"default_bronze_block.png"},
@ -1167,6 +1078,7 @@ minetest.register_node("default:dry_shrub", {
description = "Dry Shrub",
drawtype = "plantlike",
waving = 1,
visual_scale = 1.0,
tiles = {"default_dry_shrub.png"},
inventory_image = "default_dry_shrub.png",
wield_image = "default_dry_shrub.png",
@ -1186,7 +1098,7 @@ minetest.register_node("default:junglegrass", {
description = "Jungle Grass",
drawtype = "plantlike",
waving = 1,
visual_scale = 1.69,
visual_scale = 1.3,
tiles = {"default_junglegrass.png"},
inventory_image = "default_junglegrass.png",
wield_image = "default_junglegrass.png",
@ -1194,7 +1106,7 @@ minetest.register_node("default:junglegrass", {
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1},
groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
@ -1310,7 +1222,7 @@ end
minetest.register_node("default:bush_stem", {
description = "Bush Stem",
drawtype = "plantlike",
visual_scale = 1.41,
visual_scale = 1.18,
tiles = {"default_bush_stem.png"},
inventory_image = "default_bush_stem.png",
wield_image = "default_bush_stem.png",
@ -1331,57 +1243,13 @@ minetest.register_node("default:bush_leaves", {
tiles = {"default_leaves_simple.png"},
paramtype = "light",
groups = {snappy = 3, flammable = 2, leaves = 1},
drop = {
max_items = 1,
items = {
{items = {"default:bush_sapling"}, rarity = 5},
{items = {"default:bush_leaves"}}
}
},
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
minetest.register_node("default:bush_sapling", {
description = "Bush Sapling",
drawtype = "plantlike",
tiles = {"default_bush_sapling.png"},
inventory_image = "default_bush_sapling.png",
wield_image = "default_bush_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
on_timer = default.grow_sapling,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(1200, 2400))
end,
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"default:bush_sapling",
-- minp, maxp to be checked, relative to sapling pos
{x = -1, y = 0, z = -1},
{x = 1, y = 1, z = 1},
-- maximum interval of interior volume check
2)
return itemstack
end,
})
minetest.register_node("default:acacia_bush_stem", {
description = "Acacia Bush Stem",
drawtype = "plantlike",
visual_scale = 1.41,
visual_scale = 1.18,
tiles = {"default_acacia_bush_stem.png"},
inventory_image = "default_acacia_bush_stem.png",
wield_image = "default_acacia_bush_stem.png",
@ -1402,51 +1270,7 @@ minetest.register_node("default:acacia_bush_leaves", {
tiles = {"default_acacia_leaves_simple.png"},
paramtype = "light",
groups = {snappy = 3, flammable = 2, leaves = 1},
drop = {
max_items = 1,
items = {
{items = {"default:acacia_bush_sapling"}, rarity = 5},
{items = {"default:acacia_bush_leaves"}}
}
},
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
minetest.register_node("default:acacia_bush_sapling", {
description = "Acacia Bush Sapling",
drawtype = "plantlike",
tiles = {"default_acacia_bush_sapling.png"},
inventory_image = "default_acacia_bush_sapling.png",
wield_image = "default_acacia_bush_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
on_timer = default.grow_sapling,
selection_box = {
type = "fixed",
fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(1200, 2400))
end,
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"default:acacia_bush_sapling",
-- minp, maxp to be checked, relative to sapling pos
{x = -1, y = 0, z = -1},
{x = 1, y = 1, z = 1},
-- maximum interval of interior volume check
2)
return itemstack
end,
})
@ -1766,281 +1590,216 @@ minetest.register_node("default:lava_flowing", {
-- Tools / "Advanced" crafting / Non-"natural"
--
local function get_chest_formspec(pos)
local chest_formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
local function get_locked_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[nodemeta:" .. spos .. ";default:chest;0,0.3;8,4;]" ..
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:" .. spos .. ";default:chest]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
return formspec
return formspec
end
local function chest_lid_obstructed(pos)
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
local def = minetest.registered_nodes[minetest.get_node(above).name]
-- allow ladders, signs, wallmounted things and torches to not obstruct
if def.drawtype == "airlike" or
def.drawtype == "signlike" or
def.drawtype == "torchlike" or
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
return false
end
return true
end
local open_chests = {}
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "default:chest" then
return
end
if not player or not fields.quit then
return
end
local pn = player:get_player_name()
if not open_chests[pn] then
return
end
local pos = open_chests[pn].pos
local sound = open_chests[pn].sound
local swap = open_chests[pn].swap
local node = minetest.get_node(pos)
open_chests[pn] = nil
for k, v in pairs(open_chests) do
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
local function has_locked_chest_privilege(meta, player)
if player then
if minetest.check_player_privs(player, "protection_bypass") then
return true
end
end
minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
param2 = node.param2 })
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
return true
end)
function default.register_chest(name, d)
local def = table.copy(d)
def.drawtype = "mesh"
def.visual = "mesh"
def.paramtype = "light"
def.paramtype2 = "facedir"
def.legacy_facedir_simple = true
def.is_ground_content = false
if def.protected then
def.on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Locked Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("default:chest", 8*4)
end
def.after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Locked Chest (owned by " ..
meta:get_string("owner") .. ")")
end
def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("default:chest") and
default.can_interact_with_node(player, pos)
end
def.allow_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
if not default.can_interact_with_node(player, pos) then
return 0
end
return count
end
def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if not default.can_interact_with_node(player, pos) then
return 0
end
return stack:get_count()
end
def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if not default.can_interact_with_node(player, pos) then
return 0
end
return stack:get_count()
end
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if not default.can_interact_with_node(clicker, pos) then
return itemstack
end
minetest.sound_play(def.sound_open, {gain = 0.3,
pos = pos, max_hear_distance = 10})
if not chest_lid_obstructed(pos) then
minetest.swap_node(pos,
{ name = "default:" .. name .. "_open",
param2 = node.param2 })
end
minetest.after(0.2, minetest.show_formspec,
clicker:get_player_name(),
"default:chest", get_chest_formspec(pos))
open_chests[clicker:get_player_name()] = { pos = pos,
sound = def.sound_close, swap = name }
end
def.on_blast = function() end
def.on_key_use = function(pos, player)
local secret = minetest.get_meta(pos):get_string("key_lock_secret")
local itemstack = player:get_wielded_item()
local key_meta = itemstack:get_meta()
if key_meta:get_string("secret") == "" then
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
itemstack:set_metadata("")
end
if secret ~= key_meta:get_string("secret") then
return
end
minetest.show_formspec(
player:get_player_name(),
"default:chest_locked",
get_chest_formspec(pos)
)
end
def.on_skeleton_key_use = function(pos, player, newsecret)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local pn = player:get_player_name()
-- verify placer is owner of lockable chest
if owner ~= pn then
minetest.record_protection_violation(pos, pn)
minetest.chat_send_player(pn, "You do not own this chest.")
return nil
end
local secret = meta:get_string("key_lock_secret")
if secret == "" then
secret = newsecret
meta:set_string("key_lock_secret", secret)
end
return secret, "a locked chest", owner
end
else
def.on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Chest")
local inv = meta:get_inventory()
inv:set_size("default:chest", 8*4)
end
def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("default:chest")
end
def.on_rightclick = function(pos, node, clicker)
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
max_hear_distance = 10})
if not chest_lid_obstructed(pos) then
minetest.swap_node(pos, {
name = "default:" .. name .. "_open",
param2 = node.param2 })
end
minetest.after(0.2, minetest.show_formspec,
clicker:get_player_name(),
"default:chest", get_chest_formspec(pos))
open_chests[clicker:get_player_name()] = { pos = pos,
sound = def.sound_close, swap = name }
end
return false
end
def.on_metadata_inventory_move = function(pos, from_list, from_index,
-- is player wielding the right key?
local item = player:get_wielded_item()
if item:get_name() == "default:key" then
local key_meta = minetest.parse_json(item:get_metadata())
local secret = meta:get_string("key_lock_secret")
if secret ~= key_meta.secret then
return false
end
return true
end
if player:get_player_name() ~= meta:get_string("owner") then
return false
end
return true
end
minetest.register_node("default:chest", {
description = "Chest",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
paramtype2 = "facedir",
groups = {choppy = 2, oddly_breakable_by_hand = 2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", chest_formspec)
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
minetest.log("action", player:get_player_name() ..
" moves stuff in chest at " .. minetest.pos_to_string(pos))
end
def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" moves " .. stack:get_name() ..
" to chest at " .. minetest.pos_to_string(pos))
end
def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" takes " .. stack:get_name() ..
" from chest at " .. minetest.pos_to_string(pos))
end
def.on_blast = function(pos)
end,
on_blast = function(pos)
local drops = {}
default.get_inventory_drops(pos, "main", drops)
drops[#drops+1] = "default:chest"
minetest.remove_node(pos)
return drops
end
local def_opened = table.copy(def)
local def_closed = table.copy(def)
def_opened.mesh = "chest_open.obj"
def_opened.drop = "default:" .. name
def_opened.groups.not_in_creative_inventory = 1
def_opened.selection_box = {
type = "fixed",
fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
}
def_opened.can_dig = function()
return false
end
def_closed.mesh = "cube.obj"
minetest.register_node("default:" .. name, def_closed)
minetest.register_node("default:" .. name .. "_open", def_opened)
-- convert old chests to this new variant
minetest.register_lbm({
label = "update chests to opening chests",
name = "default:upgrade_" .. name,
nodenames = {"default:" .. name},
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", nil)
local inv = meta:get_inventory()
local list = inv:get_list("main")
inv:set_list("main", nil)
inv:set_size("default:chest", 8*4)
inv:set_list("default:chest", list)
end
})
end
default.register_chest("chest", {
description = "Chest",
tiles = { "default_chest_wood.png" },
sounds = default.node_sound_wood_defaults(),
sound_open = "default_chest_open",
sound_close = "default_chest_close",
groups = {choppy = 2, oddly_breakable_by_hand = 2},
end,
})
default.register_chest("chest_locked", {
minetest.register_node("default:chest_locked", {
description = "Locked Chest",
tiles = { "default_chest_wood_locked.png" },
sounds = default.node_sound_wood_defaults(),
sound_open = "default_chest_open",
sound_close = "default_chest_close",
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
paramtype2 = "facedir",
groups = {choppy = 2, oddly_breakable_by_hand = 2},
protected = true,
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Locked Chest (owned by " ..
meta:get_string("owner") .. ")")
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8 * 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
end,
allow_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
return 0
end
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
return 0
end
return stack:get_count()
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" moves " .. stack:get_name() ..
" to locked chest at " .. minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" takes " .. stack:get_name() ..
" from locked chest at " .. minetest.pos_to_string(pos))
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
if has_locked_chest_privilege(meta, clicker) then
minetest.show_formspec(
clicker:get_player_name(),
"default:chest_locked",
get_locked_chest_formspec(pos)
)
end
return itemstack
end,
on_blast = function() end,
on_key_use = function(pos, player)
local secret = minetest.get_meta(pos):get_string("key_lock_secret")
local itemstack = player:get_wielded_item()
local key_meta = minetest.parse_json(itemstack:get_metadata())
if secret ~= key_meta.secret then
return
end
minetest.show_formspec(
player:get_player_name(),
"default:chest_locked",
get_locked_chest_formspec(pos)
)
end,
on_skeleton_key_use = function(pos, player, newsecret)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local name = player:get_player_name()
-- verify placer is owner of lockable chest
if owner ~= name then
minetest.record_protection_violation(pos, name)
minetest.chat_send_player(name, "You do not own this chest.")
return nil
end
local secret = meta:get_string("key_lock_secret")
if secret == "" then
secret = newsecret
meta:set_string("key_lock_secret", secret)
end
return secret, "a locked chest", owner
end,
})
local bookshelf_formspec =
"size[8,7;]" ..
default.gui_bg ..
@ -2278,7 +2037,6 @@ minetest.register_node("default:glass", {
drawtype = "glasslike_framed_optional",
tiles = {"default_glass.png", "default_glass_detail.png"},
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 3},
@ -2290,7 +2048,6 @@ minetest.register_node("default:obsidian_glass", {
drawtype = "glasslike_framed_optional",
tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
is_ground_content = false,
sunlight_propagates = true,
sounds = default.node_sound_glass_defaults(),
@ -2321,27 +2078,6 @@ minetest.register_node("default:meselamp", {
light_source = default.LIGHT_MAX,
})
minetest.register_node("default:mese_post_light", {
description = "Mese Post Light",
tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png",
"default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png",
"default_mese_post_light_side.png", "default_mese_post_light_side.png"},
wield_image = "default_mese_post_light_side.png",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16},
},
},
paramtype = "light",
light_source = default.LIGHT_MAX,
sunlight_propagates = true,
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--
-- Misc
--
@ -2353,69 +2089,3 @@ minetest.register_node("default:cloud", {
sounds = default.node_sound_defaults(),
groups = {not_in_creative_inventory = 1},
})
--
-- register trees for leafdecay
--
if minetest.get_mapgen_setting("mg_name") == "v6" then
default.register_leafdecay({
trunks = {"default:tree"},
leaves = {"default:apple", "default:leaves"},
radius = 2,
})
default.register_leafdecay({
trunks = {"default:jungletree"},
leaves = {"default:jungleleaves"},
radius = 3,
})
default.register_leafdecay({
trunks = {"default:pine_tree"},
leaves = {"default:pine_needles"},
radius = 3,
})
else
default.register_leafdecay({
trunks = {"default:tree"},
leaves = {"default:apple", "default:leaves"},
radius = 3,
})
default.register_leafdecay({
trunks = {"default:jungletree"},
leaves = {"default:jungleleaves"},
radius = 2,
})
default.register_leafdecay({
trunks = {"default:pine_tree"},
leaves = {"default:pine_needles"},
radius = 2,
})
end
default.register_leafdecay({
trunks = {"default:acacia_tree"},
leaves = {"default:acacia_leaves"},
radius = 2,
})
default.register_leafdecay({
trunks = {"default:aspen_tree"},
leaves = {"default:aspen_leaves"},
radius = 3,
})
default.register_leafdecay({
trunks = {"default:bush_stem"},
leaves = {"default:bush_leaves"},
radius = 1,
})
default.register_leafdecay({
trunks = {"default:acacia_bush_stem"},
leaves = {"default:acacia_bush_leaves"},
radius = 1,
})

View File

@ -96,8 +96,7 @@ minetest.register_on_joinplayer(function(player)
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player:get_player_name())) then
if not minetest.setting_getbool("creative_mode") then
player:set_inventory_formspec(default.gui_survival_form)
end
player:hud_set_hotbar_image("gui_hotbar.png")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 B

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

View File

@ -379,26 +379,59 @@ minetest.register_tool("default:sword_diamond", {
sound = {breaks = "default_tool_breaks"},
})
minetest.register_tool("default:skeleton_key", {
description = "Skeleton Key",
inventory_image = "default_key_skeleton.png",
groups = {key = 1},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if not node then
return itemstack
end
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
if on_skeleton_key_use then
-- make a new key secret in case the node callback needs it
local random = math.random
local newsecret = string.format(
"%04x%04x%04x%04x",
random(2^16) - 1, random(2^16) - 1,
random(2^16) - 1, random(2^16) - 1)
local secret, _, _ = on_skeleton_key_use(pos, placer, newsecret)
if secret then
-- finish and return the new key
itemstack:take_item()
itemstack:add_item("default:key")
itemstack:set_metadata(minetest.write_json({
secret = secret
}))
return itemstack
end
end
return nil
end
})
minetest.register_tool("default:key", {
description = "Key",
inventory_image = "default_key.png",
groups = {key = 1, not_in_creative_inventory = 1},
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local def = minetest.registered_nodes[node.name]
if def and def.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return def.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
local pos = pointed_thing.under
node = minetest.get_node(pos)
local node = minetest.get_node(pos)
if not node or node.name == "ignore" then
return itemstack

View File

@ -50,7 +50,7 @@ minetest.register_node("default:torch", {
sunlight_propagates = true,
walkable = false,
liquids_pointable = false,
light_source = 12,
light_source = 13,
groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1},
drop = "default:torch",
selection_box = {
@ -97,7 +97,7 @@ minetest.register_node("default:torch_wall", {
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
light_source = 12,
light_source = 13,
groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
drop = "default:torch",
selection_box = {
@ -118,7 +118,7 @@ minetest.register_node("default:torch_ceiling", {
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
light_source = 12,
light_source = 13,
groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
drop = "default:torch",
selection_box = {
@ -144,3 +144,4 @@ minetest.register_lbm({
end
end
})

View File

@ -27,7 +27,8 @@ end
-- 'is snow nearby' function
local function is_snow_nearby(pos)
return minetest.find_node_near(pos, 1, {"group:snowy"})
return minetest.find_node_near(pos, 1,
{"default:snow", "default:snowblock", "default:dirt_with_snow"})
end
@ -77,14 +78,6 @@ function default.grow_sapling(pos)
minetest.log("action", "An aspen sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_aspen_tree(pos)
elseif node.name == "default:bush_sapling" then
minetest.log("action", "A bush sapling grows into a bush at "..
minetest.pos_to_string(pos))
default.grow_bush(pos)
elseif node.name == "default:acacia_bush_sapling" then
minetest.log("action", "An acacia bush sapling grows into a bush at "..
minetest.pos_to_string(pos))
default.grow_acacia_bush(pos)
end
end
@ -380,7 +373,7 @@ function default.grow_new_apple_tree(pos)
local path = minetest.get_modpath("default") ..
"/schematics/apple_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, "random", nil, false)
path, "0", nil, false)
end
@ -434,29 +427,6 @@ function default.grow_new_aspen_tree(pos)
end
-- Bushes do not need 'from sapling' schematic variants because
-- only the stem node is force-placed in the schematic.
-- Bush
function default.grow_bush(pos)
local path = minetest.get_modpath("default") ..
"/schematics/bush.mts"
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
path, "0", nil, false)
end
-- Acacia bush
function default.grow_acacia_bush(pos)
local path = minetest.get_modpath("default") ..
"/schematics/acacia_bush.mts"
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
path, "0", nil, false)
end
--
-- Sapling 'on place' function to check protection of node and resulting tree volume
--
@ -488,47 +458,19 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
return itemstack
end
-- Check tree volume for protection
if default.intersects_protection(
if not default.intersects_protection(
vector.add(pos, minp_relative),
vector.add(pos, maxp_relative),
player_name,
interval) then
minetest.set_node(pos, {name = sapling_name})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
else
minetest.record_protection_violation(pos, player_name)
-- Print extra information to explain
minetest.chat_send_player(player_name, "Tree will intersect protection")
return itemstack
end
minetest.log("action", player_name .. " places node "
.. sapling_name .. " at " .. minetest.pos_to_string(pos))
local take_item = not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name))
local newnode = {name = sapling_name}
local ndef = minetest.registered_nodes[sapling_name]
minetest.set_node(pos, newnode)
-- Run callback
if ndef and ndef.after_place_node then
-- Deepcopy place_to and pointed_thing because callback can modify it
if ndef.after_place_node(table.copy(pos), placer,
itemstack, table.copy(pointed_thing)) then
take_item = false
end
end
-- Run script hook
for _, callback in ipairs(minetest.registered_on_placenodes) do
-- Deepcopy pos, node and pointed_thing because callback can modify them
if callback(table.copy(pos), table.copy(newnode),
placer, table.copy(node or {}),
itemstack, table.copy(pointed_thing)) then
take_item = false
end
end
if take_item then
itemstack:take_item()
end
return itemstack

View File

@ -6,15 +6,6 @@ local _doors = {}
_doors.registered_doors = {}
_doors.registered_trapdoors = {}
local function replace_old_owner_information(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner")
if owner and owner ~= "" then
meta:set_string("owner", owner)
meta:set_string("doors_owner", "")
end
end
-- returns an object to a door object or nil
function doors.get(pos)
local node_name = minetest.get_node(pos).name
@ -91,7 +82,7 @@ minetest.register_node("doors:hidden", {
on_blast = function() end,
tiles = {"doors_blank.png"},
-- 1px transparent block inside door hinge near node top.
node_box = {
nodebox = {
type = "fixed",
fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32},
},
@ -148,10 +139,22 @@ function _doors.door_toggle(pos, node, clicker)
state = tonumber(state)
end
replace_old_owner_information(pos)
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
-- is player wielding the right key?
local item = clicker:get_wielded_item()
local owner = meta:get_string("doors_owner")
if item:get_name() == "default:key" then
local key_meta = minetest.parse_json(item:get_metadata())
local secret = meta:get_string("key_lock_secret")
if secret ~= key_meta.secret then
return false
end
if clicker and not default.can_interact_with_node(clicker, pos) then
return false
elseif owner ~= "" then
if clicker:get_player_name() ~= owner then
return false
end
end
end
-- until Lua-5.2 we have no bitwise operators :(
@ -202,13 +205,11 @@ local function on_place_node(place_to, newnode,
end
local function can_dig_door(pos, digger)
replace_old_owner_information(pos)
if default.can_interact_with_node(digger, pos) then
local digger_name = digger and digger:get_player_name()
if digger_name and minetest.get_player_privs(digger_name).protection_bypass then
return true
else
minetest.record_protection_violation(pos, digger:get_player_name())
return false
end
return minetest.get_meta(pos):get_string("doors_owner") == digger_name
end
function doors.register(name, def)
@ -254,7 +255,6 @@ function doors.register(name, def)
minetest.register_craftitem(":" .. name, {
description = def.description,
inventory_image = def.inventory_image,
groups = table.copy(def.groups),
on_place = function(itemstack, placer, pointed_thing)
local pos
@ -265,8 +265,7 @@ function doors.register(name, def)
local node = minetest.get_node(pointed_thing.under)
local pdef = minetest.registered_nodes[node.name]
if pdef and pdef.on_rightclick and
not placer:get_player_control().sneak then
if pdef and pdef.on_rightclick then
return pdef.on_rightclick(pointed_thing.under,
node, placer, itemstack, pointed_thing)
end
@ -324,16 +323,14 @@ function doors.register(name, def)
meta:set_int("state", state)
if def.protected then
meta:set_string("owner", pn)
meta:set_string("doors_owner", pn)
meta:set_string("infotext", "Owned by " .. pn)
end
if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
minetest.sound_play(def.sounds.place, {pos = pos})
on_place_node(pos, minetest.get_node(pos),
placer, node, itemstack, pointed_thing)
@ -378,9 +375,7 @@ function doors.register(name, def)
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z})
end
def.on_rotate = function(pos, node, user, mode, new_param2)
return false
end
def.on_rotate = false
if def.protected then
def.can_dig = can_dig_door
@ -390,9 +385,8 @@ function doors.register(name, def)
door:toggle(player)
end
def.on_skeleton_key_use = function(pos, player, newsecret)
replace_old_owner_information(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local owner = meta:get_string("doors_owner")
local pname = player:get_player_name()
-- verify placer is owner of lockable door
@ -529,11 +523,23 @@ end
function _doors.trapdoor_toggle(pos, node, clicker)
node = node or minetest.get_node(pos)
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
-- is player wielding the right key?
local item = clicker:get_wielded_item()
local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner")
if item:get_name() == "default:key" then
local key_meta = minetest.parse_json(item:get_metadata())
local secret = meta:get_string("key_lock_secret")
if secret ~= key_meta.secret then
return false
end
replace_old_owner_information(pos)
if clicker and not default.can_interact_with_node(clicker, pos) then
return false
elseif owner ~= "" then
if clicker:get_player_name() ~= owner then
return false
end
end
end
local def = minetest.registered_nodes[node.name]
@ -575,10 +581,10 @@ function doors.register_trapdoor(name, def)
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("owner", pn)
meta:set_string("doors_owner", pn)
meta:set_string("infotext", "Owned by "..pn)
return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
return minetest.setting_getbool("creative_mode")
end
def.on_blast = function() end
@ -587,9 +593,8 @@ function doors.register_trapdoor(name, def)
door:toggle(player)
end
def.on_skeleton_key_use = function(pos, player, newsecret)
replace_old_owner_information(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local owner = meta:get_string("doors_owner")
local pname = player:get_player_name()
-- verify placer is owner of lockable door

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -74,39 +74,36 @@ minetest.register_craft({
})
-- Mix recipes
local dye_recipes = {
-- src1, src2, dst
-- RYB mixes
{"red", "blue", "violet"}, -- "purple"
{"yellow", "red", "orange"},
{"yellow", "blue", "green"},
-- RYB complementary mixes
{"yellow", "violet", "dark_grey"},
{"blue", "orange", "dark_grey"},
-- CMY mixes - approximation
{"cyan", "yellow", "green"},
{"cyan", "magenta", "blue"},
{"yellow", "magenta", "red"},
-- other mixes that result in a color we have
{"red", "green", "brown"},
{"magenta", "blue", "violet"},
{"green", "blue", "cyan"},
{"pink", "violet", "magenta"},
-- mixes with black
{"white", "black", "grey"},
{"grey", "black", "dark_grey"},
{"green", "black", "dark_green"},
{"orange", "black", "brown"},
-- mixes with white
{"white", "red", "pink"},
{"white", "dark_grey", "grey"},
{"white", "dark_green", "green"},
-- Just mix everything to everything somehow sanely
local mixbases = {"pink", "magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white"}
local mixes = {
-- pink, magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white
white = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","grey", "grey", "grey","white"},
grey = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","dark_grey","grey", "grey"},
dark_grey = {"brown", "brown", "brown", "brown", "brown", "brown", "dark_green","dark_green","blue", "blue", "violet","black", "dark_grey"},
black = {"black", "black", "black", "black", "black", "black", "black", "black", "black","black", "black", "black"},
violet = {"magenta","magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"},
blue = {"violet", "violet", "magenta","brown", "brown", "dark_green","cyan", "cyan", "cyan", "blue"},
cyan = {"brown", "blue", "brown", "dark_green","dark_grey", "green", "cyan", "dark_green","cyan"},
dark_green = {"brown", "brown", "brown", "brown", "brown", "green", "green", "dark_green"},
green = {"yellow", "brown", "yellow", "yellow", "dark_green","green", "green"},
yellow = {"orange", "red", "orange", "yellow", "orange", "yellow"},
brown = {"brown", "brown", "brown", "orange", "brown"},
orange = {"orange", "red", "orange", "orange"},
red = {"pink", "magenta","red"},
magenta = {"magenta","magenta"},
pink = {"pink"},
}
for _, mix in pairs(dye_recipes) do
minetest.register_craft({
type = "shapeless",
output = 'dye:' .. mix[3] .. ' 2',
recipe = {'dye:' .. mix[1], 'dye:' .. mix[2]},
})
for one, results in pairs(mixes) do
for i, result in ipairs(results) do
local another = mixbases[i]
minetest.register_craft({
type = "shapeless",
output = 'dye:' .. result .. ' 2',
recipe = {'dye:' .. one, 'dye:' .. another},
})
end
end

View File

@ -57,8 +57,7 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
gain = 0.5,
})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(user:get_player_name())) then
if not minetest.setting_getbool("creative_mode") then
-- wear tool
local wdef = itemstack:get_definition()
itemstack:add_wear(65535/(uses-1))
@ -188,8 +187,7 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = 1})
tick(pt.above)
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
@ -315,15 +313,6 @@ farming.register_plant = function(name, def)
}),
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname)
end,
next_plant = mname .. ":" .. pname .. "_1",
@ -341,16 +330,12 @@ farming.register_plant = function(name, def)
-- Register growing steps
for i = 1, def.steps do
local base_rarity = 1
if def.steps ~= 1 then
base_rarity = 8 - (i - 1) * 7 / (def.steps - 1)
end
local drop = {
items = {
{items = {mname .. ":" .. pname}, rarity = base_rarity},
{items = {mname .. ":" .. pname}, rarity = base_rarity * 2},
{items = {mname .. ":seed_" .. pname}, rarity = base_rarity},
{items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2},
{items = {mname .. ":" .. pname}, rarity = 9 - i},
{items = {mname .. ":" .. pname}, rarity= 18 - i * 2},
{items = {mname .. ":seed_" .. pname}, rarity = 9 - i},
{items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2},
}
}
local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}

View File

@ -22,14 +22,6 @@ minetest.override_item("default:dirt_with_dry_grass", {
}
})
minetest.override_item("default:dirt_with_rainforest_litter", {
soil = {
base = "default:dirt_with_rainforest_litter",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil", {
description = "Soil",
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},

View File

@ -24,7 +24,7 @@ minetest.register_node("fire:basic_flame", {
},
inventory_image = "fire_basic_flame.png",
paramtype = "light",
light_source = 13,
light_source = 14,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
@ -44,6 +44,9 @@ minetest.register_node("fire:basic_flame", {
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(30, 60))
end,
on_blast = function() -- Unaffected by explosions
end,
})
minetest.register_node("fire:permanent_flame", {
@ -62,13 +65,16 @@ minetest.register_node("fire:permanent_flame", {
},
inventory_image = "fire_basic_flame.png",
paramtype = "light",
light_source = 13,
light_source = 14,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3},
drop = "",
on_blast = function() -- Unaffected by explosions
end,
})
@ -80,37 +86,36 @@ minetest.register_tool("fire:flint_and_steel", {
sound = {breaks = "default_tool_breaks"},
on_use = function(itemstack, user, pointed_thing)
local sound_pos = pointed_thing.above or user:get_pos()
local pt = pointed_thing
minetest.sound_play(
"fire_flint_and_steel",
{pos = sound_pos, gain = 0.5, max_hear_distance = 8}
{pos = pt.above, gain = 0.5, max_hear_distance = 8}
)
local player_name = user:get_player_name()
if pointed_thing.type == "node" then
local node_under = minetest.get_node(pointed_thing.under).name
if pt.type == "node" then
local node_under = minetest.get_node(pt.under).name
local nodedef = minetest.registered_nodes[node_under]
if not nodedef then
return
end
if minetest.is_protected(pointed_thing.under, player_name) then
local player_name = user:get_player_name()
if minetest.is_protected(pt.under, player_name) then
minetest.chat_send_player(player_name, "This area is protected")
return
end
if nodedef.on_ignite then
nodedef.on_ignite(pointed_thing.under, user)
nodedef.on_ignite(pt.under, user)
elseif minetest.get_item_group(node_under, "flammable") >= 1
and minetest.get_node(pointed_thing.above).name == "air" then
minetest.set_node(pointed_thing.above, {name = "fire:basic_flame"})
and minetest.get_node(pt.above).name == "air" then
minetest.set_node(pt.above, {name = "fire:basic_flame"})
end
end
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
if not minetest.setting_getbool("creative_mode") then
-- Wear tool
local wdef = itemstack:get_definition()
itemstack:add_wear(1000)
-- Tool break sound
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {pos = sound_pos, gain = 0.5})
minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5})
end
return itemstack
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -107,16 +107,11 @@ function flowers.flower_spread(pos, node)
pos.y = pos.y - 1
local under = minetest.get_node(pos)
pos.y = pos.y + 1
-- Replace flora with dry shrub in desert sand and silver sand,
-- as this is the only way to generate them.
-- However, preserve grasses in sand dune biomes.
if minetest.get_item_group(under.name, "sand") == 1 and
under.name ~= "default:sand" then
if under.name == "default:desert_sand" then
minetest.set_node(pos, {name = "default:dry_shrub"})
return
end
if minetest.get_item_group(under.name, "soil") == 0 then
elseif under.name ~= "default:dirt_with_grass" and
under.name ~= "default:dirt_with_dry_grass" then
return
end
@ -131,26 +126,24 @@ function flowers.flower_spread(pos, node)
return
end
local soils = minetest.find_nodes_in_area_under_air(
pos0, pos1, "group:soil")
if #soils > 0 then
local seedling = soils[math.random(#soils)]
local seedling_above =
{x = seedling.x, y = seedling.y + 1, z = seedling.z}
light = minetest.get_node_light(seedling_above)
if not light or light < 13 or
-- Desert sand is in the soil group
minetest.get_node(seedling).name == "default:desert_sand" then
local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1,
{"default:dirt_with_grass", "default:dirt_with_dry_grass"})
if #seedling > 0 then
seedling = seedling[math.random(#seedling)]
seedling.y = seedling.y + 1
light = minetest.get_node_light(seedling)
if not light or light < 13 then
return
end
minetest.set_node(seedling_above, {name = node.name})
minetest.set_node(seedling, {name = node.name})
end
end
minetest.register_abm({
label = "Flower spread",
nodenames = {"group:flora"},
neighbors = {"default:dirt_with_grass", "default:dirt_with_dry_grass",
"default:desert_sand"},
interval = 13,
chance = 96,
action = function(...)
@ -271,7 +264,7 @@ minetest.register_node("flowers:waterlily", {
node_placement_prediction = "",
node_box = {
type = "fixed",
fixed = {-0.5, -31 / 64, -0.5, 0.5, -15 / 32, 0.5}
fixed = {-0.5, -0.5, -0.5, 0.5, -15 / 32, 0.5}
},
selection_box = {
type = "fixed",
@ -289,8 +282,7 @@ minetest.register_node("flowers:waterlily", {
if not minetest.is_protected(pos, player_name) then
minetest.set_node(pos, {name = "flowers:waterlily",
param2 = math.random(0, 3)})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
else

View File

@ -94,8 +94,7 @@ local function register_flower(seed, name)
octaves = 3,
persist = 0.6
},
biomes = {"grassland", "deciduous_forest", "coniferous_forest",
"floatland_grassland", "floatland_coniferous_forest"},
biomes = {"grassland", "deciduous_forest", "coniferous_forest"},
y_min = 1,
y_max = 31000,
decoration = "flowers:"..name,
@ -115,8 +114,7 @@ local function register_mushroom(name)
octaves = 3,
persist = 0.66
},
biomes = {"deciduous_forest", "coniferous_forest",
"floatland_coniferous_forest"},
biomes = {"deciduous_forest", "coniferous_forest"},
y_min = 1,
y_max = 31000,
decoration = "flowers:"..name,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 690 B

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,24 +0,0 @@
minetest.register_chatcommand("killme", {
description = "Kill yourself to respawn",
func = function(name)
local player = minetest.get_player_by_name(name)
if player then
if minetest.setting_getbool("enable_damage") then
player:set_hp(0)
return true
else
for _, callback in pairs(core.registered_on_respawnplayers) do
if callback(player) then
return true
end
end
-- There doesn't seem to be a way to get a default spawn pos from the lua API
return false, "No static_spawnpoint defined"
end
else
-- Show error message if used when not logged in, eg: from IRC mod
return false, "You need to be online to be killed!"
end
end
})

View File

@ -1,5 +1,13 @@
screwdriver = {}
local function nextrange(x, max)
x = x + 1
if x > max then
x = 0
end
return x
end
screwdriver.ROTATE_FACE = 1
screwdriver.ROTATE_AXIS = 2
screwdriver.disallow = function(pos, node, user, mode, new_param2)
@ -11,73 +19,6 @@ screwdriver.rotate_simple = function(pos, node, user, mode, new_param2)
end
end
-- For attached wallmounted nodes: returns true if rotation is valid
-- simplified version of minetest:builtin/game/falling.lua#L148.
local function check_attached_node(pos, rotation)
local d = minetest.wallmounted_to_dir(rotation)
local p2 = vector.add(pos, d)
local n = minetest.get_node(p2).name
local def2 = minetest.registered_nodes[n]
if def2 and not def2.walkable then
return false
end
return true
end
screwdriver.rotate = {}
local facedir_tbl = {
[screwdriver.ROTATE_FACE] = {
[0] = 1, [1] = 2, [2] = 3, [3] = 0,
[4] = 5, [5] = 6, [6] = 7, [7] = 4,
[8] = 9, [9] = 10, [10] = 11, [11] = 8,
[12] = 13, [13] = 14, [14] = 15, [15] = 12,
[16] = 17, [17] = 18, [18] = 19, [19] = 16,
[20] = 21, [21] = 22, [22] = 23, [23] = 20,
},
[screwdriver.ROTATE_AXIS] = {
[0] = 4, [1] = 4, [2] = 4, [3] = 4,
[4] = 8, [5] = 8, [6] = 8, [7] = 8,
[8] = 12, [9] = 12, [10] = 12, [11] = 12,
[12] = 16, [13] = 16, [14] = 16, [15] = 16,
[16] = 20, [17] = 20, [18] = 20, [19] = 20,
[20] = 0, [21] = 0, [22] = 0, [23] = 0,
},
}
screwdriver.rotate.facedir = function(pos, node, mode)
local rotation = node.param2 % 32 -- get first 5 bits
local other = node.param2 - rotation
rotation = facedir_tbl[mode][rotation] or 0
return rotation + other
end
screwdriver.rotate.colorfacedir = screwdriver.rotate.facedir
local wallmounted_tbl = {
[screwdriver.ROTATE_FACE] = {[2] = 5, [3] = 4, [4] = 2, [5] = 3, [1] = 0, [0] = 1},
[screwdriver.ROTATE_AXIS] = {[2] = 5, [3] = 4, [4] = 2, [5] = 1, [1] = 0, [0] = 3}
}
screwdriver.rotate.wallmounted = function(pos, node, mode)
local rotation = node.param2 % 8 -- get first 3 bits
local other = node.param2 - rotation
rotation = wallmounted_tbl[mode][rotation] or 0
if minetest.get_item_group(node.name, "attached_node") ~= 0 then
-- find an acceptable orientation
for i = 1, 5 do
if not check_attached_node(pos, rotation) then
rotation = wallmounted_tbl[mode][rotation] or 0
else
break
end
end
end
return rotation + other
end
screwdriver.rotate.colorwallmounted = screwdriver.rotate.wallmounted
-- Handles rotation
screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
if pointed_thing.type ~= "node" then
@ -93,48 +34,54 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
local node = minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name]
if not ndef then
return itemstack
-- verify node is facedir (expected to be rotatable)
if not ndef or ndef.paramtype2 ~= "facedir" then
return
end
-- can we rotate this paramtype2?
local fn = screwdriver.rotate[ndef.paramtype2]
if not fn and not ndef.on_rotate then
return itemstack
-- Compute param2
local rotationPart = node.param2 % 32 -- get first 4 bits
local preservePart = node.param2 - rotationPart
local axisdir = math.floor(rotationPart / 4)
local rotation = rotationPart - axisdir * 4
if mode == screwdriver.ROTATE_FACE then
rotationPart = axisdir * 4 + nextrange(rotation, 3)
elseif mode == screwdriver.ROTATE_AXIS then
rotationPart = nextrange(axisdir, 5) * 4
end
local new_param2 = preservePart + rotationPart
local should_rotate = true
local new_param2
if fn then
new_param2 = fn(pos, node, mode)
else
new_param2 = node.param2
end
-- Node provides a handler, so let the handler decide instead if the node can be rotated
if ndef.on_rotate then
if ndef and ndef.on_rotate then -- Node provides a handler, so let the handler decide instead if the node can be rotated
-- Copy pos and node because callback can modify it
local result = ndef.on_rotate(vector.new(pos),
{name = node.name, param1 = node.param1, param2 = node.param2},
user, mode, new_param2)
if result == false then -- Disallow rotation
return itemstack
return
elseif result == true then
should_rotate = false
end
elseif ndef.on_rotate == false then
return itemstack
elseif ndef.can_dig and not ndef.can_dig(pos, user) then
return itemstack
else
if not ndef or not ndef.paramtype2 == "facedir" or
ndef.on_rotate == false or
(ndef.drawtype == "nodebox" and
not ndef.node_box.type == "fixed") or
node.param2 == nil then
return
end
if ndef.can_dig and not ndef.can_dig(pos, user) then
return
end
end
if should_rotate and new_param2 ~= node.param2 then
if should_rotate then
node.param2 = new_param2
minetest.swap_node(pos, node)
minetest.check_for_falling(pos)
end
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(user:get_player_name())) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535 / ((uses or 200) - 1))
end

View File

@ -5,9 +5,9 @@ local homes_file = minetest.get_worldpath() .. "/homes"
local homepos = {}
local function loadhomes()
local input = io.open(homes_file, "r")
local input, err = io.open(homes_file, "r")
if not input then
return -- no longer an error
return minetest.log("info", "Could not load player homes file: " .. err)
end
-- Iterate over all stored positions in the format "x y z player" for each line
@ -24,13 +24,11 @@ sethome.set = function(name, pos)
if not player or not pos then
return false
end
player:set_attribute("sethome:home", minetest.pos_to_string(pos))
-- remove `name` from the old storage file
local data = {}
local output = io.open(homes_file, "w")
local output, err = io.open(homes_file, "w")
if output then
homepos[name] = nil
homepos[name] = pos
for i, v in pairs(homepos) do
table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, i))
end
@ -38,18 +36,12 @@ sethome.set = function(name, pos)
io.close(output)
return true
end
return true -- if the file doesn't exist - don't return an error.
minetest.log("action", "Unable to write to player homes file: " .. err)
return false
end
sethome.get = function(name)
local player = minetest.get_player_by_name(name)
local pos = minetest.string_to_pos(player:get_attribute("sethome:home"))
if pos then
return pos
end
-- fetch old entry from storage table
pos = homepos[name]
local pos = homepos[name]
if pos then
return vector.new(pos)
else
@ -58,10 +50,9 @@ sethome.get = function(name)
end
sethome.go = function(name)
local pos = sethome.get(name)
local player = minetest.get_player_by_name(name)
if player and pos then
player:setpos(pos)
if player and homepos[name] then
player:setpos(homepos[name])
return true
end
return false

View File

@ -70,7 +70,7 @@ function sfinv.get_formspec(player, context)
nav[#nav + 1] = pdef.title
nav_ids[#nav_ids + 1] = pdef.name
if pdef.name == context.page then
current_idx = #nav_ids
current_idx = i
end
end
end
@ -91,40 +91,20 @@ function sfinv.get_formspec(player, context)
end
end
function sfinv.get_or_create_context(player)
local name = player:get_player_name()
local context = sfinv.contexts[name]
if not context then
context = {
page = sfinv.get_homepage_name(player)
}
sfinv.contexts[name] = context
end
return context
end
function sfinv.set_context(player, context)
sfinv.contexts[player:get_player_name()] = context
end
function sfinv.set_player_inventory_formspec(player, context)
local fs = sfinv.get_formspec(player,
context or sfinv.get_or_create_context(player))
player:set_inventory_formspec(fs)
end
if not context then
local name = player:get_player_name()
context = sfinv.contexts[name]
if not context then
context = {
page = sfinv.get_homepage_name(player)
}
sfinv.contexts[name] = context
end
end
function sfinv.set_page(player, pagename)
local context = sfinv.get_or_create_context(player)
local oldpage = sfinv.pages[context.page]
if oldpage and oldpage.on_leave then
oldpage:on_leave(player, context)
end
context.page = pagename
local page = sfinv.pages[pagename]
if page.on_enter then
page:on_enter(player, context)
end
sfinv.set_player_inventory_formspec(player, context)
local fs = sfinv.get_formspec(player, context)
player:set_inventory_formspec(fs)
end
minetest.register_on_joinplayer(function(player)
@ -152,21 +132,30 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return false
end
-- Was a tab selected?
-- Handle Events
if fields.tabs and context.nav then
local tid = tonumber(fields.tabs)
if tid and tid > 0 then
local id = context.nav[tid]
local page = sfinv.pages[id]
if id and page then
sfinv.set_page(player, id)
local oldpage = sfinv.pages[context.page]
if oldpage and oldpage.on_leave then
oldpage:on_leave(player, context)
end
context.page = id
if page.on_enter then
page:on_enter(player, context)
end
sfinv.set_player_inventory_formspec(player, context)
end
end
else
-- Pass event to page
local page = sfinv.pages[context.page]
if page and page.on_player_receive_fields then
return page:on_player_receive_fields(player, context, fields)
end
return
end
-- Pass to page
local page = sfinv.pages[context.page]
if page and page.on_player_receive_fields then
return page:on_player_receive_fields(player, context, fields)
end
end)

View File

@ -17,30 +17,6 @@ minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
local replace = minetest.setting_getbool("enable_stairs_replace_abm")
local function rotate_and_place(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:getpos()
if placer_pos then
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
end
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
local fpos = finepos.y % 1
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
or (fpos < -0.5 and fpos > -0.999999999) then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
elseif param2 == 23 then
param2 = 21
end
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end
-- Register stairs.
-- Node will be called stairs:stair_<subname>
@ -76,7 +52,30 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
return itemstack
end
return rotate_and_place(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:getpos()
if placer_pos then
local dir = {
x = p1.x - placer_pos.x,
y = p1.y - placer_pos.y,
z = p1.z - placer_pos.z
}
param2 = minetest.dir_to_facedir(dir)
end
if p0.y - 1 == p1.y then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
elseif param2 == 23 then
param2 = 21
end
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end,
})
@ -127,6 +126,8 @@ end
-- Slab facedir to placement 6d matching table
local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
-- Slab facedir when placing initial slab against other surface
local slab_trans_dir_place = {[0] = 0, 20, 12, 16, 4, 8}
-- Register slabs.
-- Node will be called stairs:slab_<subname>
@ -149,10 +150,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
on_place = function(itemstack, placer, pointed_thing)
local under = minetest.get_node(pointed_thing.under)
local wield_item = itemstack:get_name()
local creative_enabled = (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name()))
if under and under.name:find("stairs:slab_") then
if under and wield_item == under.name then
-- place slab using under node orientation
local dir = minetest.dir_to_facedir(vector.subtract(
pointed_thing.above, pointed_thing.under), true)
@ -160,9 +159,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
local p2 = under.param2
-- combine two slabs if possible
if slab_trans_dir[math.floor(p2 / 4)] == dir
and wield_item == under.name then
if slab_trans_dir[math.floor(p2 / 4)] == dir then
if not recipeitem then
return itemstack
end
@ -174,7 +171,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
return
end
minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2})
if not creative_enabled then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
@ -190,12 +187,21 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
-- else attempt to place node with proper param2
minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
if not creative_enabled then
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
else
return rotate_and_place(itemstack, placer, pointed_thing)
-- place slab using look direction of player
local dir = minetest.dir_to_wallmounted(vector.subtract(
pointed_thing.above, pointed_thing.under), true)
local rot = slab_trans_dir_place[dir]
if rot == 0 or rot == 20 then
rot = rot + minetest.dir_to_facedir(placer:get_look_dir())
end
return minetest.item_place(itemstack, placer, pointed_thing, rot)
end
end,
})
@ -438,66 +444,6 @@ stairs.register_stair_and_slab(
default.node_sound_stone_defaults()
)
stairs.register_stair_and_slab(
"desert_sandstone",
"default:desert_sandstone",
{crumbly = 1, cracky = 3},
{"default_desert_sandstone.png"},
"Desert Sandstone Stair",
"Desert Sandstone Slab",
default.node_sound_stone_defaults()
)
stairs.register_stair_and_slab(
"desert_sandstone_brick",
"default:desert_sandstone_brick",
{cracky = 2},
{"default_desert_sandstone_brick.png"},
"Desert Sandstone Brick Stair",
"Desert Sandstone Brick Slab",
default.node_sound_stone_defaults()
)
stairs.register_stair_and_slab(
"desert_sandstone_block",
"default:desert_sandstone_block",
{cracky = 2},
{"default_desert_sandstone_block.png"},
"Desert Sandstone Block Stair",
"Desert Sandstone Block Slab",
default.node_sound_stone_defaults()
)
stairs.register_stair_and_slab(
"silver_sandstone",
"default:silver_sandstone",
{crumbly = 1, cracky = 3},
{"default_silver_sandstone.png"},
"Silver Sandstone Stair",
"Silver Sandstone Slab",
default.node_sound_stone_defaults()
)
stairs.register_stair_and_slab(
"silver_sandstone_brick",
"default:silver_sandstone_brick",
{cracky = 2},
{"default_silver_sandstone_brick.png"},
"Silver Sandstone Brick Stair",
"Silver Sandstone Brick Slab",
default.node_sound_stone_defaults()
)
stairs.register_stair_and_slab(
"silver_sandstone_block",
"default:silver_sandstone_block",
{cracky = 2},
{"default_silver_sandstone_block.png"},
"Silver Sandstone Block Stair",
"Silver Sandstone Block Slab",
default.node_sound_stone_defaults()
)
stairs.register_stair_and_slab(
"obsidian",
"default:obsidian",
@ -587,27 +533,3 @@ stairs.register_stair_and_slab(
"Gold Block Slab",
default.node_sound_metal_defaults()
)
stairs.register_stair_and_slab(
"ice",
"default:ice",
{cracky = 3, puts_out_fire = 1, cools_lava = 1},
{"default_ice.png"},
"Ice Stair",
"Ice Slab",
default.node_sound_glass_defaults()
)
stairs.register_stair_and_slab(
"snowblock",
"default:snowblock",
{crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
{"default_snow.png"},
"Snow Block Stair",
"Snow Block Slab",
default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.15},
dug = {name = "default_snow_footstep", gain = 0.2},
dig = {name = "default_snow_footstep", gain = 0.2}
})
)

View File

@ -55,8 +55,7 @@ usemtl None
s off
f 13/11/3 14/12/3 15/13/3
f 15/13/3 18/14/3 17/15/3
f 14/12/3 16/16/3 15/13/3
f 16/16/3 18/14/3 15/13/3
f 14/12/3 16/16/3 18/14/3
o stairs_left
v 0.500000 0.000000 0.000000
v 0.500000 -0.500000 -0.500000
@ -76,8 +75,7 @@ usemtl None
s off
f 19/17/4 20/18/4 21/19/4
f 19/17/4 23/20/4 24/21/4
f 20/18/4 19/17/4 22/22/4
f 19/17/4 24/21/4 22/22/4
f 20/18/4 24/21/4 22/22/4
o stairs_back
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000

View File

@ -31,10 +31,7 @@ in mining.
How to use the mod:
Craft gunpowder by placing coal and gravel in the crafting area.
The gunpowder can be used to craft TNT or as fuse for TNT.
To craft TNT place items like this:
-- wood - gunpowder -- wood -
gunpowder gunpowder gunpowder
-- wood - gunpowder -- wood -
To craft TNT surround gunpowder with 4 wood in a + shape.
There are different ways to blow up TNT:
1. Hit it with a torch.

View File

@ -83,10 +83,7 @@ local function add_drop(drops, item)
end
end
local basic_flame_on_construct -- cached value
local function destroy(drops, npos, cid, c_air, c_fire,
on_blast_queue, on_construct_queue,
ignore_protection, ignore_on_blast)
local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_protection, ignore_on_blast)
if not ignore_protection and minetest.is_protected(npos, "") then
return cid
end
@ -96,16 +93,9 @@ local function destroy(drops, npos, cid, c_air, c_fire,
if not def then
return c_air
elseif not ignore_on_blast and def.on_blast then
on_blast_queue[#on_blast_queue + 1] = {
pos = vector.new(npos),
on_blast = def.on_blast
}
on_blast_queue[#on_blast_queue + 1] = {pos = vector.new(npos), on_blast = def.on_blast}
return cid
elseif def.flammable then
on_construct_queue[#on_construct_queue + 1] = {
fn = basic_flame_on_construct,
pos = vector.new(npos)
}
return c_fire
else
local node_drops = minetest.get_node_drops(def.name, "")
@ -260,15 +250,13 @@ end
function tnt.burn(pos, nodename)
local name = nodename or minetest.get_node(pos).name
local def = minetest.registered_nodes[name]
if not def then
return
elseif def.on_ignite then
def.on_ignite(pos)
elseif minetest.get_item_group(name, "tnt") > 0 then
local group = minetest.get_item_group(name, "tnt")
if group > 0 then
minetest.sound_play("tnt_ignite", {pos = pos})
minetest.set_node(pos, {name = name .. "_burning"})
minetest.get_node_timer(pos):start(1)
elseif name == "tnt:gunpowder" then
minetest.set_node(pos, {name = "tnt:gunpowder_burning"})
end
end
@ -318,8 +306,6 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
local drops = {}
local on_blast_queue = {}
local on_construct_queue = {}
basic_flame_on_construct = minetest.registered_nodes["fire:basic_flame"].on_construct
local c_fire = minetest.get_content_id("fire:basic_flame")
for z = -radius, radius do
@ -332,8 +318,8 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z}
if cid ~= c_air then
data[vi] = destroy(drops, p, cid, c_air, c_fire,
on_blast_queue, on_construct_queue,
ignore_protection, ignore_on_blast)
on_blast_queue, ignore_protection,
ignore_on_blast)
end
end
vi = vi + 1
@ -371,10 +357,6 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
end
end
for _, queued_data in pairs(on_construct_queue) do
queued_data.fn(queued_data.pos)
end
return drops, radius
end
@ -390,8 +372,6 @@ function tnt.boom(pos, def)
eject_drops(drops, pos, radius)
end
add_effects(pos, radius, drops)
minetest.log("action", "A TNT explosion occurred at " .. minetest.pos_to_string(pos) ..
" with radius " .. radius)
end
minetest.register_node("tnt:boom", {
@ -417,12 +397,7 @@ minetest.register_node("tnt:gunpowder", {
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
tiles = {
"tnt_gunpowder_straight.png",
"tnt_gunpowder_curved.png",
"tnt_gunpowder_t_junction.png",
"tnt_gunpowder_crossing.png"
},
tiles = {"tnt_gunpowder_straight.png", "tnt_gunpowder_curved.png", "tnt_gunpowder_t_junction.png", "tnt_gunpowder_crossing.png"},
inventory_image = "tnt_gunpowder_inventory.png",
wield_image = "tnt_gunpowder_inventory.png",
selection_box = {
@ -436,9 +411,6 @@ minetest.register_node("tnt:gunpowder", {
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then
minetest.set_node(pos, {name = "tnt:gunpowder_burning"})
minetest.log("action", puncher:get_player_name() ..
" ignites tnt:gunpowder at " ..
minetest.pos_to_string(pos))
end
end,
on_blast = function(pos, intensity)
@ -499,11 +471,7 @@ minetest.register_node("tnt:gunpowder_burning", {
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
drop = "",
groups = {
dig_immediate = 2,
attached_node = 1,
connect_to_raillike = minetest.raillike_group("gunpowder")
},
groups = {dig_immediate = 2, attached_node = 1, connect_to_raillike = minetest.raillike_group("gunpowder")},
sounds = default.node_sound_leaves_defaults(),
on_timer = function(pos, elapsed)
for dx = -1, 1 do
@ -530,7 +498,7 @@ minetest.register_node("tnt:gunpowder_burning", {
})
minetest.register_craft({
output = "tnt:gunpowder 5",
output = "tnt:gunpowder",
type = "shapeless",
recipe = {"default:coal_lump", "default:gravel"}
})
@ -539,9 +507,9 @@ if enable_tnt then
minetest.register_craft({
output = "tnt:tnt",
recipe = {
{"group:wood", "tnt:gunpowder", "group:wood"},
{"tnt:gunpowder", "tnt:gunpowder", "tnt:gunpowder"},
{"group:wood", "tnt:gunpowder", "group:wood"}
{"", "group:wood", ""},
{"group:wood", "tnt:gunpowder", "group:wood"},
{"", "group:wood", ""}
}
})
@ -582,9 +550,6 @@ function tnt.register_tnt(def)
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then
minetest.set_node(pos, {name = name .. "_burning"})
minetest.log("action", puncher:get_player_name() ..
" ignites " .. node.name .. " at " ..
minetest.pos_to_string(pos))
end
end,
on_blast = function(pos, intensity)