1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-28 20:56:02 +02:00

9 Commits

12 changed files with 398 additions and 49 deletions

View File

@ -27,16 +27,16 @@ Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors. See README.txt in each mod directory for information about other authors.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

View File

@ -62,7 +62,7 @@ minetest.register_tool("default:pick_steel", {
tool_capabilities = { tool_capabilities = {
max_drop_level=1, max_drop_level=1,
groupcaps={ groupcaps={
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2} cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=30, maxlevel=2}
} }
}, },
}) })
@ -105,7 +105,7 @@ minetest.register_tool("default:shovel_steel", {
tool_capabilities = { tool_capabilities = {
max_drop_level=1, max_drop_level=1,
groupcaps={ groupcaps={
crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=10, maxlevel=2} crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=30, maxlevel=2}
} }
}, },
}) })
@ -137,7 +137,7 @@ minetest.register_tool("default:axe_steel", {
tool_capabilities = { tool_capabilities = {
max_drop_level=1, max_drop_level=1,
groupcaps={ groupcaps={
choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2}, choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=30, maxlevel=2},
fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1} fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1}
} }
}, },
@ -705,7 +705,7 @@ minetest.register_node("default:stone", {
}) })
minetest.register_node("default:desert_stone", { minetest.register_node("default:desert_stone", {
description = "Desert stone", description = "Desert Stone",
tile_images = {"default_desert_stone.png"}, tile_images = {"default_desert_stone.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = {cracky=3},
@ -715,7 +715,7 @@ minetest.register_node("default:desert_stone", {
}) })
minetest.register_node("default:stone_with_coal", { minetest.register_node("default:stone_with_coal", {
description = "Stone with coal", description = "Coal Ore",
tile_images = {"default_stone.png^default_mineral_coal.png"}, tile_images = {"default_stone.png^default_mineral_coal.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = {cracky=3},
@ -724,7 +724,7 @@ minetest.register_node("default:stone_with_coal", {
}) })
minetest.register_node("default:stone_with_iron", { minetest.register_node("default:stone_with_iron", {
description = "Stone with iron", description = "Iron Ore",
tile_images = {"default_stone.png^default_mineral_iron.png"}, tile_images = {"default_stone.png^default_mineral_iron.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = {cracky=3},
@ -733,7 +733,7 @@ minetest.register_node("default:stone_with_iron", {
}) })
minetest.register_node("default:dirt_with_grass", { minetest.register_node("default:dirt_with_grass", {
description = "Dirt with grass", description = "Dirt with Grass",
tile_images = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, tile_images = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
is_ground_content = true, is_ground_content = true,
groups = {crumbly=3}, groups = {crumbly=3},
@ -744,7 +744,7 @@ minetest.register_node("default:dirt_with_grass", {
}) })
minetest.register_node("default:dirt_with_grass_footsteps", { minetest.register_node("default:dirt_with_grass_footsteps", {
description = "Dirt with grass and footsteps", description = "Dirt with Grass and Footsteps",
tile_images = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, tile_images = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
is_ground_content = true, is_ground_content = true,
groups = {crumbly=3}, groups = {crumbly=3},
@ -771,7 +771,7 @@ minetest.register_node("default:sand", {
}) })
minetest.register_node("default:desert_sand", { minetest.register_node("default:desert_sand", {
description = "Desert sand", description = "Desert Sand",
tile_images = {"default_desert_sand.png"}, tile_images = {"default_desert_sand.png"},
is_ground_content = true, is_ground_content = true,
groups = {sand=1, crumbly=3, falling_node=1}, groups = {sand=1, crumbly=3, falling_node=1},
@ -809,7 +809,7 @@ minetest.register_node("default:clay", {
}) })
minetest.register_node("default:brick", { minetest.register_node("default:brick", {
description = "Brick", description = "Brick Block",
tile_images = {"default_brick.png"}, tile_images = {"default_brick.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = {cracky=3},
@ -821,7 +821,7 @@ minetest.register_node("default:tree", {
description = "Tree", description = "Tree",
tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
is_ground_content = true, is_ground_content = true,
groups = {tree=1,snappy=2,choppy=2,oddly_breakable_by_hand=1,flammable=2}, groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -829,7 +829,7 @@ minetest.register_node("default:jungletree", {
description = "Jungle Tree", description = "Jungle Tree",
tile_images = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, tile_images = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
is_ground_content = true, is_ground_content = true,
groups = {tree=1,snappy=2,choppy=2,oddly_breakable_by_hand=1,flammable=2}, groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -924,7 +924,7 @@ minetest.register_node("default:fence_wood", {
type = "fixed", type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
}, },
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=2}, groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -961,16 +961,16 @@ minetest.register_node("default:ladder", {
--wall_bottom = = <default> --wall_bottom = = <default>
--wall_side = = <default> --wall_side = = <default>
}, },
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=2}, groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},
legacy_wallmounted = true, legacy_wallmounted = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
minetest.register_node("default:wood", { minetest.register_node("default:wood", {
description = "Wood", description = "Wooden Planks",
tile_images = {"default_wood.png"}, tile_images = {"default_wood.png"},
is_ground_content = true, is_ground_content = true,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -990,7 +990,7 @@ minetest.register_node("default:cloud", {
}) })
minetest.register_node("default:water_flowing", { minetest.register_node("default:water_flowing", {
description = "Water (flowing)", description = "Flowing Water",
inventory_image = minetest.inventorycube("default_water.png"), inventory_image = minetest.inventorycube("default_water.png"),
drawtype = "flowingliquid", drawtype = "flowingliquid",
tile_images = {"default_water.png"}, tile_images = {"default_water.png"},
@ -1013,7 +1013,7 @@ minetest.register_node("default:water_flowing", {
}) })
minetest.register_node("default:water_source", { minetest.register_node("default:water_source", {
description = "Water", description = "Water Source",
inventory_image = minetest.inventorycube("default_water.png"), inventory_image = minetest.inventorycube("default_water.png"),
drawtype = "liquid", drawtype = "liquid",
tile_images = {"default_water.png"}, tile_images = {"default_water.png"},
@ -1036,7 +1036,7 @@ minetest.register_node("default:water_source", {
}) })
minetest.register_node("default:lava_flowing", { minetest.register_node("default:lava_flowing", {
description = "Lava (flowing)", description = "Flowing Lava",
inventory_image = minetest.inventorycube("default_lava.png"), inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "flowingliquid", drawtype = "flowingliquid",
tile_images = {"default_lava.png"}, tile_images = {"default_lava.png"},
@ -1060,7 +1060,7 @@ minetest.register_node("default:lava_flowing", {
}) })
minetest.register_node("default:lava_source", { minetest.register_node("default:lava_source", {
description = "Lava", description = "Lava Source",
inventory_image = minetest.inventorycube("default_lava.png"), inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "liquid", drawtype = "liquid",
tile_images = {"default_lava.png"}, tile_images = {"default_lava.png"},
@ -1122,9 +1122,24 @@ minetest.register_node("default:sign_wall", {
--wall_bottom = <default> --wall_bottom = <default>
--wall_side = <default> --wall_side = <default>
}, },
groups = {choppy=2,dig_immediate=2,flammable=2}, groups = {choppy=2,dig_immediate=2},
legacy_wallmounted = true, legacy_wallmounted = true,
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_construct = function(pos)
--local n = minetest.env:get_node(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "hack:sign_text_input")
meta:set_string("infotext", "\"\"")
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
local meta = minetest.env:get_meta(pos)
fields.text = fields.text or ""
print((sender:get_player_name() or "").." wrote \""..fields.text..
"\" to sign at "..minetest.pos_to_string(pos))
meta:set_string("text", fields.text)
meta:set_string("infotext", '"'..fields.text..'"')
end,
}) })
minetest.register_node("default:chest", { minetest.register_node("default:chest", {
@ -1132,36 +1147,316 @@ minetest.register_node("default:chest", {
tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
metadata_name = "chest",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Chest")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in chest at "..minetest.pos_to_string(pos))
return minetest.node_metadata_inventory_move_allow_all(
pos, from_list, from_index, to_list, to_index, count, player)
end,
on_metadata_inventory_offer = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to chest at "..minetest.pos_to_string(pos))
return minetest.node_metadata_inventory_offer_allow_all(
pos, listname, index, stack, player)
end,
on_metadata_inventory_take = function(pos, listname, index, count, player)
minetest.log("action", player:get_player_name()..
" takes stuff from chest at "..minetest.pos_to_string(pos))
return minetest.node_metadata_inventory_take_allow_all(
pos, listname, index, count, player)
end,
}) })
local function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
end
return true
end
minetest.register_node("default:chest_locked", { minetest.register_node("default:chest_locked", {
description = "Locked Chest", description = "Locked Chest",
tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"}, "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
metadata_name = "locked_chest",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Locked Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Locked Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
local meta = minetest.env:get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return
end
minetest.log("action", player:get_player_name()..
" moves stuff in locked chest at "..minetest.pos_to_string(pos))
return minetest.node_metadata_inventory_move_allow_all(
pos, from_list, from_index, to_list, to_index, count, player)
end,
on_metadata_inventory_offer = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return stack
end
minetest.log("action", player:get_player_name()..
" moves stuff to locked chest at "..minetest.pos_to_string(pos))
return minetest.node_metadata_inventory_offer_allow_all(
pos, listname, index, stack, player)
end,
on_metadata_inventory_take = function(pos, listname, index, count, player)
local meta = minetest.env:get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return
end
minetest.log("action", player:get_player_name()..
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
return minetest.node_metadata_inventory_take_allow_all(
pos, listname, index, count, player)
end,
}) })
default.furnace_inactive_formspec =
"invsize[8,9;]"..
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
minetest.register_node("default:furnace", { minetest.register_node("default:furnace", {
description = "Furnace", description = "Furnace",
tile_images = {"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png", tile_images = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"}, "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
metadata_name = "furnace",
groups = {cracky=2}, groups = {cracky=2},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", default.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace")
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
})
minetest.register_node("default:furnace_active", {
description = "Furnace",
tile_images = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
paramtype2 = "facedir",
light_source = 8,
drop = "default:furnace",
groups = {cracky=2},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", default.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace");
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
})
function hacky_swap_node(pos,name)
local node = minetest.env:get_node(pos)
local meta = minetest.env:get_meta(pos)
local meta0 = meta:to_table()
if node.name == name then
return
end
node.name = name
local meta0 = meta:to_table()
minetest.env:set_node(pos,node)
meta = minetest.env:get_meta(pos)
meta:from_table(meta0)
end
minetest.register_abm({
nodenames = {"default:furnace","default:furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.env:get_meta(pos)
for i, name in ipairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time"
}) do
if meta:get_string(name) == "" then
meta:set_float(name, 0.0)
end
end
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local cooked = nil
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
meta:set_float("src_time", meta:get_float("src_time") + 1)
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
-- check if there's room for output in "dst" list
if inv:room_for_item("dst",cooked.item) then
-- Put result in "dst" list
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
srcstack = inv:get_stack("src", 1)
srcstack:take_item()
inv:set_stack("src", 1, srcstack)
else
print("Could not insert '"..cooked.item.."'")
end
meta:set_string("src_time", 0)
end
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Furnace active: "..percent.."%")
hacky_swap_node(pos,"default:furnace_active")
meta:set_string("formspec",
"invsize[8,9;]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]")
return
end
local fuel = nil
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
if fuellist then
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
if fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
hacky_swap_node(pos,"default:furnace")
meta:set_string("formspec", default.furnace_inactive_formspec)
return
end
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext","Furnace is empty")
hacky_swap_node(pos,"default:furnace")
meta:set_string("formspec", default.furnace_inactive_formspec)
end
return
end
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
local stack = inv:get_stack("fuel", 1)
stack:take_item()
inv:set_stack("fuel", 1, stack)
end,
}) })
minetest.register_node("default:cobble", { minetest.register_node("default:cobble", {
description = "Cobble", description = "Cobblestone",
tile_images = {"default_cobble.png"}, tile_images = {"default_cobble.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = {cracky=3},
@ -1169,7 +1464,7 @@ minetest.register_node("default:cobble", {
}) })
minetest.register_node("default:mossycobble", { minetest.register_node("default:mossycobble", {
description = "Mossy Cobble", description = "Mossy Cobblestone",
tile_images = {"default_mossycobble.png"}, tile_images = {"default_mossycobble.png"},
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = {cracky=3},
@ -1185,7 +1480,7 @@ minetest.register_node("default:steelblock", {
}) })
minetest.register_node("default:nyancat", { minetest.register_node("default:nyancat", {
description = "Nyancat", description = "Nyan Cat",
tile_images = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png", tile_images = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
"default_nc_side.png", "default_nc_back.png", "default_nc_front.png"}, "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
inventory_image = "default_nc_front.png", inventory_image = "default_nc_front.png",
@ -1196,7 +1491,7 @@ minetest.register_node("default:nyancat", {
}) })
minetest.register_node("default:nyancat_rainbow", { minetest.register_node("default:nyancat_rainbow", {
description = "Nyancat Rainbow", description = "Nyan Cat Rainbow",
tile_images = {"default_nc_rb.png"}, tile_images = {"default_nc_rb.png"},
inventory_image = "default_nc_rb.png", inventory_image = "default_nc_rb.png",
groups = {cracky=2}, groups = {cracky=2},
@ -1267,33 +1562,33 @@ minetest.register_craftitem("default:book", {
}) })
minetest.register_craftitem("default:coal_lump", { minetest.register_craftitem("default:coal_lump", {
description = "Lump of coal", description = "Coal Lump",
inventory_image = "default_coal_lump.png", inventory_image = "default_coal_lump.png",
}) })
minetest.register_craftitem("default:iron_lump", { minetest.register_craftitem("default:iron_lump", {
description = "Lump of iron", description = "Iron Lump",
inventory_image = "default_iron_lump.png", inventory_image = "default_iron_lump.png",
}) })
minetest.register_craftitem("default:clay_lump", { minetest.register_craftitem("default:clay_lump", {
description = "Lump of clay", description = "Clay Lump",
inventory_image = "default_clay_lump.png", inventory_image = "default_clay_lump.png",
}) })
minetest.register_craftitem("default:steel_ingot", { minetest.register_craftitem("default:steel_ingot", {
description = "Steel ingot", description = "Steel Ingot",
inventory_image = "default_steel_ingot.png", inventory_image = "default_steel_ingot.png",
}) })
minetest.register_craftitem("default:clay_brick", { minetest.register_craftitem("default:clay_brick", {
description = "Clay brick", description = "Clay Brick",
inventory_image = "default_steel_ingot.png", inventory_image = "default_steel_ingot.png",
inventory_image = "default_clay_brick.png", inventory_image = "default_clay_brick.png",
}) })
minetest.register_craftitem("default:scorched_stuff", { minetest.register_craftitem("default:scorched_stuff", {
description = "Scorched stuff", description = "Scorched Stuff",
inventory_image = "default_scorched_stuff.png", inventory_image = "default_scorched_stuff.png",
}) })

View File

@ -29,7 +29,7 @@ minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
-- Ore generation -- Ore generation
-- --
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max) local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
if maxp.y < height_min or minp.y > height_max then if maxp.y < height_min or minp.y > height_max then
return return
end end
@ -38,10 +38,6 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed) local pr = PseudoRandom(seed)
local num_chunks = math.floor(chunks_per_volume * volume) 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) local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
--print("generate_ore num_chunks: "..dump(num_chunks)) --print("generate_ore num_chunks: "..dump(num_chunks))
for i=1,num_chunks do for i=1,num_chunks do
@ -84,11 +80,66 @@ function default.make_cactus(pos, size)
end end
end end
-- facedir: 0/1/2/3 (head node facedir value)
-- length: length of rainbow tail
function default.make_nyancat(pos, facedir, length)
local tailvec = {x=0, y=0, z=0}
if facedir == 0 then
tailvec.z = 1
elseif facedir == 1 then
tailvec.x = 1
elseif facedir == 2 then
tailvec.z = -1
elseif facedir == 3 then
tailvec.x = -1
else
print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
facedir = 0
tailvec.z = 1
end
local p = {x=pos.x, y=pos.y, z=pos.z}
minetest.env:set_node(p, {name="default:nyancat", param2=facedir})
for i=1,length do
p.x = p.x + tailvec.x
p.z = p.z + tailvec.z
minetest.env:set_node(p, {name="default:nyancat_rainbow"})
end
end
function generate_nyancats(seed, minp, maxp)
local height_min = -31000
local height_max = -32
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 + 9324342)
local max_num_nyancats = math.floor(volume / (16*16*16))
for i=1,max_num_nyancats do
if pr:next(0, 1000) == 0 then
local x0 = pr:next(minp.x, maxp.x)
local y0 = pr:next(minp.y, maxp.y)
local z0 = pr:next(minp.z, maxp.z)
local p0 = {x=x0, y=y0, z=z0}
default.make_nyancat(p0, pr:next(0,3), pr:next(3,15))
end
end
end
minetest.register_on_generated(function(minp, maxp, seed) minetest.register_on_generated(function(minp, maxp, seed)
generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed, 1/8/8/8, 5, -31000, 64) -- Generate regular ores
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/16/16/16, 5, -5, 7) generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+0, 1/8/8/8, 3, 8, -31000, 64)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/12/12/12, 5, -16, -5) generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/12/12/12, 2, 3, -15, 2)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/9/9/9, 5, -31000, -17) generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/9/9/9, 3, 5, -63, -16)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/7/7/7, 3, 5, -31000, -64)
generate_ore("default:mese", "default:stone", minp, maxp, seed+4, 1/16/16/16, 2, 3, -127, -64)
generate_ore("default:mese", "default:stone", minp, maxp, seed+5, 1/9/9/9, 3, 5, -31000,-128)
generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+7, 1/24/24/24, 6,27, -31000, 0)
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+6, 1/24/24/24, 6,27, -31000, -64)
if maxp.y >= 2 and minp.y <= 0 then if maxp.y >= 2 and minp.y <= 0 then
-- Generate clay -- Generate clay
-- Assume X and Z lengths are equal -- Assume X and Z lengths are equal
@ -217,5 +268,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
end end
end end
-- Generate nyan cats
generate_nyancats(seed, minp, maxp)
end) end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 483 B

View File

@ -11,7 +11,7 @@ Original license text:
There has been unsuccesful attempts to contact the original author. Thus, 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 based on the intentions of the author, it is assumed that this code is
distributable and modifiable under GPLv2+later, under which Minetest is distributable and modifiable under LGPLv2+later, under which Minetest is
distributed. distributed.
Modifications: Modifications: