all updated to "minetest game"

master
Victor Hackeridze 2012-04-02 06:23:18 +06:00
parent 87ba4eaaeb
commit 386ee495dd
87 changed files with 560 additions and 47 deletions

26
new_api/bucket/README.txt Normal file
View File

@ -0,0 +1,26 @@
Minetest 0.4 mod: bucket
=========================
License of source code:
-----------------------
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/gpl-2.0.html
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>

View File

@ -1,5 +1,5 @@
-- bucket (Minetest 0.4 mod)
-- A bucket, which can pick up water and lava
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")

View File

@ -0,0 +1,64 @@
Minetest 0.4 mod: default
==========================
License of source code:
-----------------------
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/gpl-2.0.html
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
Originating from work by kddekadenz/Dogers:
default_grass_footstep.{1,2,3}.ogg
default_dig_crumbly.{1,2}.ogg
Cisoun's WTFPL texture pack:
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_cobble.png
default_dirt.png
default_grass.png
default_grass_side.png
default_jungletree.png
default_jungletree_top.png
default_lava.png
default_leaves.png
default_mossycobble.png
default_sand.png
default_sapling.png
default_sign_wall.png
default_stone.png
default_tool_mesepick.png
default_tool_steelpick.png
default_tool_steelshovel.png
default_tool_steelsword.png
default_tool_stonepick.png
default_tool_stoneshovel.png
default_tool_woodpick.png
default_tool_woodshovel.png
default_tree.png
default_tree_top.png
default_water.png
Originating from G4JC's Almost MC Texture Pack:
default_wood.png
default_torch.png
default_torch_on_ceiling.png
default_torch_on_floor.png

View File

@ -1,5 +1,5 @@
-- default (Minetest 0.4 mod)
-- Most default stuff
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
-- The API documentation in here was moved into doc/lua_api.txt
@ -11,6 +11,10 @@ LIGHT_MAX = 14
-- Definitions made by this mod that other mods can use too
default = {}
-- Load other files
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/leafdecay.lua")
--
-- Tool definition
--
@ -48,7 +52,7 @@ minetest.register_tool("default:pick_stone", {
tool_capabilities = {
max_drop_level=0,
groupcaps={
cracky={times={[1]=2.00, [2]=1.20, [3]=0.80}, uses=20, maxlevel=1}
cracky={times={[1]=3.00, [2]=1.20, [3]=0.80}, uses=20, maxlevel=1}
}
},
})
@ -72,7 +76,7 @@ minetest.register_tool("default:pick_mese", {
cracky={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3},
crumbly={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3},
snappy={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3},
fastness={times={[1]=25.0, [2]=19.0, [3]=13}, uses=10, maxlevel=3} -- fastness group for obsidian
snappy={fastness={[1]=25.0, [2]=19.0, [3]=13.5}, uses=10, maxlevel=3}
}
},
})
@ -82,7 +86,7 @@ minetest.register_tool("default:shovel_wood", {
tool_capabilities = {
max_drop_level=0,
groupcaps={
crumbly={times={[1]=2.00, [2]=0.80, [3]=0.50}, uses=10, maxlevel=1}
crumbly={times={[1]=3.00, [2]=0.80, [3]=0.50}, uses=10, maxlevel=1}
}
},
})
@ -92,7 +96,7 @@ minetest.register_tool("default:shovel_stone", {
tool_capabilities = {
max_drop_level=0,
groupcaps={
crumbly={times={[1]=1.20, [2]=0.50, [3]=0.30}, uses=20, maxlevel=1}
crumbly={times={[1]=1.50, [2]=0.50, [3]=0.30}, uses=20, maxlevel=1}
}
},
})
@ -102,7 +106,7 @@ minetest.register_tool("default:shovel_steel", {
tool_capabilities = {
max_drop_level=1,
groupcaps={
crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=10, maxlevel=2}
crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=10, maxlevel=2}
}
},
})
@ -123,7 +127,7 @@ minetest.register_tool("default:axe_stone", {
tool_capabilities = {
max_drop_level=0,
groupcaps={
choppy={times={[1]=1.50, [2]=1.00, [3]=0.60}, uses=20, maxlevel=1},
choppy={times={[1]=3.00, [2]=1.00, [3]=0.60}, uses=20, maxlevel=1},
fleshy={times={[2]=1.30, [3]=0.70}, uses=20, maxlevel=1}
}
},
@ -134,7 +138,7 @@ minetest.register_tool("default:axe_steel", {
tool_capabilities = {
max_drop_level=1,
groupcaps={
choppy={times={[1]=2.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2},
choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2},
fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1}
}
},
@ -460,18 +464,6 @@ minetest.register_craft({
recipe = "default:sand",
})
minetest.register_craft({
type = "cooking",
output = "default:coal_lump",
recipe = "default:tree",
})
minetest.register_craft({
type = "cooking",
output = "default:coal_lump",
recipe = "default:jungletree",
})
minetest.register_craft({
type = "cooking",
output = "default:stone",
@ -806,7 +798,7 @@ minetest.register_node("default:tree", {
description = "Tree",
tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
is_ground_content = true,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=1},
groups = {tree=1,snappy=2,choppy=2,oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
@ -814,7 +806,7 @@ minetest.register_node("default:jungletree", {
description = "Jungle Tree",
tile_images = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
is_ground_content = true,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=1},
groups = {tree=1,snappy=2,choppy=2,oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
@ -837,7 +829,7 @@ minetest.register_node("default:leaves", {
visual_scale = 1.3,
tile_images = {"default_leaves.png"},
paramtype = "light",
groups = {snappy=3},
groups = {snappy=3, leafdecay=3},
drop = {
max_items = 1,
items = {
@ -963,7 +955,7 @@ minetest.register_node("default:mese", {
description = "Mese",
tile_images = {"default_mese.png"},
is_ground_content = true,
groups = {cracky=1,level=2},
groups = {cracky=1},
sounds = default.node_sound_defaults(),
})
@ -1300,7 +1292,8 @@ minetest.add_to_creative_inventory('default:lava_source')
minetest.add_to_creative_inventory('default:ladder')
--
-- Aliases for the current map generator outputs
-- Aliases for map generator outputs
-- (required at least by an in-development branch)
--
minetest.register_alias("mapgen_air", "air")
@ -1524,11 +1517,4 @@ minetest.register_on_chat_message(function(name, message)
end
end)
--
-- Done, print some random stuff
--
--print("minetest.registered_entities:")
--dump2(minetest.registered_entities)
-- END

View File

@ -0,0 +1,104 @@
-- minetest/default/leafdecay.lua
-- 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.
default.leafdecay_trunk_cache = {}
default.leafdecay_enable_cache = true
-- Spread the load of finding trunks
default.leafdecay_trunk_find_allow_accumulator = 0
minetest.register_globalstep(function(dtime)
local finds_per_second = 5000
default.leafdecay_trunk_find_allow_accumulator =
math.floor(dtime * finds_per_second)
end)
minetest.register_abm({
nodenames = {"group:leafdecay"},
neighbors = {"air", "group:liquid"},
-- A low interval and a high inverse chance spreads the load
interval = 2,
chance = 5,
action = function(p0, node, _, _)
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
local do_preserve = false
local d = minetest.registered_nodes[node.name].groups.leafdecay
if not d or d == 0 then
--print("not groups.leafdecay")
return
end
local n0 = minetest.env:get_node(p0)
if n0.param2 ~= 0 then
--print("param2 ~= 0")
return
end
local p0_hash = nil
if default.leafdecay_enable_cache then
p0_hash = minetest.hash_node_position(p0)
local trunkp = default.leafdecay_trunk_cache[p0_hash]
if trunkp then
local n = minetest.env:get_node(trunkp)
local reg = minetest.registered_nodes[n.name]
-- Assume ignore is a trunk, to make the thing work at the border of the active area
if n.name == "ignore" or (reg.groups.tree and reg.groups.tree ~= 0) then
--print("cached trunk still exists")
return
end
--print("cached trunk is invalid")
-- Cache is invalid
table.remove(default.leafdecay_trunk_cache, p0_hash)
end
end
if default.leafdecay_trunk_find_allow_accumulator <= 0 then
return
end
default.leafdecay_trunk_find_allow_accumulator =
default.leafdecay_trunk_find_allow_accumulator - 1
for dx = -d, d do if do_preserve then break end
for dy = -d, d do if do_preserve then break end
for dz = -d, d do if do_preserve then break end
local p = {
x = p0.x + dx,
y = p0.y + dy,
z = p0.z + dz,
}
local n = minetest.env:get_node(p)
local reg = minetest.registered_nodes[n.name]
-- Assume ignore is a trunk, to make the thing work at the border of the active area
if n.name == "ignore" or (reg.groups.tree and reg.groups.tree ~= 0) then
do_preserve = true
if default.leafdecay_enable_cache then
--print("caching trunk")
-- Cache the trunk
default.leafdecay_trunk_cache[p0_hash] = p
end
end
end
end
end
if not do_preserve then
-- Drop stuff other than the node itself
itemstacks = minetest.get_node_drops(n0.name)
for _, itemname in ipairs(itemstacks) do
if itemname ~= n0.name then
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.env:add_item(p_drop, itemname)
end
end
-- Remove node
minetest.env:remove_node(p0)
end
end
})

View File

@ -0,0 +1,87 @@
-- minetest/default/mapgen.lua
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max)
if maxp.y < height_min or minp.y > height_max then
return
end
local y_min = math.max(minp.y, height_min)
local y_max = math.min(maxp.y, height_max)
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed)
local num_chunks = math.floor(chunks_per_volume * volume)
local chunk_size = 3
if ore_per_chunk <= 4 then
chunk_size = 2
end
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
--print("generate_ore num_chunks: "..dump(num_chunks))
for i=1,num_chunks do
local y0 = pr:next(y_min, y_max-chunk_size+1)
if y0 >= height_min and y0 <= height_max then
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
local p0 = {x=x0, y=y0, z=z0}
for x1=0,chunk_size-1 do
for y1=0,chunk_size-1 do
for z1=0,chunk_size-1 do
if pr:next(1,inverse_chance) == 1 then
local x2 = x0+x1
local y2 = y0+y1
local z2 = z0+z1
local p2 = {x=x2, y=y2, z=z2}
if minetest.env:get_node(p2).name == wherein then
minetest.env:set_node(p2, {name=name})
end
end
end
end
end
end
end
--print("generate_ore done")
end
minetest.register_on_generated(function(minp, maxp, seed)
generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed, 1/8/8/8, 5, -64, 64)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/16/16/16, 5, 3, 7)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/12/12/12, 5, -16, 2)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/9/9/9, 5, -64, -17)
-- Generate clay
if maxp.y >= 2 and minp.y <= 0 then
-- Assume X and Z lengths are equal
local divlen = 4
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0+1,divs-1-1 do
for divz=0+1,divs-1-1 do
local cx = minp.x + math.floor((divx+0.5)*divlen)
local cz = minp.z + math.floor((divz+0.5)*divlen)
if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then
local is_shallow = true
local num_water_around = 0
if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if num_water_around >= 2 then
is_shallow = false
end
if is_shallow then
for x1=-divlen,divlen do
for z1=-divlen,divlen do
if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
end
end
end
end
end
end
end
end
end)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 853 B

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 384 B

43
new_api/doors/README.txt Normal file
View File

@ -0,0 +1,43 @@
Minetest 0.4 mod: doors
========================
License of source code:
-----------------------
Original license text:
-- (c) 2011 Fernando Zapata
-- Code licensed under GNU GPLv3
-- Content licensed under CC BY-SA 3.0
-- 2012-01-08 11:03:57
There has been unsuccesful attempts to contact the original author. Thus,
based on the intentions of the author, it is assumed that this code is
distributable and modifiable under GPLv2+later, under which Minetest is
distributed.
Modifications:
Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/gpl-2.0.html
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
From the original zlpdoors mod by Fernando Zapata:
door_wood_a.png
door_wood_a_r.png
door_wood_b.png
door_wood_b_r.png
door_wood.png

View File

@ -0,0 +1 @@
default

205
new_api/doors/init.lua Normal file
View File

@ -0,0 +1,205 @@
-- Minetest 0.4 mod: doors
-- See README.txt for licensing and other information.
--------------------------------------------------------------------------------
local WALLMX = 3
local WALLMZ = 5
local WALLPX = 2
local WALLPZ = 4
--------------------------------------------------------------------------------
minetest.register_alias('door', 'doors:door_wood')
minetest.register_alias('door_wood', 'doors:door_wood')
minetest.register_node( 'doors:door_wood', {
description = 'Wooden Door',
drawtype = 'signlike',
tile_images = { 'door_wood.png' },
inventory_image = 'door_wood.png',
wield_image = 'door_wood.png',
paramtype2 = 'wallmounted',
selection_box = { type = 'wallmounted' },
groups = { choppy=2, dig_immediate=2 },
})
minetest.register_craft( {
output = 'doors:door_wood',
recipe = {
{ 'default:wood', 'default:wood' },
{ 'default:wood', 'default:wood' },
{ 'default:wood', 'default:wood' },
},
})
minetest.register_craft({
type = 'fuel',
recipe = 'doors:door_wood',
burntime = 30,
})
minetest.register_node( 'doors:door_wood_a_c', {
Description = 'Top Closed Door',
drawtype = 'signlike',
tile_images = { 'door_wood_a.png' },
inventory_image = 'door_wood_a.png',
paramtype = 'light',
paramtype2 = 'wallmounted',
walkable = true,
selection_box = { type = "wallmounted", },
groups = { choppy=2, dig_immediate=2 },
legacy_wallmounted = true,
drop = 'doors:door_wood',
})
minetest.register_node( 'doors:door_wood_b_c', {
Description = 'Bottom Closed Door',
drawtype = 'signlike',
tile_images = { 'door_wood_b.png' },
inventory_image = 'door_wood_b.png',
paramtype = 'light',
paramtype2 = 'wallmounted',
walkable = true,
selection_box = { type = "wallmounted", },
groups = { choppy=2, dig_immediate=2 },
legacy_wallmounted = true,
drop = 'doors:door_wood',
})
minetest.register_node( 'doors:door_wood_a_o', {
Description = 'Top Open Door',
drawtype = 'signlike',
tile_images = { 'door_wood_a_r.png' },
inventory_image = 'door_wood_a_r.png',
paramtype = 'light',
paramtype2 = 'wallmounted',
walkable = false,
selection_box = { type = "wallmounted", },
groups = { choppy=2, dig_immediate=2 },
legacy_wallmounted = true,
drop = 'doors:door_wood',
})
minetest.register_node( 'doors:door_wood_b_o', {
Description = 'Bottom Open Door',
drawtype = 'signlike',
tile_images = { 'door_wood_b_r.png' },
inventory_image = 'door_wood_b_r.png',
paramtype = 'light',
paramtype2 = 'wallmounted',
walkable = false,
selection_box = { type = "wallmounted", },
groups = { choppy=2, dig_immediate=2 },
legacy_wallmounted = true,
drop = 'doors:door_wood',
})
--------------------------------------------------------------------------------
local round = function( n )
if n >= 0 then
return math.floor( n + 0.5 )
else
return math.ceil( n - 0.5 )
end
end
local on_door_placed = function( pos, node, placer )
if node.name ~= 'doors:door_wood' then return end
upos = { x = pos.x, y = pos.y - 1, z = pos.z }
apos = { x = pos.x, y = pos.y + 1, z = pos.z }
und = minetest.env:get_node( upos )
abv = minetest.env:get_node( apos )
dir = placer:get_look_dir()
if round( dir.x ) == 1 then
newparam = WALLMX
elseif round( dir.x ) == -1 then
newparam = WALLPX
elseif round( dir.z ) == 1 then
newparam = WALLMZ
elseif round( dir.z ) == -1 then
newparam = WALLPZ
end
if und.name == 'air' then
minetest.env:add_node( pos, { name = 'doors:door_wood_a_c', param2 = newparam } )
minetest.env:add_node( upos, { name = 'doors:door_wood_b_c', param2 = newparam } )
elseif abv.name == 'air' then
minetest.env:add_node( pos, { name = 'doors:door_wood_b_c', param2 = newparam } )
minetest.env:add_node( apos, { name = 'doors:door_wood_a_c', param2 = newparam } )
else
minetest.env:remove_node( pos )
placer:get_inventory():add_item( "main", 'doors:door_wood' )
minetest.chat_send_player( placer:get_player_name(), 'not enough space' )
end
end
local on_door_punched = function( pos, node, puncher )
if string.find( node.name, 'doors:door_wood' ) == nil then return end
upos = { x = pos.x, y = pos.y - 1, z = pos.z }
apos = { x = pos.x, y = pos.y + 1, z = pos.z }
if string.find( node.name, '_c', -2 ) ~= nil then
if node.param2 == WALLPX then
newparam = WALLMZ
elseif node.param2 == WALLMZ then
newparam = WALLMX
elseif node.param2 == WALLMX then
newparam = WALLPZ
elseif node.param2 == WALLPZ then
newparam = WALLPX
end
elseif string.find( node.name, '_o', -2 ) ~= nil then
if node.param2 == WALLMZ then
newparam = WALLPX
elseif node.param2 == WALLMX then
newparam = WALLMZ
elseif node.param2 == WALLPZ then
newparam = WALLMX
elseif node.param2 == WALLPX then
newparam = WALLPZ
end
end
if ( node.name == 'doors:door_wood_a_c' ) then
minetest.env:add_node( pos, { name = 'doors:door_wood_a_o', param2 = newparam } )
minetest.env:add_node( upos, { name = 'doors:door_wood_b_o', param2 = newparam } )
elseif ( node.name == 'doors:door_wood_b_c' ) then
minetest.env:add_node( pos, { name = 'doors:door_wood_b_o', param2 = newparam } )
minetest.env:add_node( apos, { name = 'doors:door_wood_a_o', param2 = newparam } )
elseif ( node.name == 'doors:door_wood_a_o' ) then
minetest.env:add_node( pos, { name = 'doors:door_wood_a_c', param2 = newparam } )
minetest.env:add_node( upos, { name = 'doors:door_wood_b_c', param2 = newparam } )
elseif ( node.name == 'doors:door_wood_b_o' ) then
minetest.env:add_node( pos, { name = 'doors:door_wood_b_c', param2 = newparam } )
minetest.env:add_node( apos, { name = 'doors:door_wood_a_c', param2 = newparam } )
end
end
local on_door_digged = function( pos, node, digger )
upos = { x = pos.x, y = pos.y - 1, z = pos.z }
apos = { x = pos.x, y = pos.y + 1, z = pos.z }
if ( node.name == 'doors:door_wood_a_c' ) or ( node.name == 'doors:door_wood_a_o' ) then
minetest.env:remove_node( upos )
elseif ( node.name == 'doors:door_wood_b_c' ) or ( node.name == 'doors:door_wood_b_o' ) then
minetest.env:remove_node( apos )
end
end
--------------------------------------------------------------------------------
minetest.register_on_placenode( on_door_placed )
minetest.register_on_punchnode( on_door_punched )
minetest.register_on_dignode( on_door_digged )
--------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

View File

@ -1,15 +1,12 @@
minetest.register_on_newplayer(function(player)
print("[minimal] giving initial stuff to player")
player:get_inventory():add_item('main', 'default:pick_stone')
player:get_inventory():add_item('main', 'default:torch 99')
player:get_inventory():add_item('main', 'default:cobble 99')
player:get_inventory():add_item('main', 'default:wood 99')
player:get_inventory():add_item('main', 'default:axe_steel')
player:get_inventory():add_item('main', 'default:shovel_steel')
player:get_inventory():add_item('main', 'default:pick_wood')
player:get_inventory():add_item('main', 'default:pick_steel')
player:get_inventory():add_item('main', 'default:pick_mese')
player:get_inventory():add_item('main', 'default:mese 99')
player:get_inventory():add_item('main', 'default:water_source 99')
print("on_newplayer")
if minetest.setting_getbool("give_initial_stuff") then
print("giving give_initial_stuff to player")
player:get_inventory():add_item('main', 'default:pick_steel')
player:get_inventory():add_item('main', 'default:torch 99')
player:get_inventory():add_item('main', 'default:axe_steel')
player:get_inventory():add_item('main', 'default:shovel_steel')
player:get_inventory():add_item('main', 'default:cobble 99')
end
end)