Weather and minetest_game changes

master
D00Med 2017-07-02 13:13:00 +10:00
parent c0ee7689a5
commit bffab3e7dd
38 changed files with 890 additions and 383 deletions

View File

@ -0,0 +1 @@
enable_weather = true

View File

@ -109,15 +109,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'default:pick_gold',
recipe = {
{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'},
{'', 'group:stick', ''},
{'', 'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:pick_bronze',
recipe = {
@ -172,15 +163,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'default:shovel_gold',
recipe = {
{'default:gold_ingot'},
{'group:stick'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'default:shovel_bronze',
recipe = {
@ -235,15 +217,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'default:axe_gold',
recipe = {
{'default:gold_ingot', 'default:gold_ingot'},
{'default:gold_ingot', 'group:stick'},
{'', 'group:stick'},
}
})
minetest.register_craft({
output = 'default:axe_bronze',
recipe = {
@ -298,15 +271,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'default:axe_gold',
recipe = {
{'default:gold_ingot', 'default:gold_ingot'},
{'group:stick', 'default:gold_ingot'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_bronze',
recipe = {
@ -361,15 +325,6 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'default:sword_gold',
recipe = {
{'default:gold_ingot'},
{'default:gold_ingot'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'default:sword_bronze',
recipe = {
@ -437,12 +392,6 @@ 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 = {
@ -491,6 +440,31 @@ 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 = {
@ -540,34 +514,98 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:sandstone',
output = "default:sandstone",
recipe = {
{'group:sand', 'group:sand'},
{'group:sand', 'group:sand'},
{"default:sand", "default:sand"},
{"default:sand", "default: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'},
{"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"},
}
})
@ -627,11 +665,11 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:ladder_wood 3',
output = "default:ladder_wood 5",
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"},
}
})
@ -677,10 +715,19 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:meselamp 1',
output = 'default:meselamp',
recipe = {
{'', 'default:mese_crystal',''},
{'default:mese_crystal', 'default:glass', 'default:mese_crystal'},
{'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", ""},
}
})
@ -821,6 +868,12 @@ 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",
@ -938,6 +991,18 @@ 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

@ -77,8 +77,6 @@ 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)
@ -133,18 +131,17 @@ default.cool_lava = function(pos, node)
{pos = pos, max_hear_distance = 16, gain = 0.25})
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,
})
if minetest.settings:get_bool("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 = default.cool_lava,
})
end
--
-- optimized helper to put all items in an inventory into a drops list
@ -186,6 +183,9 @@ 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
@ -209,6 +209,9 @@ 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
@ -219,9 +222,7 @@ minetest.register_abm({
neighbors = {"group:sand"},
interval = 12,
chance = 83,
action = function(...)
default.grow_cactus(...)
end
action = default.grow_cactus
})
minetest.register_abm({
@ -230,9 +231,7 @@ minetest.register_abm({
neighbors = {"default:dirt", "default:dirt_with_grass"},
interval = 14,
chance = 71,
action = function(...)
default.grow_papyrus(...)
end
action = default.grow_papyrus
})
@ -283,7 +282,7 @@ function default.register_fence(name, def)
connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
{1/8,-5/16,-1/16,1/2,-3/16,1/16}},
},
connects_to = {"group:fence", "group:wood", "group:tree", "group:wall", "group:stone"},
connects_to = {"group:fence", "group:wood", "group:tree"},
inventory_image = fence_texture,
wield_image = fence_texture,
tiles = {def.texture},
@ -321,47 +320,65 @@ default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
end
end
-- 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
-- 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)
end
end
end
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)
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
end
end
-- Remove node
minetest.remove_node(pos)
minetest.check_for_falling(pos)
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
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
@ -512,3 +529,46 @@ 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

@ -0,0 +1,79 @@
# Blender v2.78 (sub 0) OBJ File: 'chest-open.blend'
# www.blender.org
o Top_Cube.002_None_Top_Cube.002_None_bottom
v -0.500000 0.408471 0.720970
v -0.500000 1.115578 0.013863
v -0.500000 0.894607 -0.207108
v -0.500000 0.187501 0.499999
v 0.500000 1.115578 0.013863
v 0.500000 0.408471 0.720970
v 0.500000 0.187501 0.499999
v 0.500000 0.894607 -0.207108
v -0.500000 0.187500 -0.500000
v -0.500000 -0.500000 -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.500000 -0.500000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 1.0000
vt 1.0000 0.6875
vt 0.0000 0.6875
vt 1.0000 1.0000
vt 0.0000 0.6875
vt 1.0000 0.6875
vt 1.0000 0.6875
vt 1.0000 0.0000
vt 0.0000 0.0000
vt 1.0000 0.6875
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 1.0000 0.6875
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.6875
vt 0.0000 0.6875
vt 0.0000 0.0000
vt 1.0000 0.5000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.5000
vt 0.0000 0.0000
vt 1.0000 0.0000
vn 0.0000 0.7071 0.7071
vn -0.0000 -1.0000 -0.0000
vn -1.0000 0.0000 0.0000
vn 1.0000 0.0000 -0.0000
vn 0.0000 -0.7071 0.7071
vn 0.0000 0.0000 1.0000
vn -0.0000 0.7071 -0.7071
vn -0.0000 0.0000 -1.0000
vn -0.0000 -0.7071 -0.7071
vn -0.0000 1.0000 -0.0000
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Top
s off
f 6/1/1 5/2/1 2/3/1 1/4/1
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Bottom
f 11/5/2 10/6/2 14/7/2 13/8/2
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Right-Left
f 1/9/3 2/10/3 3/11/3 4/12/3
f 5/13/4 6/1/4 7/14/4 8/15/4
f 4/12/3 9/16/3 10/17/3 11/18/3
f 12/19/4 7/14/4 13/8/4 14/20/4
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Back
f 6/21/5 1/9/5 4/12/5 7/22/5
f 7/22/6 4/12/6 11/18/6 13/23/6
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Front
f 2/10/7 5/24/7 8/25/7 3/11/7
f 9/16/8 12/26/8 14/27/8 10/17/8
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Inside
f 4/28/9 3/29/9 8/30/9 7/31/9
f 7/31/10 12/32/10 9/33/10 4/28/10

File diff suppressed because it is too large Load Diff

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.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

1
mods/weather/depends.txt Normal file
View File

@ -0,0 +1 @@
default

0
mods/weather/license.txt Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B