1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00
This commit is contained in:
Obani 2015-06-15 12:16:23 +02:00
commit a33a19cb32
47 changed files with 6729 additions and 14519 deletions

View File

@ -0,0 +1,160 @@
# Blender v2.69 (sub 0) OBJ File: ''
# www.blender.org
mtllib fancy_bed.mtl
o mattress_Mattress_nodebox-6_none.001_fancy_bed.png.001
v 0.437500 -0.312500 -0.437501
v 0.437500 -0.062500 -0.437501
v 0.437500 -0.062500 1.437499
v 0.437500 -0.312500 1.437499
v -0.437500 -0.312500 -0.437501
v -0.437500 -0.312500 1.437499
v -0.437500 -0.062500 1.437499
v -0.437500 -0.062500 -0.437501
v 0.437500 -0.176793 -0.437501
v -0.437500 -0.176793 -0.437501
vt 0.000171 0.499972
vt 0.000161 0.000182
vt 0.999791 0.000253
vt 0.999873 0.500022
vt 0.749576 0.000208
vt 0.749876 0.499854
vt 0.999848 0.999750
vt 0.000152 0.999750
vt 0.749276 0.130648
vt 0.000112 0.130648
g mattress_Mattress_nodebox-6_none.001_fancy_bed.png.001_none.001_fancy_bed.png.001
usemtl none.001_fancy_bed.png.001
s off
f 1/1 2/2 3/3 4/4
f 5/2 6/3 7/4 8/1
f 4/5 3/2 7/1 6/6
f 1/1 4/4 6/7 5/8
f 2/1 8/2 7/3 3/4
f 8/2 2/5 9/9 10/10
o wood_structure_Wood_structure_nodebox-4.001_none.002
v 0.374999 -0.375000 1.437499
v 0.374999 -0.125000 1.437499
v 0.374999 -0.125000 1.499999
v 0.374999 -0.375000 1.499999
v -0.374999 -0.375000 1.437499
v -0.374999 -0.375000 1.499999
v -0.374999 -0.125000 1.499999
v -0.374999 -0.125000 1.437499
v -0.375000 -0.500000 1.437499
v -0.375000 0.187500 1.437499
v -0.375000 0.187500 1.499999
v -0.375000 -0.500000 1.499999
v -0.500000 -0.500000 1.437499
v -0.500000 -0.500000 1.499999
v -0.500000 0.187500 1.499999
v -0.500000 0.187500 1.437499
v -0.437500 -0.375000 -0.437501
v -0.437500 -0.125000 -0.437501
v -0.437500 -0.125000 1.437498
v -0.437500 -0.375000 1.437498
v -0.500000 -0.375000 -0.437501
v -0.500000 -0.375000 1.437498
v -0.500000 -0.125000 1.437498
v -0.500000 -0.125000 -0.437501
v 0.375001 -0.000000 1.437499
v 0.375001 0.125000 1.437499
v 0.375001 0.125000 1.499999
v 0.375001 -0.000000 1.499999
v -0.375001 -0.000000 1.437499
v -0.375001 -0.000000 1.499999
v -0.375001 0.125000 1.499999
v -0.375001 0.125000 1.437499
v 0.500000 -0.500000 1.437499
v 0.500000 0.187500 1.437499
v 0.500000 0.187500 1.499999
v 0.500000 -0.500000 1.499999
v 0.375000 -0.500000 1.437499
v 0.375000 -0.500000 1.499999
v 0.375000 0.187500 1.499999
v 0.375000 0.187500 1.437499
v 0.500000 -0.375000 -0.437501
v 0.500000 -0.125000 -0.437501
v 0.500000 -0.125000 1.437499
v 0.500000 -0.375000 1.437499
v 0.437500 -0.375000 -0.437501
v 0.437500 -0.375000 1.437499
v 0.437500 -0.125000 1.437499
v 0.437500 -0.125000 -0.437501
v -0.375000 -0.500000 -0.500000
v -0.375000 -0.065000 -0.500000
v -0.375000 -0.065000 -0.437500
v -0.375000 -0.500000 -0.437500
v -0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 -0.437500
v -0.500000 -0.065000 -0.437500
v -0.500000 -0.065000 -0.500000
v 0.375006 -0.375000 -0.500000
v 0.375006 -0.125000 -0.500000
v 0.375006 -0.125000 -0.437500
v 0.375006 -0.375000 -0.437500
v -0.375006 -0.375000 -0.500000
v -0.375006 -0.375000 -0.437500
v -0.375006 -0.125000 -0.437500
v -0.375006 -0.125000 -0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 -0.065000 -0.500000
v 0.500000 -0.065000 -0.437500
v 0.500000 -0.500000 -0.437500
v 0.375000 -0.500000 -0.500000
v 0.375000 -0.500000 -0.437500
v 0.375000 -0.065000 -0.437500
v 0.375000 -0.065000 -0.500000
vt 0.377610 0.378205
vt 0.622484 0.378175
vt 0.622515 0.623120
vt 0.377671 0.623151
g wood_structure_Wood_structure_nodebox-4.001_none.002_none.002
usemtl none.002
s off
f 59/11 60/12 61/13 62/14
f 63/14 64/11 65/12 66/13
f 59/11 63/14 66/13 60/12
f 62/14 61/13 65/12 64/11
f 59/11 62/14 64/13 63/12
f 60/12 66/11 65/14 61/13
f 67/11 71/12 74/13 68/14
f 70/14 69/11 73/12 72/13
f 67/11 70/12 72/13 71/14
f 68/11 74/12 73/13 69/14
f 75/11 76/12 77/13 78/14
f 79/14 80/11 81/12 82/13
f 75/14 79/11 82/12 76/13
f 78/11 77/12 81/13 80/14
f 75/11 78/12 80/13 79/14
f 76/11 82/12 81/13 77/14
g wood_structure_Wood_structure_nodebox-4.001_none.002_none.003
usemtl none.003
f 15/11 16/12 17/13 18/14
f 11/13 15/14 18/11 12/12
f 14/14 13/11 17/12 16/13
f 11/14 14/11 16/12 15/13
f 12/11 18/12 17/13 13/14
f 19/11 20/12 21/13 22/14
f 23/14 24/11 25/12 26/13
f 19/14 23/11 26/12 20/13
f 22/11 21/12 25/13 24/14
f 19/11 22/12 24/13 23/14
f 20/11 26/12 25/13 21/14
f 27/14 28/11 29/12 30/13
f 31/11 32/12 33/13 34/14
f 27/11 30/12 32/13 31/14
f 28/14 34/11 33/12 29/13
f 35/11 39/12 42/13 36/14
f 38/14 37/11 41/12 40/13
f 35/14 38/11 40/12 39/13
f 36/11 42/12 41/13 37/14
f 43/11 44/12 45/13 46/14
f 47/14 48/11 49/12 50/13
f 43/14 47/11 50/12 44/13
f 46/11 45/12 49/13 48/14
f 43/11 46/12 48/13 47/14
f 44/11 50/12 49/13 45/14
f 51/14 52/11 53/12 54/13
f 55/13 56/14 57/11 58/12
f 51/11 54/12 56/13 55/14
f 52/14 58/11 57/12 53/13

View File

@ -0,0 +1,32 @@
# Blender v2.69 (sub 0) OBJ File: ''
# www.blender.org
mtllib simple_bed.mtl
o Simple_Bed
v 0.500000 -0.500000 -0.500000
v 0.500000 0.060000 -0.500000
v 0.500000 0.060000 1.500000
v 0.500000 -0.500000 1.500000
v -0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 1.500000
v -0.500000 0.060000 1.500000
v -0.500000 0.060000 -0.500000
vt 0.000112 0.780442
vt 0.000110 0.999969
vt 0.780324 0.999889
vt 0.780377 0.780471
vt 0.780636 0.390284
vt 0.999906 0.780382
vt 0.999906 0.390284
vt 0.780636 0.000047
vt 0.999906 0.000094
vt 0.390235 0.780320
vt 0.390235 0.000071
vt 0.000142 0.000142
usemtl none.002
s off
f 1/1 2/2 3/3 4/4
f 5/1 6/4 7/3 8/2
f 1/5 5/4 8/6 2/7
f 4/8 3/9 7/7 6/5
f 1/8 4/4 6/10 5/11
f 2/11 8/12 7/1 3/10

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -33,7 +33,7 @@ boats.register_boat = function(parameters)
physical = true, physical = true,
collisionbox = {-0.6, -0.4, -0.6, 0.6, 0.3, 0.6}, collisionbox = {-0.6, -0.4, -0.6, 0.6, 0.3, 0.6},
visual = "mesh", visual = "mesh",
mesh = "boat.x", mesh = "boat.obj",
textures = {parameters.texture or "default_wood.png"}, textures = {parameters.texture or "default_wood.png"},
driver = nil, driver = nil,
v = 0, v = 0,
@ -297,3 +297,4 @@ minetest.register_craft({
{"group:wood", "group:wood", "group:wood"}, {"group:wood", "group:wood", "group:wood"},
}, },
}) })

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,10 @@ minetest.register_alias("bucket_acid", "bucket:bucket_acid")
minetest.register_alias("bucket_lava", "bucket:bucket_lava") minetest.register_alias("bucket_lava", "bucket:bucket_lava")
minetest.register_craft({ minetest.register_craft({
output = "bucket:bucket_empty 1", output = 'bucket:bucket_empty 1',
recipe = { recipe = {
{"group:ingot", "", "group:ingot"}, {'group:ingot', '', 'group:ingot'},
{"", "group:ingot", ""}, {'', 'group:ingot', ''},
} }
}) })
@ -23,7 +23,7 @@ local function check_protection(pos, name, text)
.. " tried to " .. text .. " tried to " .. text
.. " at protected position " .. " at protected position "
.. minetest.pos_to_string(pos) .. minetest.pos_to_string(pos)
.. " with a bucket.") .. " with a bucket")
minetest.record_protection_violation(pos, name) minetest.record_protection_violation(pos, name)
return true return true
end end
@ -127,37 +127,37 @@ minetest.register_craftitem("bucket:bucket_empty", {
and liquiddef.itemname ~= nil and liquiddef.itemname ~= nil
and node.name == liquiddef.source then and node.name == liquiddef.source then
if check_protection(pointed_thing.under, if check_protection(pointed_thing.under,
user:get_player_name(), user:get_player_name(),
"take ".. node.name) then "take ".. node.name) then
return return
end end
-- default set to return filled bucket -- default set to return filled bucket
local giving_back = liquiddef.itemname local giving_back = liquiddef.itemname
-- check if holding more than 1 empty bucket -- check if holding more than 1 empty bucket
if item_count > 1 then if item_count > 1 then
-- if space in inventory add filled bucked, otherwise drop as item -- if space in inventory add filled bucked, otherwise drop as item
local inv = user:get_inventory() local inv = user:get_inventory()
if inv:room_for_item("main", {name=liquiddef.itemname}) then if inv:room_for_item("main", {name=liquiddef.itemname}) then
inv:add_item("main", liquiddef.itemname) inv:add_item("main", liquiddef.itemname)
else else
local pos = user:getpos() local pos = user:getpos()
pos.y = math.floor(pos.y + 0.5) pos.y = math.floor(pos.y + 0.5)
core.add_item(pos, liquiddef.itemname) core.add_item(pos, liquiddef.itemname)
end
-- set to return empty buckets minus 1
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
end end
-- set to return empty buckets minus 1 minetest.add_node(pointed_thing.under, {name="air"})
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
return ItemStack(giving_back)
end end
end,
minetest.add_node(pointed_thing.under, {name="air"})
return ItemStack(giving_back)
end
end,
}) })
bucket.register_liquid( bucket.register_liquid(
@ -219,7 +219,3 @@ minetest.register_craft({
{"bucket:bucket_water"}, {"bucket:bucket_water"},
}, },
}) })
if minetest.setting_getbool("log_mods") then
minetest.log("action", "Carbone: [bucket] loaded.")
end

View File

@ -62,7 +62,6 @@ VanessaE (WTFPL):
default_desert_stone.png default_desert_stone.png
default_desert_stone_brick.png default_desert_stone_brick.png
default_sand.png default_sand.png
default_sandstone_brick.png
Calinou (CC BY-SA): Calinou (CC BY-SA):
default_brick.png default_brick.png
@ -109,6 +108,11 @@ paramat (CC BY-SA 3.0):
default_pinetree.png default_pinetree.png
default_pinetree_top.png default_pinetree_top.png
default_pinewood.png default_pinewood.png
default_sandstone_brick.png
default_obsidian_brick.png
default_river_water.png
default_river_water_source_animated.png
default_river_water_flowing_animated.png
brunob.santos (CC BY-SA 4.0): brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png default_desert_cobble.png

File diff suppressed because it is too large Load Diff

View File

@ -14,16 +14,87 @@ minetest.register_craftitem("default:paper", {
inventory_image = "default_paper.png", inventory_image = "default_paper.png",
}) })
local function book_on_use(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local data = minetest.deserialize(itemstack:get_metadata())
local title, text, owner = "", "", player_name
if data then
title, text, owner = data.title, data.text, data.owner
end
local formspec
if owner == player_name then
formspec = "size[8,8]"..default.gui_bg..
"field[0.5,1;7.5,0;title;Title:;"..
minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;text;Contents:;"..
minetest.formspec_escape(text).."]"..
"button_exit[2.5,7.5;3,1;save;Save]"
else
formspec = "size[8,8]"..default.gui_bg..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
end
minetest.show_formspec(user:get_player_name(), "default:book", formspec)
end
minetest.register_on_player_receive_fields(function(player, form_name, fields)
if form_name ~= "default:book" or not fields.save or
fields.title == "" or fields.text == "" then
return
end
local inv = player:get_inventory()
local stack = player:get_wielded_item()
local new_stack, data
if stack:get_name() ~= "default:book_written" then
local count = stack:get_count()
if count == 1 then
stack:set_name("default:book_written")
else
stack:set_count(count - 1)
new_stack = ItemStack("default:book_written")
end
else
data = minetest.deserialize(stack:get_metadata())
end
if not data then data = {} end
data.title = fields.title
data.text = fields.text
data.owner = player:get_player_name()
local data_str = minetest.serialize(data)
if new_stack then
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:set_metadata(data_str)
end
player:set_wielded_item(stack)
end)
minetest.register_craftitem("default:book", { minetest.register_craftitem("default:book", {
description = "Book", description = "Book",
inventory_image = "default_book.png", inventory_image = "default_book.png",
groups = {book=1}, groups = {book=1},
on_use = book_on_use,
})
minetest.register_craftitem("default:book_written", {
description = "Book With Text",
inventory_image = "default_book.png",
groups = {book=1, not_in_creative_inventory=1},
stack_max = 1,
on_use = book_on_use,
}) })
minetest.register_craftitem("default:coal_lump", { minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump", description = "Coal Lump",
wield_scale = {x = 1, y = 1, z = 2}, wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_coal_lump.png", inventory_image = "default_coal_lump.png",
groups = {coal = 1}
}) })
minetest.register_craftitem("default:iron_lump", { minetest.register_craftitem("default:iron_lump", {

View File

@ -129,33 +129,9 @@ function default.node_sound_glass_defaults(table)
return table return table
end end
--
-- Global callbacks
--
-- Global environment step function
function on_step(dtime)
-- print("on_step, " .. p .. ", " .. node)
end
minetest.register_globalstep(on_step)
function on_placenode(p, node)
-- print("on_placenode, " .. p .. ", " .. node)
end
minetest.register_on_placenode(on_placenode)
function on_dignode(p, node)
-- print("on_dignode, " .. p .. ", " .. node)
end
minetest.register_on_dignode(on_dignode)
function on_punchnode(p, node)
-- print("on_punchnode, " .. p .. ", " .. node)
end
minetest.register_on_punchnode(on_punchnode)
-- --
-- Lava cooling -- Lavacooling
-- --
local function cool_wf_vm(pos, node1, node2) local function cool_wf_vm(pos, node1, node2)
@ -240,55 +216,55 @@ minetest.register_abm({
end, end,
}) })
-- --
-- Papyrus and cactus growing -- Papyrus and cactus growing
-- --
-- wrapping the functions in abm action is necessary to make overriding them possible
function default.grow_cactus(pos, node) function default.grow_cactus(pos, node)
if node.param2 ~= 0 then if node.param2 ~= 0 then
return return
end end
pos.y = pos.y-1 pos.y = pos.y - 1
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
return return
end end
pos.y = pos.y+1 pos.y = pos.y + 1
local height = 0 local height = 0
while node.name == "default:cactus" and height < 4 and node.param2 == 0 do while node.name == "default:cactus" and height < 4 do
height = height+1 height = height + 1
pos.y = pos.y+1 pos.y = pos.y + 1
node = minetest.get_node(pos) node = minetest.get_node(pos)
end end
if height == 4 if height == 4 or node.name ~= "air" then
or node.name ~= "air" then
return return
end end
minetest.set_node(pos, {name="default:cactus"}) minetest.set_node(pos, {name = "default:cactus"})
return true return true
end end
function default.grow_papyrus(pos, node) function default.grow_papyrus(pos, node)
pos.y = pos.y-1 pos.y = pos.y - 1
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
if name ~= "default:dirt_with_grass" if name ~= "default:dirt_with_grass" and name ~= "default:dirt" then
and name ~= "default:dirt" then
return return
end end
if not minetest.find_node_near(pos, 3, {"group:water"}) then if not minetest.find_node_near(pos, 3, {"group:water"}) then
return return
end end
pos.y = pos.y+1 pos.y = pos.y + 1
local height = 0 local height = 0
while node.name == "default:papyrus" and height < 4 do while node.name == "default:papyrus" and height < 4 do
height = height+1 height = height + 1
pos.y = pos.y+1 pos.y = pos.y + 1
node = minetest.get_node(pos) node = minetest.get_node(pos)
end end
if height == 4 if height == 4 or node.name ~= "air" then
or node.name ~= "air" then
return return
end end
minetest.set_node(pos, {name="default:papyrus"}) minetest.set_node(pos, {name = "default:papyrus"})
return true return true
end end
@ -299,7 +275,7 @@ minetest.register_abm({
chance = 25, chance = 25,
action = function(...) action = function(...)
default.grow_cactus(...) default.grow_cactus(...)
end, end
}) })
minetest.register_abm({ minetest.register_abm({
@ -309,9 +285,14 @@ minetest.register_abm({
chance = 25, chance = 25,
action = function(...) action = function(...)
default.grow_papyrus(...) default.grow_papyrus(...)
end, end
}) })
--
-- dig upwards
--
function default.dig_up(pos, node, digger) function default.dig_up(pos, node, digger)
if digger == nil then return end if digger == nil then return end
local np = {x = pos.x, y = pos.y + 1, z = pos.z} local np = {x = pos.x, y = pos.y + 1, z = pos.z}
@ -321,23 +302,11 @@ function default.dig_up(pos, node, digger)
end end
end end
-- --
-- Leafdecay -- Leafdecay
-- --
-- To enable leaf decay for a node, add it to the "leafdecay" group.
--
-- The rating of the group determines how far from a node in the group "tree"
-- the node can be without decaying.
--
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if
-- the player places a node of that kind, you will want to set param2= 1 or so.
--
-- If the node is in the leafdecay_drop group then the it will always be dropped
-- as an item
if minetest.setting_getbool("leaf_decay") ~= false then -- “If not defined or set to true then”
default.leafdecay_trunk_cache = {} default.leafdecay_trunk_cache = {}
default.leafdecay_enable_cache = true default.leafdecay_enable_cache = true
-- Spread the load of finding trunks -- Spread the load of finding trunks
@ -358,20 +327,21 @@ end
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:leafdecay"}, nodenames = {"group:leafdecay"},
neighbors = {"air", "group:liquid"}, neighbors = {"air", "group:liquid"},
interval = 1, -- A low interval and a high inverse chance spreads the load. -- A low interval and a high inverse chance spreads the load
interval = 1,
chance = 2, chance = 2,
action = function(p0, node, _, _) action = function(p0, node, _, _)
-- print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") --print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
local do_preserve = false local do_preserve = false
local d = minetest.registered_nodes[node.name].groups.leafdecay local d = minetest.registered_nodes[node.name].groups.leafdecay
if not d or d == 0 then if not d or d == 0 then
-- print("not groups.leafdecay") --print("not groups.leafdecay")
return return
end end
local n0 = minetest.get_node(p0) local n0 = minetest.get_node(p0)
if n0.param2 ~= 0 then if n0.param2 ~= 0 then
-- print("param2 ~= 0") --print("param2 ~= 0")
return return
end end
local p0_hash = nil local p0_hash = nil
@ -381,13 +351,15 @@ minetest.register_abm({
if trunkp then if trunkp then
local n = minetest.get_node(trunkp) local n = minetest.get_node(trunkp)
local reg = minetest.registered_nodes[n.name] local reg = minetest.registered_nodes[n.name]
-- Assume ignore is a trunk, to make the thing work at the border of the active area: -- Assume ignore is a trunk, to make the thing
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then -- work at the border of the active area
-- print("Cached trunk still exists.") if n.name == "ignore" or (reg and reg.groups.tree and
reg.groups.tree ~= 0) then
--print("cached trunk still exists")
return return
end end
-- print("Cached trunk is invalid.") --print("cached trunk is invalid")
-- Cache is invalid: -- Cache is invalid
table.remove(default.leafdecay_trunk_cache, p0_hash) table.remove(default.leafdecay_trunk_cache, p0_hash)
end end
end end
@ -396,33 +368,38 @@ minetest.register_abm({
end end
default.leafdecay_trunk_find_allow_accumulator = default.leafdecay_trunk_find_allow_accumulator =
default.leafdecay_trunk_find_allow_accumulator - 1 default.leafdecay_trunk_find_allow_accumulator - 1
-- Assume ignore is a trunk, to make the thing work at the border of the active area: -- Assume ignore is a trunk, to make the thing
-- work at the border of the active area
local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"}) local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"})
if p1 then if p1 then
do_preserve = true do_preserve = true
if default.leafdecay_enable_cache then if default.leafdecay_enable_cache then
-- print("Caching trunk.") --print("caching trunk")
-- Cache the trunk: -- Cache the trunk
default.leafdecay_trunk_cache[p0_hash] = p1 default.leafdecay_trunk_cache[p0_hash] = p1
end end
end end
if not do_preserve then if not do_preserve then
-- Drop stuff other than the node itself: -- Drop stuff other than the node itself
local itemstacks = minetest.get_node_drops(n0.name) local itemstacks = minetest.get_node_drops(n0.name)
for _, itemname in ipairs(itemstacks) do for _, itemname in ipairs(itemstacks) do
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
or itemname ~= n0.name then itemname ~= n0.name then
minetest.add_item(p0, itemname) local p_drop = {
x = p0.x - 0.5 + math.random(),
y = p0.y - 0.5 + math.random(),
z = p0.z - 0.5 + math.random(),
}
minetest.add_item(p_drop, itemname)
end end
end end
-- Remove node
minetest.remove_node(p0) minetest.remove_node(p0)
-- minetest.log("action", n0.name .. " decayed at " .. minetest.pos_to_string(p0) .. ".")
nodeupdate(p0) nodeupdate(p0)
end end
end end
}) })
end -- Ends: if minetest.setting_getbool("leaf_decay") ~= false
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
if newnode.name ~= "default:torch" or minetest.get_item_group(oldnode.name, "water") == 0 then if newnode.name ~= "default:torch" or minetest.get_item_group(oldnode.name, "water") == 0 then
@ -433,3 +410,44 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
minetest.add_item(pos, "default:torch") minetest.add_item(pos, "default:torch")
end) end)
--
-- Grass growing
--
minetest.register_abm({
nodenames = {"default:dirt"},
interval = 30,
chance = 5,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and
nodedef.liquidtype == "none" and
pos.y >= 0 and
(minetest.get_node_light(above) or 0) >= 12 then
if name == "default:snow" or name == "default:snowblock" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
else
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
end
})
minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
interval = 30,
chance = 2,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or
nodedef.paramtype == "light") and
nodedef.liquidtype == "none") then
minetest.set_node(pos, {name = "default:dirt"})
end
end
})

View File

@ -6,6 +6,8 @@
local function active_formspec(fuel_percent, item_percent) local function active_formspec(fuel_percent, item_percent)
local formspec = local formspec =
"size[8,8.5]".. "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots.. default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]".. "list[current_name;fuel;2.75,2.5;1,1;]"..
@ -22,6 +24,8 @@ end
local inactive_formspec = local inactive_formspec =
"size[8,8.5]".. "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots.. default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]".. "list[current_name;fuel;2.75,2.5;1,1;]"..

View File

@ -10,28 +10,31 @@ default = {}
default.LIGHT_MAX = 14 default.LIGHT_MAX = 14
-- GUI related stuff: -- GUI related stuff
default.gui_bg = "bgcolor[#080808BB;true]" default.gui_bg = "bgcolor[#080808BB;true]"
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
default.gui_slots = "listcolors[#606060AA;#808080;#101010;#202020;#FFF]" default.gui_slots = "listcolors[#606060AA;#808080;#101010;#202020;#FFF]"
function default.get_hotbar_bg(x,y) function default.get_hotbar_bg(x,y)
local out = "" local out = ""
for i= 0, 7, 1 do for i=0,7,1 do
out = out .."image[" .. x + i .. "," .. y .. ";1,1;gui_hb_bg.png]" out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
end end
return out return out
end end
default.gui_survival_form = "size[8,8.5]".. default.gui_survival_form = "size[8,8.5]"..
default.gui_slots .. default.gui_bg..
"list[current_player;main; 0, 4.25; 8, 4; ]" .. default.gui_bg_img..
"list[current_player;craft; 1.75, 0.5; 3, 3; ]" .. default.gui_slots..
"list[current_player;craftpreview; 5.75, 1.5; 1, 1; ]" .. "list[current_player;main;0,4.25;8,1;]"..
default.get_hotbar_bg(0, 4.25) .. "list[current_player;main;0,5.5;8,3;8]"..
default.get_hotbar_bg(0, 5.25) "list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
default.get_hotbar_bg(0,4.25)..
default.get_hotbar_bg(0,5.25)
-- Load files: -- Load files
dofile(minetest.get_modpath("default").."/functions.lua") dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/commands.lua") dofile(minetest.get_modpath("default").."/commands.lua")
dofile(minetest.get_modpath("default").."/nodes.lua") dofile(minetest.get_modpath("default").."/nodes.lua")

View File

@ -1,11 +1,11 @@
-- mods/default/Legacy.lua -- mods/default/legacy.lua
-- Horrible crap to support old code, -- Horrible crap to support old code registering falling nodes
-- don't use this and never do what this does, it's completely wrong! -- Don't use this and never do what this does, it's completely wrong!
-- (more specifically, the client and the C++ code doesn't get the group). -- (More specifically, the client and the C++ code doesn't get the group)
function default.register_falling_node(nodename, texture) function default.register_falling_node(nodename, texture)
minetest.log("error", debug.traceback()) minetest.log("error", debug.traceback())
minetest.log("error", "WARNING: default.register_falling_node is deprecated.") minetest.log('error', "WARNING: default.register_falling_node is deprecated")
if minetest.registered_nodes[nodename] then if minetest.registered_nodes[nodename] then
minetest.registered_nodes[nodename].groups.falling_node = 1 minetest.registered_nodes[nodename].groups.falling_node = 1
end end
@ -17,9 +17,9 @@ end
-- Liquids -- Liquids
WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha
WATER_ALPHA = minetest.registered_nodes["default:water_source"].liquid_viscosity WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity
WATER_ALPHA = minetest.registered_nodes["default:lava_source"].liquid_viscosity LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity
LIGHT_MAX = default.LIGHT_MAX LIGHT_MAX = default.LIGHT_MAX
-- Formspecs -- Formspecs
default.gui_survival_form = default.gui_survival_form default.gui_survival_form = default.gui_survival_form

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -4,6 +4,7 @@
minetest.register_item(":", { minetest.register_item(":", {
type = "none", type = "none",
wield_image = "wieldhand.png", wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
range = 5, range = 5,
tool_capabilities = { tool_capabilities = {
full_punch_interval = 0.8, full_punch_interval = 0.8,
@ -26,11 +27,11 @@ minetest.register_tool("default:pick_wood", {
inventory_image = "default_tool_woodpick.png", inventory_image = "default_tool_woodpick.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 1.2, full_punch_interval = 1.2,
max_drop_level = 0, max_drop_level=0,
groupcaps = { groupcaps={
cracky = {times = {[3] = 1.20}, uses = 15, maxlevel = 1}, cracky = {times = {[3] = 1.20}, uses = 15, maxlevel = 1},
}, },
damage_groups = {fleshy = 2}, damage_groups = {fleshy=2},
}, },
}) })
minetest.register_tool("default:pick_stone", { minetest.register_tool("default:pick_stone", {
@ -38,8 +39,8 @@ minetest.register_tool("default:pick_stone", {
inventory_image = "default_tool_stonepick.png", inventory_image = "default_tool_stonepick.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 1.2, full_punch_interval = 1.2,
max_drop_level = 0, max_drop_level=0,
groupcaps = { groupcaps={
cracky = {times = {[2] = 1.60, [3] = 1.00}, uses = 20, maxlevel = 1}, cracky = {times = {[2] = 1.60, [3] = 1.00}, uses = 20, maxlevel = 1},
crumbly = {times = {[1] = 2.6, [2] = 1.4, [3] = 0.44}, uses = 20, maxlevel = 1}, crumbly = {times = {[1] = 2.6, [2] = 1.4, [3] = 0.44}, uses = 20, maxlevel = 1},
}, },
@ -124,6 +125,7 @@ minetest.register_tool("default:pick_diamond", {
damage_groups = {fleshy = 4}, damage_groups = {fleshy = 4},
}, },
}) })
-- --
-- Shovels -- Shovels
-- --

View File

@ -29,7 +29,7 @@ minetest.register_abm({
end end
minetest.log("action", "A sapling grows into a tree at ".. minetest.log("action", "A sapling grows into a tree at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
default.grow_tree(pos, random(1, 4) == 1) default.grow_tree(pos, random(1, 4) == 1)
end end
}) })
@ -54,12 +54,12 @@ minetest.register_abm({
interval = 12, interval = 12,
chance = 50, chance = 50,
action = function(pos, node) action = function(pos, node)
if not can_grow(pos) then if not can_grow(pos) then
return return
end end
minetest.log("action", "A pine sapling grows into a tree at ".. minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
default.grow_pine_tree(pos) default.grow_pine_tree(pos)
end end
}) })
@ -78,7 +78,7 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
local vi = a:index(x, y + y_dist, z) local vi = a:index(x, y + y_dist, z)
local node_id = data[vi] local node_id = data[vi]
if y_dist == 0 or node_id == c_air or node_id == c_ignore if y_dist == 0 or node_id == c_air or node_id == c_ignore
or node_id == leaves_cid then or node_id == leaves_cid then
data[vi] = tree_cid data[vi] = tree_cid
end end
end end

View File

@ -1 +1,2 @@
default default
screwdriver?

View File

@ -26,6 +26,7 @@ function doors.register_door(name, def)
def.sound_open_door = "doors_door_open" def.sound_open_door = "doors_door_open"
end end
minetest.register_craftitem(name, { minetest.register_craftitem(name, {
description = def.description, description = def.description,
inventory_image = def.inventory_image, inventory_image = def.inventory_image,
@ -42,7 +43,7 @@ function doors.register_door(name, def)
end end
local pt = pointed_thing.above local pt = pointed_thing.above
local pt2 = {x = pt.x, y = pt.y, z = pt.z} local pt2 = {x=pt.x, y=pt.y, z=pt.z}
pt2.y = pt2.y+1 pt2.y = pt2.y+1
if if
not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to or not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to or
@ -60,7 +61,7 @@ function doors.register_door(name, def)
end end
local p2 = minetest.dir_to_facedir(placer:get_look_dir()) local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local pt3 = {x = pt.x, y = pt.y, z = pt.z} local pt3 = {x=pt.x, y=pt.y, z=pt.z}
if p2 == 0 then if p2 == 0 then
pt3.x = pt3.x-1 pt3.x = pt3.x-1
elseif p2 == 1 then elseif p2 == 1 then
@ -107,6 +108,25 @@ function doors.register_door(name, def)
end end
end end
local function check_and_blast(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
minetest.remove_node(pos)
end
end
local function make_on_blast(base_name, dir, door_type, other_door_type)
if def.only_placer_can_open then
return function() end
else
return function(pos, intensity)
check_and_blast(pos, base_name .. door_type)
pos.y = pos.y + dir
check_and_blast(pos, base_name .. other_door_type)
end
end
end
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params) local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
pos.y = pos.y+dir pos.y = pos.y+dir
if not minetest.get_node(pos).name == check_name then if not minetest.get_node(pos).name == check_name then
@ -143,6 +163,33 @@ function doors.register_door(name, def)
return meta:get_string("doors_owner") == pn return meta:get_string("doors_owner") == pn
end end
local function on_rotate(pos, node, dir, user, check_name, mode, new_param2)
if not check_player_priv(pos, user) then
return false
end
if mode ~= screwdriver.ROTATE_FACE then
return false
end
pos.y = pos.y + dir
if not minetest.get_node(pos).name == check_name then
return false
end
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return false
end
local node2 = minetest.get_node(pos)
node2.param2 = (node2.param2 + 1) % 4
minetest.swap_node(pos, node2)
pos.y = pos.y - dir
node.param2 = (node.param2 + 1) % 4
minetest.swap_node(pos, node)
return true
end
minetest.register_node(name.."_b_1", { minetest.register_node(name.."_b_1", {
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"}, tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"},
paramtype = "light", paramtype = "light",
@ -170,9 +217,14 @@ function doors.register_door(name, def)
end end
end, end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_1", mode)
end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight sunlight_propagates = def.sunlight,
on_blast = make_on_blast(name, 1, "_b_1", "_t_1")
}) })
minetest.register_node(name.."_t_1", { minetest.register_node(name.."_t_1", {
@ -202,9 +254,14 @@ function doors.register_door(name, def)
end end
end, end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_1", mode)
end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight, sunlight_propagates = def.sunlight,
on_blast = make_on_blast(name, -1, "_t_1", "_b_1")
}) })
minetest.register_node(name.."_b_2", { minetest.register_node(name.."_b_2", {
@ -234,9 +291,14 @@ function doors.register_door(name, def)
end end
end, end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_2", mode)
end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight sunlight_propagates = def.sunlight,
on_blast = make_on_blast(name, 1, "_b_2", "_t_2")
}) })
minetest.register_node(name.."_t_2", { minetest.register_node(name.."_t_2", {
@ -266,9 +328,14 @@ function doors.register_door(name, def)
end end
end, end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_2", mode)
end,
can_dig = check_player_priv, can_dig = check_player_priv,
sounds = def.sounds, sounds = def.sounds,
sunlight_propagates = def.sunlight sunlight_propagates = def.sunlight,
on_blast = make_on_blast(name, -1, "_t_2", "_b_2")
}) })
end end
@ -388,6 +455,8 @@ function doors.register_trapdoor(name, def)
minetest.set_node(pos, {name = newname, param1 = node.param1, param2 = node.param2}) minetest.set_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
end end
def.on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple
-- Common trapdoor configuration -- Common trapdoor configuration
def.drawtype = "nodebox" def.drawtype = "nodebox"
def.paramtype = "light" def.paramtype = "light"

View File

@ -1,63 +1,10 @@
-- minetest/dye/init.lua -- minetest/dye/init.lua
-- To make recipes that will work with any dye ever made by anybody, define
-- them based on groups.
-- You can select any group of groups, based on your need for amount of colors.
-- basecolor: 9, excolor: 17, unicolor: 89
--
-- Example of one shapeless recipe using a color group:
-- Note: As this uses basecolor_*, you'd need 9 of these.
-- minetest.register_craft({
-- type = "shapeless",
-- output = '<mod>:item_yellow',
-- recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
-- })
-- Other mods can use these for looping through available colors -- Other mods can use these for looping through available colors
dye = {} dye = {}
dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"} dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"} dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
-- Base color groups:
-- - basecolor_white
-- - basecolor_grey
-- - basecolor_black
-- - basecolor_red
-- - basecolor_yellow
-- - basecolor_green
-- - basecolor_cyan
-- - basecolor_blue
-- - basecolor_magenta
-- Extended color groups (* = equal to a base color):
-- * excolor_white
-- - excolor_lightgrey
-- * excolor_grey
-- - excolor_darkgrey
-- * excolor_black
-- * excolor_red
-- - excolor_orange
-- * excolor_yellow
-- - excolor_lime
-- * excolor_green
-- - excolor_aqua
-- * excolor_cyan
-- - excolor_sky_blue
-- * excolor_blue
-- - excolor_violet
-- * excolor_magenta
-- - excolor_red_violet
-- The whole unifieddyes palette as groups:
-- - unicolor_<excolor>
-- For the following, no white/grey/black is allowed:
-- - unicolor_medium_<excolor>
-- - unicolor_dark_<excolor>
-- - unicolor_light_<excolor>
-- - unicolor_<excolor>_s50
-- - unicolor_medium_<excolor>_s50
-- - unicolor_dark_<excolor>_s50
-- Local stuff -- Local stuff
local dyelocal = {} local dyelocal = {}

View File

@ -1,4 +1,5 @@
-- minetest/fire/init.lua -- minetest/fire/init.lua
fire = {} fire = {}
minetest.register_node("fire:basic_flame", { minetest.register_node("fire:basic_flame", {
@ -16,16 +17,18 @@ minetest.register_node("fire:basic_flame", {
buildable_to = true, buildable_to = true,
damage_per_second = 4, damage_per_second = 4,
on_construct = function(pos, placer) on_construct = function(pos)
fire.on_flame_add_at(pos) minetest.after(0, fire.on_flame_add_at, pos)
end, end,
on_destruct = function(pos, oldnode, oldmetadata, digger) on_destruct = function(pos)
fire.on_flame_remove_at(pos) minetest.after(0, fire.on_flame_remove_at, pos)
end, end,
-- unaffected by explosions
on_blast = function() end,
}) })
fire.D = 6 fire.D = 6
-- key: position hash of low corner of area -- key: position hash of low corner of area
-- value: {handle=sound handle, name=sound name} -- value: {handle=sound handle, name=sound name}
@ -63,7 +66,7 @@ function fire.update_sounds_around(pos)
if not sound then if not sound then
if should_have_sound then if should_have_sound then
fire.sounds[p0_hash] = { fire.sounds[p0_hash] = {
handle = minetest.sound_play(wanted_sound, {pos=cp, loop=true}), handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}),
name = wanted_sound.name, name = wanted_sound.name,
} }
end end
@ -74,7 +77,7 @@ function fire.update_sounds_around(pos)
elseif sound.name ~= wanted_sound.name then elseif sound.name ~= wanted_sound.name then
minetest.sound_stop(sound.handle) minetest.sound_stop(sound.handle)
fire.sounds[p0_hash] = { fire.sounds[p0_hash] = {
handle = minetest.sound_play(wanted_sound, {pos=cp, loop=true}), handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}),
name = wanted_sound.name, name = wanted_sound.name,
} }
end end
@ -106,7 +109,7 @@ end
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:flammable"}, nodenames = {"group:flammable"},
neighbors = {"group:igniter"}, neighbors = {"group:igniter"},
interval = 1, interval = 5,
chance = 2, chance = 2,
action = function(p0, node, _, _) action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, don't ignite -- If there is water or stuff like that around flame, don't ignite
@ -124,7 +127,7 @@ minetest.register_abm({
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:igniter"}, nodenames = {"group:igniter"},
neighbors = {"air"}, neighbors = {"air"},
interval = 2, interval = 5,
chance = 10, chance = 10,
action = function(p0, node, _, _) action = function(p0, node, _, _)
local reg = minetest.registered_nodes[node.name] local reg = minetest.registered_nodes[node.name]
@ -149,7 +152,7 @@ minetest.register_abm({
-- Remove flammable nodes and flame -- Remove flammable nodes and flame
minetest.register_abm({ minetest.register_abm({
nodenames = {"fire:basic_flame"}, nodenames = {"fire:basic_flame"},
interval = 1, interval = 3,
chance = 2, chance = 2,
action = function(p0, node, _, _) action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, remove flame -- If there is water or stuff like that around flame, remove flame
@ -183,3 +186,4 @@ minetest.register_abm({
end end
end, end,
}) })

View File

@ -1,68 +1,87 @@
minetest.register_on_generated(function(minp, maxp, seed) local function register_flower(name)
if maxp.y >= 2 and minp.y <= 0 then minetest.register_decoration({
-- Generate flowers deco_type = "simple",
local perlin1 = minetest.get_perlin(436, 3, 0.6, 100) place_on = {"default:dirt_with_grass"},
-- Assume X and Z lengths are equal sidelen = 16,
local divlen = 16 noise_params = {
local divs = (maxp.x-minp.x)/divlen+1; offset = 0,
for divx=0,divs-1 do scale = 0.006,
for divz=0,divs-1 do spread = {x=100, y=100, z=100},
local x0 = minp.x + math.floor((divx+0)*divlen) seed = 436,
local z0 = minp.z + math.floor((divz+0)*divlen) octaves = 3,
local x1 = minp.x + math.floor((divx+1)*divlen) persist = 0.6
local z1 = minp.z + math.floor((divz+1)*divlen) },
-- Determine flowers amount from perlin noise y_min = 1,
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9) y_max = 30,
-- Find random positions for flowers based on this random decoration = "flowers:"..name,
local pr = PseudoRandom(seed+456) })
for i=0,grass_amount do end
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.get_node({x = x, y = y, z = z}).name ~= "air" then
ground_y = y
break
end
end
if ground_y then function flowers.register_mgv6_decorations()
local p = {x = x, y = ground_y + 1, z = z} register_flower("rose")
local nn = minetest.get_node(p).name register_flower("tulip")
-- Check if the node can be replaced register_flower("dandelion_yellow")
if minetest.registered_nodes[nn] and register_flower("geranium")
minetest.registered_nodes[nn].buildable_to then register_flower("viola")
nn = minetest.get_node({x = x, y = ground_y, z = z}).name register_flower("dandelion_white")
if nn == "default:dirt_with_grass" then end
local flower_choice = pr:next(1, 6)
local flower minetest.register_decoration({
if flower_choice == 1 then deco_type = "simple",
flower = "flowers:tulip" place_on = {"default:water_source"},
elseif flower_choice == 2 then sidelen = 16,
flower = "flowers:rose" noise_params = {
elseif flower_choice == 3 then offset = 0,
flower = "flowers:dandelion_yellow" scale = 0.006,
elseif flower_choice == 4 then spread = {x=100, y=100, z=100},
flower = "flowers:dandelion_white" seed = 436,
elseif flower_choice == 5 then octaves = 3,
flower = "flowers:geranium" persist = 0.6
elseif flower_choice == 6 then },
flower = "flowers:viola" y_min = -10,
end y_max = 30,
minetest.set_node(p, {name = flower}) decoration = "flowers:lily_pad",
elseif nn == "default:water_source" then })
minetest.set_node(p, {name = "flowers:lily_pad"})
elseif nn == "default:sand" then minetest.register_decoration({
minetest.set_node(p, {name = "default:dry_shrub"}) deco_type = "simple",
elseif nn == "default:dirt_with_snow" then place_on = {"default:sand"},
minetest.set_node(p, {name = "default:snow"}) sidelen = 16,
end noise_params = {
end offset = 0,
end scale = 0.006,
spread = {x=100, y=100, z=100},
seed = 436,
octaves = 3,
persist = 0.6
},
y_min = -400,
y_max = 400,
decoration = "default:dry_shrub",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:snow"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.006,
spread = {x=100, y=100, z=100},
seed = 436,
octaves = 3,
persist = 0.6
},
y_min = -400,
y_max = 400,
decoration = "default:snow",
})
-- Enable in mapgen v6 only
local mg_params = minetest.get_mapgen_params()
if mg_params.mgname == "v6" then
flowers.register_mgv6_decorations()
end
end
end
end
end
end)

View File

@ -1,211 +0,0 @@
--
-- Helper functions
--
local function is_water(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
else
return i / math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = -math.sin(yaw) * v
local z = math.cos(yaw) * v
return {x = x, y = y, z = z}
end
local function get_v(v)
return math.sqrt(v.x ^ 2 + v.z ^ 2)
end
--
-- Boat entity
--
local boat = {
physical = true,
collisionbox = {-0.6, -0.4, -0.6, 0.6, 0.3, 0.6},
visual = "mesh",
mesh = "boat.x",
textures = {"default_wood.png"},
driver = nil,
v = 0,
last_v = 0,
removed = false
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
default.player_attached[name] = false
default.player_set_animation(clicker, "stand" , 30)
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
default.player_attached[name] = true
minetest.after(0.2, function()
default.player_set_animation(clicker, "sit" , 30)
end)
self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
end
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal = 1})
if staticdata then
self.v = tonumber(staticdata)
end
self.last_v = self.v
end
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
if not puncher or not puncher:is_player() or self.removed then
return
end
puncher:set_detach()
default.player_attached[puncher:get_player_name()] = false
self.removed = true
-- delay remove to ensure player is detached
minetest.after(0.1, function()
self.object:remove()
end)
if not minetest.setting_getbool("creative_mode") then
puncher:get_inventory():add_item("main", "boats:boat")
end
end
function boat.on_step(self, dtime)
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
local yaw = self.object:getyaw()
if ctrl.up then
self.v = self.v + 0.1
end
if ctrl.down then
self.v = self.v - 0.08
end
if ctrl.left then
if ctrl.down then
self.object:setyaw(yaw - (1 + dtime) * 0.03)
else
self.object:setyaw(yaw + (1 + dtime) * 0.03)
end
end
if ctrl.right then
if ctrl.down then
self.object:setyaw(yaw + (1 + dtime) * 0.03)
else
self.object:setyaw(yaw - (1 + dtime) * 0.03)
end
end
end
local velo = self.object:getvelocity()
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
return
end
local s = get_sign(self.v)
self.v = self.v - 0.02 * s
if s ~= get_sign(self.v) then
self.object:setvelocity({x = 0, y = 0, z = 0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5 * get_sign(self.v)
end
local p = self.object:getpos()
p.y = p.y - 0.5
local new_velo = {x = 0, y = 0, z = 0}
local new_acce = {x = 0, y = 0, z = 0}
if not is_water(p) then
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
if (not nodedef) or nodedef.walkable then
self.v = 0
new_acce = {x = 0, y = 1, z = 0}
else
new_acce = {x = 0, y = -9.8, z = 0} -- freefall in air -9.81
end
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
else
p.y = p.y + 1
if is_water(p) then
new_acce = {x = 0, y = 3, z = 0}
local y = self.object:getvelocity().y
if y > 2 then
y = 2
end
if y < 0 then
self.object:setacceleration({x = 0, y = 10, z = 0})
end
new_velo = get_velocity(self.v, self.object:getyaw(), y)
else
new_acce = {x = 0, y = 0, z = 0}
if math.abs(self.object:getvelocity().y) <= 2 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y) + 0.5
self.object:setpos(pos)
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
else
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
end
end
end
self.object:setvelocity(new_velo)
self.object:setacceleration(new_acce)
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = "boat_inventory.png",
wield_image = "boat_wield.png",
wield_scale = {x = 2, y = 2, z = 1},
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
if not is_water(pointed_thing.under) then
return
end
pointed_thing.under.y = pointed_thing.under.y + 0.5
minetest.add_entity(pointed_thing.under, "boats:boat")
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_craft({
output = "boats:boat",
recipe = {
{"", "", "" },
{"group:wood", "", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
},
})

View File

@ -290,11 +290,11 @@ stairs.register_stair_and_slab("stonebrick", "default:stonebrick",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
stairs.register_stair_and_slab("pinewood", "default:pinewood", stairs.register_stair_and_slab("pinewood", "default:pinewood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"default_pinewood.png"}, {"default_pinewood.png"},
"Pinewood Stair", "Pinewood Stair",
"Pinewood Slab", "Pinewood Slab",
default.node_sound_wood_defaults()) default.node_sound_wood_defaults())
stairs.register_stair_and_slab("obsidian", "default:obsidian", stairs.register_stair_and_slab("obsidian", "default:obsidian",
{cracky=1,level=2}, {cracky=1,level=2},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 263 B