initial commit

subgame + mods
This commit is contained in:
Ombridride 2014-10-28 18:01:32 +01:00
parent baab1b3f7c
commit 232b274c55
6451 changed files with 226156 additions and 0 deletions

7
minetestforfun_game/.gitignore vendored Executable file
View File

@ -0,0 +1,7 @@
## Generic ignorable patterns and files
*~
.*.swp
*bak*
tags
*.vim

52
minetestforfun_game/README.txt Executable file
View File

@ -0,0 +1,52 @@
The main game for the Minetest game engine [minetest_game]
==========================================================
To use this game with Minetest, insert this repository as
/games/minetest_game
in the Minetest Engine.
The Minetest Engine can be found in:
https://github.com/minetest/minetest/
Compatibility
--------------
The minetest_game github master HEAD is generally compatible with the github
master HEAD of minetest.
Additionally, when the minetest engine is tagged to be a certain version (eg.
0.4.10), minetest_game is tagged with the version too.
When stable releases are made, minetest_game is packaged and made available in
http://minetest.net/download.php
and in case the repository has grown too much, it may be reset. In that sense,
this is not a "real" git repository. (Package maintainers please note!)
License of source code
----------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
License of media (textures and sounds)
--------------------------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
License of menu/header.png
Copyright (C) 2013 BlockMen CC BY-3.0

1
minetestforfun_game/game.conf Executable file
View File

@ -0,0 +1 @@
name = minetestforfun_game

199
minetestforfun_game/game_api.txt Executable file
View File

@ -0,0 +1,199 @@
minetest_game API
======================
GitHub Repo: https://github.com/minetest/minetest_game
Introduction
------------
The minetest_game gamemode offers multiple new possibilities in addition to Minetest's built-in API, allowing you to
add new plants to farming mod, buckets for new liquids, new stairs and custom panes.
For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
Please note:
[XYZ] refers to a section the Minetest API
[#ABC] refers to a section in this document
^ Explanation for line above
Bucket API
----------
The bucket API allows registering new types of buckets for non-default liquids.
bucket.register_liquid(
"default:lava_source", -- Source node name
"default:lava_flowing", -- Flowing node name
"bucket:bucket_lava", -- Name to be used for bucket
"bucket_lava.png", -- Bucket texture (for wielditem and inventory_image)
"Lava Bucket" -- Bucket description
)
Doors API
---------
The doors mod allows modders to register custom doors.
doors.register_door(name, def)
^ name: "Door name"
^ def: See [#Door definition]
#Door definition
----------------
{
description = "Door description",
inventory_image = "mod_door_inv.png",
groups = {group = 1},
tiles_bottom: [Tile definition],
^ the tiles of the bottom part of the door {front, side}
tiles_top: [Tile definition],
^ the tiles of the bottom part of the door {front, side}
node_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
node_box_top = regular nodebox, see [Node boxes], OPTIONAL,
selection_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
selection_box_top = regular nodebox, see [Node boxes], OPTIONAL,
only_placer_can_open = true/false,
^ If true, only placer can open the door (locked for others)
}
Farming API
-----------
The farming API allows you to easily register plants and hoes.
farming.register_hoe(name, hoe definition)
-> Register a new hoe, see [#hoe definition]
farming.register_plant(name, Plant definition)
-> Register a new growing plant, see [#Plant definition]
#Hoe Definition
---------------
{
description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
max_uses = 30, -- Uses until destroyed
recipe = { -- Craft recipe
{"air", "air", "air"},
{"", "group:stick"},
{"", "group:stick"},
}
}
#Plant definition
-----------------
{
description = "", -- Description of seed item
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
steps = 8, -- How many steps the plant has to grow, until it can be harvested
^ Always provide a plant texture for ech step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum light to grow
maxlight = LIGHT_MAX -- Maximum light to grow
}
Stairs API
----------
The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those
delivered with minetest_game, to keep them compatible with other mods.
stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
-> Registers a stair.
-> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
-> recipeitem: Item used in the craft recipe, e.g. "default:cobble"
-> groups: see [Known damage and digging time defining groups]
-> images: see [Tile definition]
-> description: used for the description field in the stair's definition
-> sounds: see [#Default sounds]
stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
-> Registers a slabs
-> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
-> recipeitem: Item used in the craft recipe, e.g. "default:cobble"
-> groups: see [Known damage and digging time defining groups]
-> images: see [Tile definition]
-> description: used for the description field in the stair's definition
-> sounds: see [#Default sounds]
stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
-> A wrapper for stairs.register_stair and stairs.register_slab
-> Uses almost the same arguments as stairs.register_stair
-> desc_stair: Description for stair node
-> desc_slab: Description for slab node
Xpanes API
----------
Creates panes that automatically connect to each other
xpanes.register_pane(subname, def)
-> subname: used for nodename. Result: "xpanes:subname_{1..16}"
-> def: See [#Pane definition]
#Pane definition
----------------
{
textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"},
^ More tiles aren't supported
groups = {group = rating},
^ Uses the known node groups, see [Known damage and digging time defining groups]
sounds = SoundSpec,
^ See [#Default sounds]
recipe = {{"","","","","","","","",""}},
^ Recipe field only
on_construct = function(pos)
update_pane(pos, "pane")
end,
^ Required to handle rotation correctly
}
Default sounds
--------------
Sounds inside the default table can be used within the sounds field of node definitions.
default.node_sound_defaults()
default.node_sound_stone_defaults()
default.node_sound_dirt_defaults()
default.node_sound_sand_defaults()
default.node_sound_wood_defaults()
default.node_sound_leaves_defaults()
default.node_sound_glass_defaults()
Player API
----------
The player API can register player models and update the player's appearence
default.player_register_model(name, def)
^ Register a new model to be used by players.
-> name: model filename such as "character.x", "foo.b3d", etc.
-> def: See [#Model definition]
default.registered_player_models[name]
^ Get a model's definition
-> see [#Model definition]
default.player_set_model(player, model_name)
^ Change a player's model
-> player: PlayerRef
-> model_name: model registered with player_register_model()
default.player_set_animation(player, anim_name [, speed])
^ Applies an animation to a player
-> anim_name: name of the animation.
-> speed: frames per second. If nil, default from the model is used
default.player_set_textures(player, textures)
^ Sets player textures
-> player: PlayerRef
-> textures: array of textures
^ If <textures> is nil, the default textures from the model def are used
default.player_get_animation(player)
^ Returns a table containing fields "model", "textures" and "animation".
^ Any of the fields of the returned table may be nil.
-> player: PlayerRef
Model Definition
----------------
{
animation_speed = 30, -- Default animation speed, in FPS.
textures = {"character.png", }, -- Default array of textures.
visual_size = {x=1, y=1,}, -- Used to scale the model.
animations = {
-- <anim_name> = { x=<start_frame>, y=<end_frame>, },
foo = { x= 0, y=19, },
bar = { x=20, y=39, },
-- ...
},
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

BIN
minetestforfun_game/menu/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -0,0 +1,5 @@
mgv6_spflags = biomeblend, jungles
movement_liquid_sink = 25
movement_liquid_fluidity = 0.8
movement_liquid_fluidity_smooth = 2

View File

@ -0,0 +1,27 @@
farming.register_hoe(name, hoe definition)
-> Register a new hoe, see [hoe definition]
farming.register_plant(name, Plant definition)
-> Register a new growing plant, see [Plant definition]
Hoe Definition
{
description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
max_uses = 30, -- Uses until destroyed
recipe = { -- Craft recipe
{"air", "air", "air"},
{"", "group:stick"},
{"", "group:stick"},
}
}
Plant definition
{
description = "", -- Description of seed item
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
steps = 8, -- How many steps the plant has to grow, until it can be harvested
^ Always provide a plant texture for ech step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum light to grow
maxlight = LIGHT_MAX -- Maximum light to grow
}

View File

@ -0,0 +1,59 @@
Minetest 0.4 mod: farming
=========================
License of source code:
-----------------------
Copyright (C) 2014 webdesigner97
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
License of media (textures):
----------------------------
Created by PilzAdam (License: WTFPL):
farming_bread.png
farming_soil.png
farming_soil_wet.png
farming_soil_wet_side.png
farming_string.png
Created by BlockMen (License: CC BY 3.0):
farming_tool_diamondhoe.png
farming_tool_mesehoe.png
farming_tool_bronzehoe.png
farming_tool_steelhoe.png
farming_tool_stonehoe.png
farming_tool_woodhoe.png
Created by VanessaE (License: WTFPL):
farming_cotton_seed.png
farming_wheat_seed.png
farming_flour.png
farming_wheat.png
farming_wheat_1.png
farming_wheat_2.png
farming_wheat_3.png
farming_wheat_4.png
farming_wheat_5.png
farming_wheat_5.png
farming_wheat_7.png
farming_wheat_8.png
farming_cotton_1.png
farming_cotton_2.png
farming_cotton_3.png
farming_cotton_4.png
farming_cotton_5.png
farming_cotton_6.png
farming_cotton_7.png
farming_cotton_8.png

View File

@ -0,0 +1,284 @@
-- Wear out hoes, place soil
-- TODO Ignore group:flower
farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
local above = minetest.get_node(p)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if the node above the pointed thing is air
if above.name ~= "air" then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") ~= 1 then
return
end
-- check if (wet) soil defined
local regN = minetest.registered_nodes
if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil then
return
end
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name = regN[under.name].soil.dry})
minetest.sound_play("default_dig_crumbly", {
pos = pt.under,
gain = 0.5,
})
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/(uses-1))
end
return itemstack
end
-- Register new hoes
farming.register_hoe = function(name, def)
-- Check for : prefix (register new hoes in your mod's namespace)
if name:sub(1,1) ~= ":" then
name = ":" .. name
end
-- Check def table
if def.description == nil then
def.description = "Hoe"
end
if def.inventory_image == nil then
def.inventory_image = "unknown_item.png"
end
if def.recipe == nil then
def.recipe = {
{"air","air",""},
{"","group:stick",""},
{"","group:stick",""}
}
end
if def.max_uses == nil then
def.max_uses = 30
end
-- Register the tool
minetest.register_tool(name, {
description = def.description,
inventory_image = def.inventory_image,
on_use = function(itemstack, user, pointed_thing)
return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses)
end
})
-- Register its recipe
minetest.register_craft({
output = name:gsub(":", "", 1),
recipe = def.recipe
})
end
-- Seed placement
farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") < 2 then
return
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = 1})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
-- Register plants
farming.register_plant = function(name, def)
local mname = name:split(":")[1]
local pname = name:split(":")[2]
-- Check def table
if not def.description then
def.description = "Seed"
end
if not def.inventory_image then
def.inventory_image = "unknown_item.png"
end
if not def.steps then
return nil
end
if not def.minlight then
def.minlight = 1
end
if not def.maxlight then
def.maxlight = 14
end
if not def.fertility then
def.fertility = {}
end
-- Register seed
local g = {seed = 1, snappy = 3, attached_node = 1}
for k, v in pairs(def.fertility) do
g[v] = 1
end
minetest.register_node(":" .. mname .. ":seed_" .. pname, {
description = def.description,
tiles = {def.inventory_image},
inventory_image = def.inventory_image,
wield_image = def.inventory_image,
drawtype = "signlike",
groups = g,
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
fertility = def.fertility,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname)
end
})
-- Register harvest
minetest.register_craftitem(":" .. mname .. ":" .. pname, {
description = pname:gsub("^%l", string.upper),
inventory_image = mname .. "_" .. pname .. ".png",
})
-- Register growing steps
for i=1,def.steps do
local drop = {
items = {
{items = {mname .. ":" .. pname}, rarity = 9 - i},
{items = {mname .. ":" .. pname}, rarity= 18 - i * 2},
{items = {mname .. ":seed_" .. pname}, rarity = 9 - i},
{items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2},
}
}
local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}
nodegroups[pname] = i
minetest.register_node(mname .. ":" .. pname .. "_" .. i, {
drawtype = "plantlike",
waving = 1,
tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"},
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = drop,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
groups = nodegroups,
sounds = default.node_sound_leaves_defaults(),
})
end
-- Growing ABM
minetest.register_abm({
nodenames = {"group:" .. pname, "group:seed"},
neighbors = {"group:soil"},
interval = 90,
chance = 2,
action = function(pos, node)
local plant_height = minetest.get_item_group(node.name, pname)
-- return if already full grown
if plant_height == def.steps then
return
end
local node_def = minetest.registered_items[node.name] or nil
-- grow seed
if minetest.get_item_group(node.name, "seed") and node_def.fertility then
local can_grow = false
local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
if not soil_node then
return
end
for _, v in pairs(node_def.fertility) do
if minetest.get_item_group(soil_node.name, v) ~= 0 then
can_grow = true
end
end
if can_grow then
minetest.set_node(pos, {name = node.name:gsub("seed_", "") .. "_1"})
end
return
end
-- check if on wet soil
pos.y = pos.y - 1
local n = minetest.get_node(pos)
if minetest.get_item_group(n.name, "soil") < 3 then
return
end
pos.y = pos.y + 1
-- check light
local ll = minetest.get_node_light(pos)
if not ll or ll < def.minlight or ll > def.maxlight then
return
end
-- grow
minetest.set_node(pos, {name = mname .. ":" .. pname .. "_" .. plant_height + 1})
end
})
-- Return
local r = {
seed = mname .. ":seed_" .. pname,
harvest = mname .. ":" .. pname
}
return r
end

View File

@ -0,0 +1,2 @@
default
wool

View File

@ -0,0 +1,65 @@
farming.register_hoe(":farming:hoe_wood", {
description = "Wooden Hoe",
inventory_image = "farming_tool_woodhoe.png",
max_uses = 30,
recipe = {
{"group:wood", "group:wood"},
{"", "group:stick"},
{"", "group:stick"},
}
})
farming.register_hoe(":farming:hoe_stone", {
description = "Stone Hoe",
inventory_image = "farming_tool_stonehoe.png",
max_uses = 90,
recipe = {
{"group:stone", "group:stone"},
{"", "group:stick"},
{"", "group:stick"},
}
})
farming.register_hoe(":farming:hoe_steel", {
description = "Steel Hoe",
inventory_image = "farming_tool_steelhoe.png",
max_uses = 200,
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"", "group:stick"},
{"", "group:stick"},
}
})
farming.register_hoe(":farming:hoe_bronze", {
description = "Bronze Hoe",
inventory_image = "farming_tool_bronzehoe.png",
max_uses = 220,
recipe = {
{"default:bronze_ingot", "default:bronze_ingot"},
{"", "group:stick"},
{"", "group:stick"},
}
})
farming.register_hoe(":farming:hoe_mese", {
description = "Mese Hoe",
inventory_image = "farming_tool_mesehoe.png",
max_uses = 350,
recipe = {
{"default:mese_crystal", "default:mese_crystal"},
{"", "group:stick"},
{"", "group:stick"},
}
})
farming.register_hoe(":farming:hoe_diamond", {
description = "Diamond Hoe",
inventory_image = "farming_tool_diamondhoe.png",
max_uses = 500,
recipe = {
{"default:diamond", "default:diamond"},
{"", "group:stick"},
{"", "group:stick"},
}
})

View File

@ -0,0 +1,61 @@
-- Global farming namespace
farming = {}
farming.path = minetest.get_modpath("farming")
-- Load files
dofile(farming.path .. "/api.lua")
dofile(farming.path .. "/nodes.lua")
dofile(farming.path .. "/hoes.lua")
-- WHEAT
farming.register_plant("farming:wheat", {
description = "Wheat seed",
inventory_image = "farming_wheat_seed.png",
steps = 8,
minlight = 13,
maxlight = LIGHT_MAX,
fertility = {"grassland"}
})
minetest.register_craftitem("farming:flour", {
description = "Flour",
inventory_image = "farming_flour.png",
})
minetest.register_craftitem("farming:bread", {
description = "Bread",
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(4),
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread",
recipe = "farming:flour"
})
-- Cotton
farming.register_plant("farming:cotton", {
description = "Cotton seed",
inventory_image = "farming_cotton_seed.png",
steps = 8,
minlight = 13,
maxlight = LIGHT_MAX,
fertility = {"grassland", "desert"}
})
minetest.register_alias("farming:string", "farming:cotton")
minetest.register_craft({
output = "wool:white",
recipe = {
{"farming:cotton", "farming:cotton"},
{"farming:cotton", "farming:cotton"},
}
})

View File

@ -0,0 +1,148 @@
minetest.override_item("default:dirt", {
groups = {crumbly=3,soil=1},
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.override_item("default:dirt_with_grass", {
groups = {crumbly=3,soil=1},
soil = {
base = "default:dirt_with_grass",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil", {
description = "Soil",
tiles = {"farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil_wet", {
description = "Wet Soil",
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.override_item("default:desert_sand", {
groups = {crumbly=3, falling_node=1, sand=1, soil = 1},
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:desert_sand_soil", {
description = "Desert Sand Soil",
drop = "default:desert_sand",
tiles = {"farming_desert_sand_soil.png", "default_desert_sand.png"},
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory = 1, falling_node=1, sand=1, soil = 2, desert = 1, field = 1},
sounds = default.node_sound_sand_defaults(),
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:desert_sand_soil_wet", {
description = "Wet Desert Sand Soil",
drop = "default:desert_sand",
tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"},
is_ground_content = true,
groups = {crumbly=3, falling_node=1, sand=1, not_in_creative_inventory=1, soil=3, wet = 1, desert = 1, field = 1},
sounds = default.node_sound_sand_defaults(),
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_abm({
nodenames = {"group:field"},
interval = 15,
chance = 4,
action = function(pos, node)
local n_def = minetest.registered_nodes[node.name] or nil
local wet = n_def.soil.wet or nil
local base = n_def.soil.base or nil
local dry = n_def.soil.dry or nil
if not n_def or not n_def.soil or not wet or not base or not dry then
return
end
pos.y = pos.y + 1
local nn = minetest.get_node_or_nil(pos)
if not nn or not nn.name then
return
end
local nn_def = minetest.registered_nodes[nn.name] or nil
pos.y = pos.y - 1
if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then
minetest.set_node(pos, {name = base})
return
end
-- check if there is water nearby
if minetest.find_node_near(pos, 3, {"group:water"}) then
local wet_lvl = minetest.get_item_group(node.name, "wet")
-- if it is dry soil and not base node, turn it into wet soil
if wet_lvl == 0 then
minetest.set_node(pos, {name = wet})
end
else
-- turn it back into base if it is already dry
if wet_lvl == 0 then
-- only turn it back if there is no plant/seed on top of it
if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then
minetest.set_node(pos, {name = base})
end
-- if its wet turn it back into dry soil
elseif wet_lvl == 1 then
minetest.set_node(pos, {name = dry})
end
end
end,
})
for i = 1, 5 do
minetest.override_item("default:grass_"..i, {drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'},rarity = 5},
{items = {'default:grass_1'}},
}
}})
end
minetest.override_item("default:junglegrass", {drop = {
max_items = 1,
items = {
{items = {'farming:seed_cotton'},rarity = 8},
{items = {'default:junglegrass'}},
}
}})

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

View File

@ -0,0 +1,16 @@
Minetest 0.4 mod: boats
=======================
by PilzAdam, slightly modified for NeXt
License of source code:
-----------------------
WTFPL
License of media (textures and sounds):
---------------------------------------
WTFPL
Authors of media files:
-----------------------
textures: Zeg9
model: thetoon and Zeg9, modified by PavelS(SokolovPavel)

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,211 @@
--
-- 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"},
},
})

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

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 Lesser 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/lgpl-2.1.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

@ -0,0 +1,2 @@
default

View File

@ -0,0 +1,203 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
local LIQUID_MAX = 8 --The number of water levels when liquid_finite is enabled
minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
minetest.register_craft({
output = "bucket:bucket_empty 1",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"", "default:steel_ingot", ""},
}
})
bucket = {}
bucket.liquids = {}
local function check_protection(pos, name, text)
if minetest.is_protected(pos, name) then
minetest.log("action", (name ~= "" and name or "A mod")
.. " tried to " .. text
.. " at protected position "
.. minetest.pos_to_string(pos)
.. " with a bucket.")
minetest.record_protection_violation(pos, name)
return true
end
return false
end
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image, name)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = {not_in_creative_inventory=1},
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef
if node then
ndef = minetest.registered_nodes[node.name]
end
-- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and
user and not user:get_player_control().sneak then
return ndef.on_rightclick(
pointed_thing.under,
node, user,
itemstack) or itemstack
end
local place_liquid = function(pos, node, source, flowing, fullness)
if check_protection(pos,
user and user:get_player_name() or "",
"place "..source) then
return
end
if math.floor(fullness/128) == 1 or
not minetest.setting_getbool("liquid_finite") then
minetest.add_node(pos, {name=source,
param2=fullness})
return
elseif node.name == flowing then
fullness = fullness + node.param2
elseif node.name == source then
fullness = LIQUID_MAX
end
if fullness >= LIQUID_MAX then
minetest.add_node(pos, {name=source,
param2=LIQUID_MAX})
else
minetest.add_node(pos, {name=flowing,
param2=fullness})
end
end
-- Check if pointing to a buildable node
local fullness = tonumber(itemstack:get_metadata())
if not fullness then fullness = LIQUID_MAX end
if ndef and ndef.buildable_to then
-- buildable; replace the node
place_liquid(pointed_thing.under, node,
source, flowing, fullness)
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
local node = minetest.get_node_or_nil(pointed_thing.above)
if node and minetest.registered_nodes[node.name].buildable_to then
place_liquid(pointed_thing.above,
node, source,
flowing, fullness)
else
-- do not remove the bucket with the liquid
return
end
end
return {name="bucket:bucket_empty"}
end
})
end
end
-- Empty Bucket code by Casimir.
minetest.register_craftitem(":bucket:bucket_empty", {
description = "Empty Bucket",
inventory_image = "bucket.png",
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to a node.
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid source.
node = minetest.get_node(pointed_thing.under)
liquiddef = bucket.liquids[node.name]
if liquiddef ~= nil and liquiddef.itemname ~= nil and
(node.name == liquiddef.source or
(node.name == liquiddef.flowing and
minetest.setting_getbool("liquid_finite"))) then
if check_protection(pointed_thing.under,
user:get_player_name(),
"take ".. node.name) then
return
end
-- Only one bucket: replace.
local count = itemstack:get_count()
if count == 1 then
minetest.add_node(pointed_thing.under, {name="air"})
return ItemStack({name = liquiddef.itemname,
metadata = tostring(node.param2)})
end
-- Stacked buckets: add a filled bucket, replace stack.
local inv = user:get_inventory()
if inv:room_for_item("main", liquiddef.itemname) then
minetest.add_node(pointed_thing.under, {name="air"})
count = count - 1
itemstack:set_count(count)
if node.name == liquiddef.source then
node.param2 = LIQUID_MAX
end
bucket_liquid = ItemStack({name = liquiddef.itemname,
metadata = tostring(node.param2)})
inv:add_item("main", bucket_liquid)
return itemstack
else
minetest.chat_send_player(user:get_player_name(), "Your inventory is full.")
end
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png",
"Water Bucket"
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png",
"Lava Bucket"
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})
if minetest.setting_getbool("log_mods") then
minetest.log("action", "Carbone: [bucket] loaded.")
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

View File

@ -0,0 +1,22 @@
Minetest 0.4 mod: creative
==========================
Implements creative mode.
Switch on by using the "creative_mode" setting.
Registered items that
- have a description, and
- do not have the group not_in_creative_inventory
are added to the creative inventory.
License of source code and media files:
---------------------------------------
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,172 @@
-- minetest/creative/init.lua
creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory")
--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
table.insert(creative_list, name)
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
creative_inventory.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return stack:get_count()
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, "")
end,
})
trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec(
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;5,3.5;8,1;]"..
"list[current_player;main;5,4.75;8,3;8]"..
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]"..
default.get_hotbar_bg(5,3.5)
)
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.set_creative_formspec(player, 0, 1)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 4*6
end
if fields.creative_next then
start_i = start_i + 4*6
end
if start_i < 0 then
start_i = start_i + 4*6
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
start_i = 0
end
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
end)
if minetest.setting_getbool("creative_mode") then
local digtime = 0.5
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
range = 10,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
},
damage_groups = {fleshy = 10},
}
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return true
end)
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
end
end
end
end
end

View File

@ -0,0 +1,178 @@
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 Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-2.1.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>
Cisoun's WTFPL texture pack:
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.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_sapling.png
default_sign_wall.png
default_stone.png
default_tree.png
default_tree_top.png
default_water.png
Originating from G4JC's Almost MC Texture Pack:
default_torch.png
default_torch_on_ceiling.png
default_torch_on_floor.png
VanessaE's animated torches (WTFPL):
default_torch_animated.png
default_torch_on_ceiling_animated.png
default_torch_on_floor_animated.png
default_torch_on_floor.png
RealBadAngel's animated water (WTFPL):
default_water_source_animated.png
default_water_flowing_animated.png
VanessaE (WTFPL):
default_nc_back.png
default_nc_front.png
default_nc_rb.png
default_nc_side.png
default_grass_*.png
default_desert_sand.png
default_desert_stone.png
default_desert_stone_brick.png
default_sand.png
default_sandstone_brick.png
Calinou (CC BY-SA 3.0):
crack_anylength.png
default_brick.png
default_papyrus.png
default_copper_lump.png
default_mineral_copper.png
MirceaKitsune (WTFPL):
character.x
Jordach (CC BY-SA 3.0):
character.png
PilzAdam (WTFPL):
default_jungleleaves.png
default_junglesapling.png
default_junglewood.png
default_obsidian_glass.png
default_obsidian_shard.png
default_mossycobble.png
default_gold_lump.png
default_mineral_gold.png
default_snowball.png
jojoa1997 (WTFPL):
default_obsidian.png
InfinityProject (WTFPL):
default_mineral_diamond.png
Splizard (CC BY-SA 3.0):
default_snow.png
default_snow_side.png
default_ice.png
Zeg9 (CC BY-SA 3.0):
default_coal_block.png
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
paramat (CC BY-SA 3.0):
wieldhand.png, based on character.png by Jordach (CC BY-SA 3.0)
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_stone_brick.png
default_wood.png
default_cobble.png
default_clay_brick.png
default_tool_steelsword.png
default_bronze_ingot.png
default_copper_ingot.png
default_gold_ingot.png
default_diamond.png
default_diamond_block.png
default_tool_*.png
default_lava_source_animated.png
default_lava_flowing_animated.png
default_book.png
default_paper.png
default_stick.png
bubble.png
heart.png
gui_*.png
Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
2: http://www.freesound.org/people/Tomlija/sounds/97669/
3: http://www.freesound.org/people/lsprice/sounds/88808/
Mito551 (sounds) (CC BY-SA):
default_dig_choppy.ogg
default_dig_cracky.ogg
default_dig_crumbly.1.ogg
default_dig_crumbly.2.ogg
default_dig_dig_immediate.ogg
default_dig_oddly_breakable_by_hand.ogg
default_dug_node.1.ogg
default_dug_node.2.ogg
default_grass_footstep.1.ogg
default_grass_footstep.2.ogg
default_grass_footstep.3.ogg
default_gravel_footstep.1.ogg
default_gravel_footstep.2.ogg
default_gravel_footstep.3.ogg
default_gravel_footstep.4.ogg
default_grass_footstep.1.ogg
default_place_node.1.ogg
default_place_node.2.ogg
default_place_node.3.ogg
default_place_node_hard.1.ogg
default_place_node_hard.2.ogg
default_snow_footstep.1.ogg
default_snow_footstep.2.ogg
default_hard_footstep.1.ogg
default_hard_footstep.2.ogg
default_hard_footstep.3.ogg
default_sand_footstep.1.ogg
default_sand_footstep.2.ogg
default_wood_footstep.1.ogg
default_wood_footstep.2.ogg
default_dirt_footstep.1.ogg
default_dirt_footstep.2.ogg
default_glass_footstep.ogg

View File

@ -0,0 +1,67 @@
-- aliases (Minetest 0.4 mod)
-- Provides alias for most default items
minetest.register_alias("stone", "default:stone")
minetest.register_alias("stone_with_coal", "default:stone_with_coal")
minetest.register_alias("stone_with_iron", "default:stone_with_iron")
minetest.register_alias("dirt_with_grass", "default:dirt_with_grass")
minetest.register_alias("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps")
minetest.register_alias("dirt", "default:dirt")
minetest.register_alias("sand", "default:sand")
minetest.register_alias("gravel", "default:gravel")
minetest.register_alias("sandstone", "default:sandstone")
minetest.register_alias("clay", "default:clay")
minetest.register_alias("brick", "default:brick")
minetest.register_alias("tree", "default:tree")
minetest.register_alias("jungletree", "default:jungletree")
minetest.register_alias("junglegrass", "default:junglegrass")
minetest.register_alias("leaves", "default:leaves")
minetest.register_alias("cactus", "default:cactus")
minetest.register_alias("papyrus", "default:papyrus")
minetest.register_alias("bookshelf", "default:bookshelf")
minetest.register_alias("glass", "default:glass")
minetest.register_alias("wooden_fence", "default:fence_wood")
minetest.register_alias("rail", "default:rail")
minetest.register_alias("ladder", "default:ladder")
minetest.register_alias("wood", "default:wood")
minetest.register_alias("mese", "default:mese")
minetest.register_alias("cloud", "default:cloud")
minetest.register_alias("water_flowing", "default:water_flowing")
minetest.register_alias("water_source", "default:water_source")
minetest.register_alias("lava_flowing", "default:lava_flowing")
minetest.register_alias("lava_source", "default:lava_source")
minetest.register_alias("torch", "default:torch")
minetest.register_alias("sign_wall", "default:sign_wall")
minetest.register_alias("furnace", "default:furnace")
minetest.register_alias("chest", "default:chest")
minetest.register_alias("locked_chest", "default:chest_locked")
minetest.register_alias("cobble", "default:cobble")
minetest.register_alias("mossycobble", "default:mossycobble")
minetest.register_alias("steelblock", "default:steelblock")
minetest.register_alias("nyancat", "default:nyancat")
minetest.register_alias("nyancat_rainbow", "default:nyancat_rainbow")
minetest.register_alias("sapling", "default:sapling")
minetest.register_alias("apple", "default:apple")
minetest.register_alias("WPick", "default:pick_wood")
minetest.register_alias("STPick", "default:pick_stone")
minetest.register_alias("SteelPick", "default:pick_steel")
minetest.register_alias("MesePick", "default:pick_mese")
minetest.register_alias("WShovel", "default:shovel_wood")
minetest.register_alias("STShovel", "default:shovel_stone")
minetest.register_alias("SteelShovel", "default:shovel_steel")
minetest.register_alias("WAxe", "default:axe_wood")
minetest.register_alias("STAxe", "default:axe_stone")
minetest.register_alias("SteelAxe", "default:axe_steel")
minetest.register_alias("WSword", "default:sword_wood")
minetest.register_alias("STSword", "default:sword_stone")
minetest.register_alias("SteelSword", "default:sword_steel")
minetest.register_alias("Stick", "default:stick")
minetest.register_alias("paper", "default:paper")
minetest.register_alias("book", "default:book")
minetest.register_alias("lump_of_coal", "default:coal_lump")
minetest.register_alias("lump_of_iron", "default:iron_lump")
minetest.register_alias("lump_of_clay", "default:clay_lump")
minetest.register_alias("steel_ingot", "default:steel_ingot")
minetest.register_alias("clay_brick", "default:clay_brick")

View File

@ -0,0 +1,190 @@
minetest.register_privilege("physics", {
description = "Allows player to set their gravity, jump height and movement speed"})
-- Infotool code by PilzAdam:
minetest.register_craftitem("default:infotool", {
description = "Infotool",
inventory_image = "default_infotool.png",
wield_image = "default_infotool.png^[transformR90",
groups = {not_in_creative_inventory = 1},
on_use = function(_, user, pt)
if pt.type ~= "node" then return end
local nn = minetest.get_node(pt.under).name
if type(minetest.registered_items[nn].tiles[1]) ~= "string" then return end
local def = minetest.registered_nodes[nn]
if not def then return end
local textures = def.tiles
local description = def.description
if not textures then
textures = {"(no texture)"}
end
if not description then
description = {"(no description)"}
end
for i = 1,6 do
if not textures[i] then
textures[i] = textures[i-1]
end
end
local dir = vector.subtract(pt.above, pt.under)
local index
-- This doesn't work for facedir or other drawtypes yet.
if dir.y == 1 then
index = 1
elseif dir.y == -1 then
index = 2
else
if dir.x == 1 then
index = 3
elseif dir.x == -1 then
index = 4
else
if dir.z == 1 then
index = 5
else
index = 6
end
end
end
minetest.chat_send_player(user:get_player_name(), description .. ": " .. nn .. " (" .. textures[index] .. ")")
end,
})
minetest.register_chatcommand("info", {
description = "Gives an Infotool, click to receive information on the pointed node",
func = function(name)
local receiverref = minetest.get_player_by_name(name)
receiverref:get_inventory():add_item("main", "default:infotool")
minetest.chat_send_player(name, "\"default:infotool\" added to inventory.")
end,
})
minetest.register_chatcommand("clearinventory", {
params = "<inventory>",
description = "Clears an entire inventory, \"main\" if unspecified, \"craft\" is another possible choice",
func = function(name, param)
local player = minetest.get_player_by_name(name)
local player_inv = player:get_inventory()
if not player then
minetest.log("error", "Unable to clear inventory, no player.")
return false, "Unable to clear inventory, no player."
end
if param == "" then
player_inv:set_list("main", {})
return true, "Inventory \"main\" cleared."
else
player_inv:set_list(param, {})
return true, "Inventory \"" .. param .. "\" cleared."
end
end,
})
-- The following commands /whoami, /suicide, /speed, /gravity and /jump by Wuzzy:
minetest.register_chatcommand("whoami", {
params = "",
description = "Tells your name",
privs = {},
func = function(name)
minetest.chat_send_player(name, "Your name is: " .. name)
end,
})
minetest.register_chatcommand("ip", {
params = "",
description = "Shows your IP address",
privs = {},
func = function(name)
minetest.chat_send_player(name, "Your IP address is: "..minetest.get_player_ip(name))
end
})
minetest.register_chatcommand("suicide", {
params = "",
description = "Kills yourself",
func = function(name, param)
local player = minetest.get_player_by_name(name)
if not player then return end
player:set_hp(0)
if minetest.setting_getbool("enable_damage") == false then
minetest.chat_send_player(name, "[X] Damage is disabled on this server.")
else
minetest.chat_send_player(name, "[X] You suicided.")
end
end,
})
minetest.register_chatcommand("speed", {
params = "[speed]",
description = "Sets your movement speed (defaults to 1).",
privs = {physics = true},
func = function(name, speed)
local player = minetest.get_player_by_name(name)
if not player then return end
if speed == "" then speed = 1 end
if type(tonumber(speed)) ~= "number"
or tonumber(speed) < 0
or tonumber(speed) > 10 then
minetest.chat_send_player(name, "[~] Speed must be between 0.0 and 10.0.")
return
end
player:set_physics_override(tonumber(speed), nil, nil)
minetest.chat_send_player(name, "[~] Speed set to " .. tonumber(speed) * 100 .. " %.")
end,
})
minetest.register_chatcommand("gravity", {
params = "[gravity]",
description = "Sets your gravity (defaults to 1).",
privs = {physics = true},
func = function(name, gravity)
local player = minetest.get_player_by_name(name)
if not player then return end
if gravity == "" then gravity = 1 end
if type(tonumber(gravity)) ~= "number"
or tonumber(gravity) < -10
or tonumber(gravity) > 10 then
minetest.chat_send_player(name, "[~] Gravity must be between -10.0 and 10.0.")
return
end
player:set_physics_override(nil, nil, tonumber(gravity))
minetest.chat_send_player(name, "[~] Gravity set to " .. tonumber(gravity) * 100 .. " %.")
end,
})
minetest.register_chatcommand("jump", {
params = "[height]",
description = "Sets your jump height (defaults to 1)",
privs = {physics = true},
func = function(name, jump)
local player = minetest.get_player_by_name(name)
if not player then return end
if jump == "" then jump = 1 end
if type(tonumber(jump)) ~= "number"
or tonumber(jump) < 0
or tonumber(jump) > 10 then
minetest.chat_send_player(name, "[~] Jump height must be between 0.0 and 10.0.")
return
end
player:set_physics_override(nil, tonumber(jump), nil)
minetest.chat_send_player(name, "[~] Jump height set to " .. tonumber(jump) * 100 .. " %.")
end,
})
minetest.register_chatcommand("hotbar", {
params = "[size]",
description = "Sets the size of your hotbar",
func = function(name, slots)
if slots == "" then slots = 16 end
if type(tonumber(slots)) ~= "number" or tonumber(slots) < 1 or tonumber(slots) > 23 then
minetest.chat_send_player(name, "[_] Hotbar size must be between 1 and 23.")
return
end
local player = minetest.get_player_by_name(name)
player:hud_set_hotbar_itemcount(tonumber(slots))
minetest.chat_send_player(name, "[_] Hotbar size set to " .. tonumber(slots) .. ".")
end,
})

View File

@ -0,0 +1,914 @@
-- mods/default/crafting.lua
minetest.register_craft({
output = "default:wood 4",
recipe = {{"default:tree"},}
})
minetest.register_craft({
output = "default:junglewood 4",
recipe = {{"default:jungletree"},}
})
minetest.register_craft({
output = "default:stick 9",
recipe = {{"group:wood"},}
})
minetest.register_craft({
output = "default:fence_wood 2",
recipe = {
{"default:stick", "default:stick", "default:stick"},
{"default:stick", "default:stick", "default:stick"},
}
})
minetest.register_craft({
output = "default:fence_cobble 16",
recipe = {
{"default:cobble", "default:cobble", "default:cobble"},
{"default:cobble", "default:cobble", "default:cobble"},
}
})
minetest.register_craft({
output = "default:fence_desert_cobble 16",
recipe = {
{"default:desert_cobble", "default:desert_cobble", "default:desert_cobble"},
{"default:desert_cobble", "default:desert_cobble", "default:desert_cobble"},
}
})
minetest.register_craft({
output = "default:fence_steelblock 16",
recipe = {
{"default:steelblock", "default:steelblock", "default:steelblock"},
{"default:steelblock", "default:steelblock", "default:steelblock"},
}
})
minetest.register_craft({
output = "default:fence_brick 16",
recipe = {
{"default:brick", "default:brick", "default:brick"},
{"default:brick", "default:brick", "default:brick"},
}
})
minetest.register_craft({
output = "default:sign_wall",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:torch 5",
recipe = {
{"default:coal_lump"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:pick_wood",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:pick_stone",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:pick_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:pick_bronze",
recipe = {
{"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:pick_silver",
recipe = {
{"default:silver_ingot", "default:silver_ingot", "default:silver_ingot"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
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_diamond",
recipe = {
{"default:diamond", "default:diamond", "default:diamond"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:pick_nyan",
recipe = {
{"default:nyancat", "default:nyancat", "default:nyancat"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:pick_mese",
recipe = {
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "default:shovel_wood",
recipe = {
{"group:wood"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_stone",
recipe = {
{"group:stone"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_steel",
recipe = {
{"default:steel_ingot"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_bronze",
recipe = {
{"default:bronze_ingot"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_silver",
recipe = {
{"default:silver_ingot"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_gold",
recipe = {
{"default:gold_ingot"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_diamond",
recipe = {
{"default:diamond"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_nyan",
recipe = {
{"default:nyancat"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:shovel_mese",
recipe = {
{"default:mese_crystal"},
{"group:stick"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:axe_wood",
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:axe_stone",
recipe = {
{"group:stone", "group:stone"},
{"group:stone", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:axe_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:axe_bronze",
recipe = {
{"default:bronze_ingot", "default:bronze_ingot"},
{"default:bronze_ingot", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:axe_silver",
recipe = {
{"default:silver_ingot", "default:silver_ingot"},
{"default:silver_ingot", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:axe_silver",
recipe = {
{"default:silver_ingot", "default:silver_ingot"},
{"group:stick", "default:silver_ingot"},
{"group:stick", ""},
}
})
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_gold",
recipe = {
{"default:gold_ingot", "default:gold_ingot"},
{"group:stick", "default:gold_ingot"},
{"group:stick", ""},
}
})
minetest.register_craft({
output = "default:axe_diamond",
recipe = {
{"default:diamond", "default:diamond"},
{"default:diamond", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:axe_nyan",
recipe = {
{"default:nyancat", "default:nyancat"},
{"default:nyancat", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:axe_nyan",
recipe = {
{"default:nyancat", "default:nyancat"},
{"group:stick", "default:nyancat"},
{"group:stick", ""},
}
})
minetest.register_craft({
output = "default:axe_mese",
recipe = {
{"default:mese_crystal", "default:mese_crystal"},
{"default:mese_crystal", "group:stick"},
{"", "group:stick"},
}
})
minetest.register_craft({
output = "default:sword_wood",
recipe = {
{"group:wood"},
{"group:wood"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_stone",
recipe = {
{"group:stone"},
{"group:stone"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_steel",
recipe = {
{"default:steel_ingot"},
{"default:steel_ingot"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_bronze",
recipe = {
{"default:bronze_ingot"},
{"default:bronze_ingot"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_silver",
recipe = {
{"default:silver_ingot"},
{"default:silver_ingot"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_gold",
recipe = {
{"default:gold_ingot"},
{"default:gold_ingot"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_diamond",
recipe = {
{"default:diamond"},
{"default:diamond"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_nyan",
recipe = {
{"default:nyancat"},
{"default:nyancat"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:sword_mese",
recipe = {
{"default:mese_crystal"},
{"default:mese_crystal"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:knife_silver",
recipe = {
{"default:silver_ingot"},
{"group:stick"},
}
})
minetest.register_craft({
output = "default:rail 16",
recipe = {
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "default:chest",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", " ", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
}
})
minetest.register_craft({
output = "default:chest_locked",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "group:ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
}
})
minetest.register_craft({
type = "shapeless",
output = "default:chest_locked",
recipe = {"default:chest", "group:ingot"},
})
minetest.register_craft({
output = "default:furnace",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"group:stone", " ", "group:stone"},
{"group:stone", "group:stone", "group:stone"},
}
})
minetest.register_craft({
output = "default:furnace_locked",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"group:stone", "group:ingot", "group:stone"},
{"group:stone", "group:stone", "group:stone"},
},
})
minetest.register_craft({
type = "shapeless",
output = "default:furnace_locked",
recipe = {"default:furnace", "group:ingot"},
})
minetest.register_craft({
type = "shapeless",
output = "default:bronze_ingot",
recipe = {"default:copper_ingot", "default:tin_ingot"},
})
minetest.register_craft({
output = "default:coalblock",
recipe = {
{"default:coal_lump", "default:coal_lump", "default:coal_lump"},
{"default:coal_lump", "default:coal_lump", "default:coal_lump"},
{"default:coal_lump", "default:coal_lump", "default:coal_lump"},
}
})
minetest.register_craft({
output = "default:coal_lump 9",
recipe = {{"default:coalblock"},}
})
minetest.register_craft({
output = "default:steelblock",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "default:steel_ingot 9",
recipe = {{"default:steelblock"},}
})
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:copperblock",
recipe = {
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
}
})
minetest.register_craft({
output = "default:copper_ingot 9",
recipe = {{"default:copperblock"},}
})
minetest.register_craft({
output = "default:bronzeblock",
recipe = {
{"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
{"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
{"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
}
})
minetest.register_craft({
output = "default:bronze_ingot 9",
recipe = {{"default:bronzeblock"},}
})
minetest.register_craft({
output = "default:silverblock",
recipe = {
{"default:silver_ingot", "default:silver_ingot", "default:silver_ingot"},
{"default:silver_ingot", "default:silver_ingot", "default:silver_ingot"},
{"default:silver_ingot", "default:silver_ingot", "default:silver_ingot"},
}
})
minetest.register_craft({
output = "default:silver_ingot 9",
recipe = {{"default:silverblock"},}
})
minetest.register_craft({
output = "default:goldblock",
recipe = {
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
{"default:gold_ingot", "default:gold_ingot", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "default:gold_ingot 9",
recipe = {{"default:goldblock"},}
})
minetest.register_craft({
output = "default:diamondblock",
recipe = {
{"default:diamond", "default:diamond", "default:diamond"},
{"default:diamond", "default:diamond", "default:diamond"},
{"default:diamond", "default:diamond", "default:diamond"},
}
})
minetest.register_craft({
output = "default:diamond 9",
recipe = {{"default:diamondblock"},}
})
minetest.register_craft({
output = "default:sandstone 2",
recipe = {
{"default:sand", "default:sand"},
{"default:sand", "default:sand"},
}
})
minetest.register_craft({
output = "default:desert_stone 2",
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
}
})
minetest.register_craft({
output = "default:sandstonebrick 4",
recipe = {
{"default:sandstone", "default:sandstone"},
{"default:sandstone", "default:sandstone"},
}
})
minetest.register_craft({
output = "default:clay",
recipe = {
{"default:clay_lump", "default:clay_lump", "default:clay_lump"},
{"default:clay_lump", "default:clay_lump", "default:clay_lump"},
{"default:clay_lump", "default:clay_lump", "default:clay_lump"},
}
})
minetest.register_craft({
output = "default:brick",
recipe = {
{"default:clay_brick", "default:clay_brick", "default:clay_brick"},
{"default:clay_brick", "default:clay_brick", "default:clay_brick"},
{"default:clay_brick", "default:clay_brick", "default:clay_brick"},
}
})
minetest.register_craft({
output = "default:clay_lump 9",
recipe = {{"default:clay"},}
})
minetest.register_craft({
output = "default:clay_brick 9",
recipe = {{"default:brick"},}
})
minetest.register_craft({
type = "shapeless",
output = "default:paper 4",
recipe = {"default:papyrus", "default:papyrus", "default:papyrus"},
})
minetest.register_craft({
type = "shapeless",
output = "default:book",
recipe = {"default:paper", "default:paper", "default:paper"},
})
minetest.register_craft({
type = "shapeless",
output = "default:bookshelf",
recipe = {"group:wood", "group:wood", "group:wood", "default:book", "default:book", "default:book", "group:wood", "group:wood", "group:wood"},
})
minetest.register_craft({
output = "default:ladder 3",
recipe = {
{"group:stick", "", "group:stick"},
{"group:stick", "group:stick", "group:stick"},
{"group:stick", "", "group:stick"},
}
})
minetest.register_craft({
output = "maptools:superapple",
type = "shapeless",
recipe = {"default:apple", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
})
minetest.register_craft({
output = "default:mese",
recipe = {
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
}
})
minetest.register_craft({
output = "default:mese_crystal 9",
recipe = {{"default:mese"}},
})
minetest.register_craft({
output = "default:mese_crystal_fragment 9",
recipe = {{"default:mese_crystal"}},
})
minetest.register_craft({
output = "default:obsidian_shard 9",
recipe = {{"default:obsidian"}},
})
minetest.register_craft({
output = "default:obsidian",
recipe = {
{"default:obsidian_shard", "default:obsidian_shard", "default:obsidian_shard"},
{"default:obsidian_shard", "default:obsidian_shard", "default:obsidian_shard"},
{"default:obsidian_shard", "default:obsidian_shard", "default:obsidian_shard"},
}
})
minetest.register_craft({
output = "default:stonebrick 4",
recipe = {
{"default:stone", "default:stone"},
{"default:stone", "default:stone"},
}
})
minetest.register_craft({
output = "default:desert_stonebrick 4",
recipe = {
{"default:desert_stone", "default:desert_stone"},
{"default:desert_stone", "default:desert_stone"},
}
})
minetest.register_craft({
output = "default:snowblock",
recipe = {
{"default:snow", "default:snow"},
{"default:snow", "default:snow"},
}
})
minetest.register_craft({
output = "default:snow 4",
recipe = {{"default:snowblock"},}
})
minetest.register_craft({
type = "shapeless",
output = "dye:dark_grey 4",
recipe = {"default:coal_lump"},
})
minetest.register_craft({ -- Tool repair (combine 2 tools of the same type in the crafting grid):
type = "toolrepair", additional_wear = -0.15,
})
-- Cooking recipes:
minetest.register_craft({
type = "cooking", output = "default:glass", recipe = "group:sand",
})
minetest.register_craft({
type = "cooking", output = "default:obsidian_glass", recipe = "default:obsidian_shard",
})
minetest.register_craft({
type = "cooking", output = "default:stone", recipe = "default:cobble",
})
minetest.register_craft({
type = "cooking", output = "default:desert_stone", recipe = "default:desert_cobble",
})
minetest.register_craft({
type = "cooking", output = "default:steel_ingot", recipe = "default:iron_lump",
})
minetest.register_craft({
type = "cooking", output = "default:tin_ingot", recipe = "default:tin_lump",
})
minetest.register_craft({
type = "cooking", output = "default:copper_ingot", recipe = "default:copper_lump",
})
minetest.register_craft({
type = "cooking", output = "default:silver_ingot", recipe = "default:silver_lump",
})
minetest.register_craft({
type = "cooking", output = "default:gold_ingot", recipe = "default:gold_lump",
})
minetest.register_craft({
type = "cooking", output = "default:clay_brick", recipe = "default:clay_lump",
})
minetest.register_craft({
type = "cooking", output = "default:clay_burned", recipe = "default:clay",
})
-- Fuel:
minetest.register_craft({
type = "fuel", recipe = "group:tree", burntime = 40,
})
minetest.register_craft({
type = "fuel", recipe = "group:wood", burntime = 10,
})
minetest.register_craft({
type = "fuel", recipe = "group:stick", burntime = 1,
})
minetest.register_craft({
type = "fuel", recipe = "default:junglegrass", burntime = 5,
})
minetest.register_craft({
type = "fuel", recipe = "group:leaves", burntime = 4,
})
minetest.register_craft({
type = "fuel", recipe = "default:cactus", burntime = 20,
})
minetest.register_craft({
type = "fuel", recipe = "default:papyrus", burntime = 3,
})
minetest.register_craft({
type = "fuel", recipe = "default:bookshelf", burntime = 50,
})
minetest.register_craft({
type = "fuel", recipe = "default:fence_wood", burntime = 4,
})
minetest.register_craft({
type = "fuel", recipe = "default:ladder", burntime = 3,
})
minetest.register_craft({
type = "fuel", recipe = "default:lava_source", burntime = 80,
})
minetest.register_craft({
type = "fuel", recipe = "default:torch", burntime = 5,
})
minetest.register_craft({
type = "fuel", recipe = "default:sign_wall", burntime = 15,
})
minetest.register_craft({
type = "fuel", recipe = "default:chest", burntime = 80,
})
minetest.register_craft({
type = "fuel", recipe = "default:chest_locked", burntime = 85,
})
minetest.register_craft({
type = "fuel", recipe = "default:nyancat", burntime = 7200,
})
minetest.register_craft({
type = "fuel", recipe = "default:nyancat_rainbow", burntime = 1200,
})
minetest.register_craft({
type = "fuel", recipe = "default:sapling", burntime = 10,
})
minetest.register_craft({
type = "fuel", recipe = "default:apple", burntime = 5,
})
minetest.register_craft({
type = "fuel", recipe = "default:coal_lump", burntime = 40,
})
minetest.register_craft({
type = "fuel", recipe = "default:coalblock", burntime = 370,
})
minetest.register_craft({
type = "fuel", recipe = "default:junglesapling", burntime = 10,
})
minetest.register_craft({
type = "fuel", recipe = "default:grass_1", burntime = 3,
})

View File

@ -0,0 +1,141 @@
-- mods/default/craftitems.lua
minetest.register_craftitem("default:stick", {
description = "Stick",
stack_max = 1000,
inventory_image = "default_stick.png",
wield_image = "default_stick.png^[transformR90",
groups = {stick = 1},
})
minetest.register_craftitem("default:paper", {
description = "Paper",
wield_scale = {x = 1, y = 1, z = 0.25},
inventory_image = "default_paper.png",
})
minetest.register_craftitem("default:book", {
description = "Book",
inventory_image = "default_book.png",
})
minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_coal_lump.png",
})
minetest.register_craftitem("default:iron_lump", {
description = "Iron Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_iron_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:tin_lump", {
description = "Tin Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_tin_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:copper_lump", {
description = "Copper Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:mese_crystal", {
description = "Mese Crystal",
inventory_image = "default_mese_crystal.png",
})
minetest.register_craftitem("default:silver_lump", {
description = "Silver Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_silver_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:gold_lump", {
description = "Gold Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_gold_lump.png",
groups = {ingot_lump = 1},
})
minetest.register_craftitem("default:diamond", {
description = "Diamond",
inventory_image = "default_diamond.png",
})
minetest.register_craftitem("default:clay_lump", {
description = "Clay Lump",
stack_max = 200,
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_clay_lump.png",
})
minetest.register_craftitem("default:steel_ingot", {
description = "Steel Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_steel_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:tin_ingot", {
description = "Tin Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_tin_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:copper_ingot", {
description = "Copper Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_bronze_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:silver_ingot", {
description = "Silver Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_silver_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:gold_ingot", {
description = "Gold Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_gold_ingot.png",
groups = {ingot = 1},
})
minetest.register_craftitem("default:mese_crystal_fragment", {
description = "Mese Crystal Fragment",
inventory_image = "default_mese_crystal_fragment.png",
})
minetest.register_craftitem("default:clay_brick", {
description = "Clay Brick",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_clay_brick.png",
})
minetest.register_craftitem("default:scorched_stuff", {
description = "Scorched Stuff",
inventory_image = "default_scorched_stuff.png",
})
minetest.register_craftitem("default:obsidian_shard", {
description = "Obsidian Shard",
inventory_image = "default_obsidian_shard.png",
})

View File

@ -0,0 +1,422 @@
-- mods/default/functions.lua
--
-- Sounds
--
function default.node_sound_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.8}
return table
end
function default.node_sound_stone_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_metal_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_metal_footstep", gain = 0.575}
table.dig = table.dig or
{name = "default_metal_footstep", gain = 0.65}
table.dug = table.dug or
{name = "default_metal_footstep", gain = 0.8}
table.place = table.place or
{name = "default_metal_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_dirt_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_gravel_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_sand_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_sand_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_sand_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_sand_footstep", gain = 0.8}
table.place = table.place or
{name = "default_sand_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_wood_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_wood_footstep", gain = 0.625}
table.dig = table.dig or
{name = "default_wood_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_wood_footstep", gain = 0.8}
table.place = table.place or
{name = "default_wood_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_leaves_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_grass_footstep", gain = 0.6}
table.dig = table.dig or
{name = "default_grass_footstep", gain = 0.7}
table.dug = table.dug or
{name = "default_snow_footstep", gain = 0.8}
table.place = table.place or
{name = "default_snow_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_glass_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.55}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.65}
table.dug = table.dug or
{name = "default_break_glass", gain = 0.8}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.75}
default.node_sound_defaults(table)
return table
end
-- Legacy:
function default.spawn_falling_node(p, nodename)
spawn_falling_node(p, nodename)
end
-- Horrible crap to support old code,
-- 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).
function default.register_falling_node(nodename, texture)
minetest.log("error", debug.traceback())
minetest.log("error", "WARNING: default.register_falling_node is deprecated.")
if minetest.registered_nodes[nodename] then
minetest.registered_nodes[nodename].groups.falling_node = 1
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
--
local function cool_wf_vm(pos, node1, node2)
local t1 = os.clock()
local minp = vector.subtract(pos, 10)
local maxp = vector.add(pos, 10)
local manip = minetest.get_voxel_manip()
local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp)
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local stone = minetest.get_content_id(node2)
local lava = minetest.get_content_id(node1)
for i in area:iterp(minp, maxp) do
local p = area:position(i)
if nodes[i] == lava and minetest.find_node_near(p, 1, {"group:water"}) then
nodes[i] = stone
end
end
manip:set_data(nodes)
manip:write_to_map()
-- minetest.log("action", "Lava cooling happened at (" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ").")
local t1 = os.clock()
manip:update_map()
-- minetest.log("action", string.format("Lava cooling updated the map after ca. %.2fs.", os.clock() - t1))
end
local del1 = 0
local count = 0
default.cool_lava_source = function(pos)
local del2 = tonumber(os.clock())
if del2-del1 < 0.1
and count > 1 then
cool_wf_vm(pos, "default:lava_source", "default:obsidian_cooled")
count = 0
else
minetest.set_node(pos, {name = "default:obsidian_cooled"})
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.2})
if del2-del1 < 0.1 then
count = count + 1
end
end
del1 = del2
end
default.cool_lava_flowing = function(pos)
local del2 = tonumber(os.clock())
if del2-del1 < 0.1
and count > 1 then
cool_wf_vm(pos, "default:lava_flowing", "default:cobble_cooled")
count = 0
else
minetest.set_node(pos, {name = "default:cobble_cooled"})
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.2})
if del2-del1 < 0.1 then
count = count + 1
end
end
del1 = del2
end
minetest.register_abm({
nodenames = {"default:lava_flowing"},
neighbors = {"group:water"},
interval = 2,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
default.cool_lava_flowing(pos, node, active_object_count, active_object_count_wider)
end,
})
minetest.register_abm({
nodenames = {"default:lava_source"},
neighbors = {"group:water"},
interval = 2,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
default.cool_lava_source(pos, node, active_object_count, active_object_count_wider)
end,
})
--
-- Papyrus and cactus growing
--
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},
interval = 30,
chance = 50,
action = function(pos, node)
pos.y = pos.y - 1
local name = minetest.get_node(pos).name
if minetest.get_item_group(name, "sand") ~= 0 then
pos.y = pos.y + 1
local height = 0
while minetest.get_node(pos).name == "default:cactus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name = "default:cactus"})
end
end
end
end,
})
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass", "default:dirt_with_snow", "default:sand", "default:desert_sand"},
interval = 30,
chance = 30,
action = function(pos, node)
pos.y = pos.y - 1
local name = minetest.get_node(pos).name
if name == "default:dirt"
or name == "default:dirt_with_grass"
or name == "default:dirt_with_snow"
or name == "default:sand"
or name == "default:desert_sand" then
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
return
end
pos.y = pos.y + 1
local height = 0
while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name = "default:papyrus"})
end
end
end
end,
})
function default.dig_up(pos, node, digger)
if digger == nil then return end
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
local nn = minetest.get_node(np)
if nn.name == node.name then
minetest.node_dig(np, nn, digger)
end
end
--
-- 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_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"},
interval = 1, -- A low interval and a high inverse chance spreads the load.
chance = 2,
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.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.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 and 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
-- 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"})
if p1 then
do_preserve = true
if default.leafdecay_enable_cache then
-- print("Caching trunk.")
-- Cache the trunk:
default.leafdecay_trunk_cache[p0_hash] = p1
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 minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0
or itemname ~= n0.name then
minetest.add_item(p0, itemname)
end
end
minetest.remove_node(p0)
-- minetest.log("action", n0.name .. " decayed at " .. minetest.pos_to_string(p0) .. ".")
nodeupdate(p0)
end
end
})
end -- Ends: if minetest.setting_getbool("leaf_decay") ~= false

View File

@ -0,0 +1,142 @@
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
default = {} -- Definitions made by this mod are usable by all mods.
-- The API documentation in here was moved into doc/lua_api.txt.
WATER_ALPHA = 160
WATER_VISC = 1
LAVA_VISC = 3 -- Slower movement in lava.
LIGHT_MAX = 14 -- 15 is reserved for sunlight.
-- GUI related stuff:
gui_slots = "listcolors[#606060AA;#808080;#101010;#202020;#FFF]"
function default.get_hotbar_bg(x,y)
local out = ""
for i= 0, 7, 1 do
out = out .."image[" .. x + i .. "," .. y .. ";1,1;gui_hb_bg.png]"
end
return out
end
gui_suvival_form = "size[8,8.5]"..
gui_slots ..
"list[current_player;main; 0, 4.25; 8, 4; ]" ..
"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:
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/commands.lua")
dofile(minetest.get_modpath("default").."/nodes.lua")
dofile(minetest.get_modpath("default").."/tools.lua")
dofile(minetest.get_modpath("default").."/craftitems.lua")
dofile(minetest.get_modpath("default").."/crafting.lua")
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/player.lua")
dofile(minetest.get_modpath("default").."/trees.lua")
dofile(minetest.get_modpath("default").."/aliases.lua")
-- Code below by Casimir.
local function count_items()
local i = 0
local number = 0
for name, item in pairs(minetest.registered_items) do
if (name and name ~= "") then
number = number + 1
end
i = i + 1
end
minetest.log("action", "There are " .. number .. " registered nodes, items and tools.")
end
local function player_join_sounds()
minetest.register_on_joinplayer(function()
minetest.sound_play("player_join", {gain = 0.75})
end)
end
local function player_leave_sounds()
minetest.register_on_leaveplayer(function()
minetest.sound_play("player_leave", {gain = 1})
end)
end
minetest.after(1, count_items)
minetest.after(5, player_join_sounds)
minetest.after(5, player_leave_sounds)
hotbar_size = minetest.setting_get("hotbar_size") or 16
minetest.register_on_joinplayer(function(player)
player:set_physics_override({
sneak_glitch = false, -- Climable blocks are quite fast in Carbone.
})
player:hud_set_hotbar_itemcount(hotbar_size)
end)
minetest.register_on_respawnplayer(function(player)
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
local pos = player:getpos()
-- minetest.sound_play("player_join", {pos = pos, gain = 0.5})
end)
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if user:get_hp() >= 20 then return itemstack end
local pos = user:getpos()
minetest.sound_play("health_gain", {pos = pos, gain = 0.4})
end)
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
if minetest.setting_getbool("creative_mode") then
minetest.log("action", "Creative mode is enabled.")
else
minetest.log("action", "Creative mode is disabled.")
end
if minetest.setting_getbool("enable_damage") then
minetest.log("action", "Damage is enabled.")
else
minetest.log("action", "Damage is disabled.")
end
if minetest.setting_getbool("enable_pvp") then
minetest.log("action", "PvP is enabled.")
else
minetest.log("action", "PvP is disabled.")
end
if not minetest.is_singleplayer() and minetest.setting_getbool("server_announce") then
minetest.log("action", "") -- Empty line.
minetest.log("action", "Server name: " .. minetest.setting_get("server_name") or "(none)")
minetest.log("action", "Server description: " .. minetest.setting_get("server_description") or "(none)")
minetest.log("action", "Server URL: " .. minetest.setting_get("server_address") or "(none)")
minetest.log("action", "MOTD: " .. minetest.setting_get("motd") or "(none)")
minetest.log("action", "Maximum users: " .. minetest.setting_get("max_users") or 15)
end
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
-- Reserved slot handling:
minetest.register_on_prejoinplayer(function(name, ip)
if #minetest.get_connected_players() >= (minetest.setting_get("max_users") - 2)
and not minetest.check_player_privs(name, {server = true}) then
return "Sorry, 2 slots are reserved for administrators."
end
end)
if minetest.setting_getbool("log_mods") then
-- Highlight the default mod in the mod loading logs:
minetest.log("action", "Carbone: * [default] loaded.")
end

View File

@ -0,0 +1,795 @@
-- mods/default/mapgen.lua
--
-- Aliases for map generator outputs
--
minetest.register_alias("mapgen_stone", "default:stone")
minetest.register_alias("mapgen_tree", "default:tree")
minetest.register_alias("mapgen_leaves", "default:leaves")
minetest.register_alias("mapgen_jungletree", "default:jungletree")
minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves")
minetest.register_alias("mapgen_apple", "default:apple")
minetest.register_alias("mapgen_water_source", "default:water_source")
minetest.register_alias("mapgen_dirt", "default:dirt")
minetest.register_alias("mapgen_sand", "default:sand")
minetest.register_alias("mapgen_gravel", "default:gravel")
minetest.register_alias("mapgen_clay", "default:clay")
minetest.register_alias("mapgen_lava_source", "default:lava_source")
minetest.register_alias("mapgen_cobble", "default:cobble")
minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
minetest.register_alias("mapgen_mese", "default:mese")
minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
--
-- Ore generation
--
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 8,
clust_size = 3,
height_min = -30000,
height_max = 64,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:desert_stone_with_coal",
wherein = "default:desert_stone",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 10,
clust_size = 3,
height_min = 0,
height_max = 64,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 24 * 24 * 24,
clust_num_ores = 27,
clust_size = 6,
height_min = -30000,
height_max = 0,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 11 * 11 * 11,
clust_num_ores = 3,
clust_size = 2,
height_min = -15,
height_max = 2,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 5,
clust_size = 3,
height_min = -63,
height_max = -16,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 5,
clust_size = 3,
height_min = -30000,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 25 * 25 * 25,
clust_num_ores = 27,
clust_size = 6,
height_min = -30000,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 18 * 18 * 18,
clust_num_ores = 3,
clust_size = 2,
height_min = -255,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 14 * 14 * 14,
clust_num_ores = 5,
clust_size = 3,
height_min = -1024,
height_max = -256,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:mese",
wherein = "default:stone",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 3,
clust_size = 2,
height_min = -30000,
height_max = -1024,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:mese",
wherein = "default:stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 3,
clust_size = 2,
height_min = -1024,
height_max = 64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:meze",
wherein = "default:stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 3,
clust_size = 2,
height_min = 0,
height_max = 64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:mese",
wherein = "default:desert_stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 3,
clust_size = 2,
height_min = -1024,
height_max = 64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:meze",
wherein = "default:desert_stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 3,
clust_size = 2,
height_min = 0,
height_max = 64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "maptools:superapple",
wherein = "default:apple",
clust_scarcity = 6 * 6 * 6,
clust_num_ores = 5,
clust_size = 2,
height_min = 0,
height_max = 64,
})
minetest.register_ore({
ore_type = "scatter",
ore = "maptools:superapple",
wherein = "default:jungleleaves",
clust_scarcity = 16 * 16 * 16,
clust_num_ores = 5,
clust_size = 2,
height_min = 0,
height_max = 64,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coin",
wherein = "default:stone",
clust_scarcity = 26 * 26 * 26,
clust_num_ores = 1,
clust_size = 1,
height_min = -30000,
height_max = 0,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_silver",
wherein = "default:stone",
clust_scarcity = 14 * 14 * 14,
clust_num_ores = 3,
clust_size = 2,
height_min = -127,
height_max = -16,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_silver",
wherein = "default:stone",
clust_scarcity = 12 * 12 * 12,
clust_num_ores = 5,
clust_size = 3,
height_min = -30000,
height_max = -128,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 3,
clust_size = 2,
height_min = -255,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 13 * 13 * 13,
clust_num_ores = 5,
clust_size = 3,
height_min = -30000,
height_max = -256,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 17 * 17 * 17,
clust_num_ores = 4,
clust_size = 3,
height_min = -255,
height_max = -128,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 4,
clust_size = 3,
height_min = -30000,
height_max = -256,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 12 * 12 * 12,
clust_num_ores = 4,
clust_size = 3,
height_min = -63,
height_max = -16,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:desert_stone_with_copper",
wherein = "default:desert_stone",
clust_scarcity = 11 * 11 * 11,
clust_num_ores = 6,
clust_size = 3,
height_min = 0,
height_max = 64,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 5,
clust_size = 3,
height_min = -30000,
height_max = -64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_tin",
wherein = "default:stone",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 5,
clust_size = 3,
height_min = -30000,
height_max = 64,
flags = "absheight",
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 32 * 32 * 32,
clust_num_ores = 40,
clust_size = 4,
height_max = 64,
height_min = -30000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 48 * 48 * 48,
clust_num_ores = 40,
clust_size = 4,
height_max = 64,
height_min = -30000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 60 * 60 * 60,
clust_num_ores = 64,
clust_size = 5,
height_max = -5,
height_min = -30000,
})
if minetest.setting_get("mg_name") == "indev" then
-- Floatlands and high mountains springs:
minetest.register_ore({
ore_type = "scatter",
ore = "default:water_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 40 *40 *40,
clust_num_ores = 8,
clust_size = 3,
height_min = 100,
height_max = 30000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:lava_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 50 * 50 * 50,
clust_num_ores = 5,
clust_size = 2,
height_min = 10000,
height_max = 30000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:sand",
wherein = "default:stone",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 5 * 5 * 3,
clust_size = 5,
height_min = 500,
height_max = 30000,
})
end
-- Underground springs:
minetest.register_ore({
ore_type = "scatter",
ore = "default:water_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 10,
clust_size = 4,
height_min = -10000,
height_max = -10,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:lava_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 32 * 32 * 32,
clust_num_ores = 5,
clust_size = 2,
height_min = -30000,
height_max = -100,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:dirt",
wherein = "default:stone",
clust_scarcity = 16 * 16 * 16,
clust_num_ores = 64,
clust_size = 5,
height_max = 64,
height_min = -4096,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:gravel",
wherein = "default:stone",
clust_scarcity = 16 * 16 * 16,
clust_num_ores = 64,
clust_size = 5,
height_max = 64,
height_min = -30000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:sand",
wherein = "default:stone",
clust_scarcity = 24 * 24 * 24,
clust_num_ores = 32,
clust_size = 4,
height_max = 64,
height_min = -1024,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:clay",
wherein = "default:stone",
clust_scarcity = 32 * 32 * 32,
clust_num_ores = 32,
clust_size = 4,
height_max = 64,
height_min = -1024,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:cobble",
wherein = "default:stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 512,
clust_size = 9,
height_max = 64,
height_min = -4096,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:desert_cobble",
wherein = "default:desert_stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 512,
clust_size = 9,
height_max = 64,
height_min = 0,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:clay",
wherein = "default:sand",
clust_scarcity = 14 * 14 * 14,
clust_num_ores = 64,
clust_size = 5,
height_max = 4,
height_min = -8,
})
-- Air rooms in dirt:
minetest.register_ore({
ore_type = "scatter",
ore = "air",
wherein = "default:dirt",
clust_scarcity = 24 * 24 * 24,
clust_num_ores = 200,
clust_size = 7,
height_min = -30000,
height_max = 64,
})
-- Acid lakes in gravel:
minetest.register_ore({
ore_type = "scatter",
ore = "default:acid_source",
wherein = "default:gravel",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 64,
clust_size = 5,
height_min = -30000,
height_max = 64,
})
-- Ice pools in stone:
minetest.register_ore({
ore_type = "scatter",
ore = "default:ice",
wherein = "default:stone",
clust_scarcity = 32 * 32 * 32,
clust_num_ores = 200,
clust_size = 6,
height_min = -30000,
height_max = 64,
})
function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
minetest.log("action", "WARNING: default.generate_ore is deprecated")
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)
if chunk_size >= y_max - y_min + 1 then
return
end
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 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.get_node(p2).name == wherein then
minetest.set_node(p2, {name = name})
end
end
end
end
end
end
end
--print("generate_ore done")
end
function default.make_papyrus(pos, size)
for y = 0, size - 1 do
local p = {x= pos.x, y = pos.y + y, z= pos.z}
local nn = minetest.get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.set_node(p, {name = "default:papyrus"})
else
return
end
end
end
function default.make_cactus(pos, size)
for y = 0, size-1 do
local p = {x= pos.x, y = pos.y + y, z= pos.z}
local nn = minetest.get_node(p).name
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
minetest.set_node(p, {name = "default:cactus"})
else
return
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.set_node(p, {name = "default:nyancat", param2 = facedir})
-- minetest.log("action", "Generated a nyan cat at " .. minetest.pos_to_string(p) .. ".")
for i= 1,length do
p.x = p.x + tailvec.x
p.z = p.z + tailvec.z
minetest.set_node(p, {name = "default:nyancat_rainbow", param2 = facedir})
end
end
function generate_nyancats(seed, minp, maxp)
local height_min = -30000
local height_max = 30000
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 / (15 * 15 * 15))
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), 10)
end
end
end
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y >= 2 and minp.y <= 0 then
-- Generate papyrus
local perlin1 = minetest.get_perlin(354, 3, 0.7, 100)
-- Assume X and Z lengths are equal
local divlen = 8
local divs = (maxp.x-minp.x)/divlen+1;
for divx= 0, divs-1 do
for divz= 0, divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine papyrus amount from perlin noise
local papyrus_amount = math.floor(perlin1:get2d({x=x0, y =z0}) * 45 - 20)
-- Find random positions for papyrus based on this random
local pr = PseudoRandom(seed+1)
for i= 0,papyrus_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
if minetest.get_node({x=x,y = 1,z=z}).name == "default:dirt_with_grass" and
minetest.find_node_near({x=x,y = 1,z=z}, 1, "default:water_source") then
default.make_papyrus({x=x,y = 2,z=z}, 4)
end
end
end
end
-- Generate cactuses
local perlin1 = minetest.get_perlin(230, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx= 0, divs-1 do
for divz= 0, divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine cactus amount from perlin noise
local cactus_amount = math.floor(perlin1:get2d({x=x0, y =z0}) * 6 - 3)
-- Find random positions for cactus based on this random
local pr = PseudoRandom(seed+1)
for i= 0,cactus_amount do
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 desert sand, make cactus
if ground_y and minetest.get_node({x = x, y = ground_y, z = z}).name == "default:desert_sand" then
default.make_cactus({x=x,y =ground_y+1,z=z}, 4)
end
end
end
end
-- Generate grass
local perlin1 = minetest.get_perlin(329, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx= 0, divs-1 do
for divz= 0, divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine grass amount from perlin noise
local grass_amount = math.floor(perlin1:get2d({x=x0, y =z0}) ^ 3 * 9)
-- Find random positions for grass based on this random
local pr = PseudoRandom(seed+1)
for i= 0,grass_amount do
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
local p = {x=x,y =ground_y+1,z=z}
local nn = minetest.get_node(p).name
-- Check if the node can be replaced
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
nn = minetest.get_node({x=x,y =ground_y,z=z}).name
-- If desert sand, add dry shrub
if nn == "default:desert_sand" then
minetest.set_node(p,{name = "default:dry_shrub"})
-- If dirt with grass, add grass
elseif nn == "default:dirt_with_grass" then
minetest.set_node(p,{name = "default:grass_" .. pr:next(1, 5)})
end
end
end
end
end
end
end
-- Generate nyan cats
generate_nyancats(seed, minp, maxp)
end)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
-- Minetest 0.4 mod: player
-- See README.txt for licensing and other information.
--[[
API
---
default.player_register_model(name, def)
^ Register a new model to be used by players.
^ <name> is the model filename such as "character.x", "foo.b3d", etc.
^ See Model Definition below for format of <def>.
default.registered_player_models[name]
^ See Model Definition below for format.
default.player_set_model(player, model_name)
^ <player> is a PlayerRef.
^ <model_name> is a model registered with player_register_model.
default.player_set_animation(player, anim_name [, speed])
^ <player> is a PlayerRef.
^ <anim_name> is the name of the animation.
^ <speed> is in frames per second. If nil, default from the model is used
default.player_set_textures(player, textures)
^ <player> is a PlayerRef.
^ <textures> is an array of textures
^ If <textures> is nil, the default textures from the model def are used
default.player_get_animation(player)
^ <player> is a PlayerRef.
^ Returns a table containing fields "model", "textures" and "animation".
^ Any of the fields of the returned table may be nil.
Model Definition
----------------
model_def = {
animation_speed = 30, -- Default animation speed, in FPS.
textures = {"character.png", }, -- Default array of textures.
visual_size = {x = 1, y = 1,}, -- Used to scale the model.
animations = {
-- <anim_name> = { x =<start_frame>, y =<end_frame>, },
foo = { x = 0, y = 19, },
bar = { x = 20, y =39, },
-- ...
},
}
]]
-- Player animation blending
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
local animation_blend = 0
default.registered_player_models = { }
-- Local for speed.
local models = default.registered_player_models
function default.player_register_model(name, def)
models[name] = def
end
-- Default player appearance
default.player_register_model("character.x", {
animation_speed = 35,
textures = {"character.png", },
animations = {
stand = {x = 0, y = 40},
lay = {x = 162, y = 166},
walk = {x = 168, y = 187},
mine = {x = 189, y = 198},
walk_mine = {x = 200, y = 219},
sit = {x = 81, y = 160},
},
})
-- Player stats and animations
local player_model = {}
local player_textures = {}
local player_anim = {}
local player_sneak = {}
default.player_attached = {}
function default.player_get_animation(player)
local name = player:get_player_name()
return {
model = player_model[name],
textures = player_textures[name],
animation = player_anim[name],
}
end
-- Called when a player"s appearance needs to be updated
function default.player_set_model(player, model_name)
local name = player:get_player_name()
local model = models[model_name]
if model then
if player_model[name] == model_name then
return
end
player:set_properties({
mesh = model_name,
textures = player_textures[name] or model.textures,
visual = "mesh",
visual_size = model.visual_size or {x = 1, y = 1},
})
default.player_set_animation(player, "stand")
else
player:set_properties({
textures = { "player.png", "player_back.png", },
visual = "upright_sprite",
})
end
player_model[name] = model_name
end
function default.player_set_textures(player, textures)
local name = player:get_player_name()
player_textures[name] = textures
player:set_properties({textures = textures,})
end
function default.player_set_animation(player, anim_name, speed)
local name = player:get_player_name()
if player_anim[name] == anim_name then
return
end
local model = player_model[name] and models[player_model[name]]
if not (model and model.animations[anim_name]) then
return
end
local anim = model.animations[anim_name]
player_anim[name] = anim_name
player:set_animation(anim, speed or model.animation_speed, animation_blend)
end
-- Update appearance when the player joins
minetest.register_on_joinplayer(function(player)
default.player_attached[player:get_player_name()] = false
default.player_set_model(player, "character.x")
player:set_local_animation({x = 0, y = 40}, {x = 168, y = 187}, {x = 189, y = 198}, {x = 200, y = 219}, 35)
-- set GUI
if minetest.setting_getbool("creative_mode") then
-- creative.set_creative_formspec(player, 0, 1)
else
player:set_inventory_formspec(gui_suvival_form)
end
minetest.after(0.5,function()
player:hud_set_hotbar_image("gui_hotbar.png")
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
end)
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
player_model[name] = nil
player_anim[name] = nil
player_textures[name] = nil
end)
-- Localize for better performance.
local player_set_animation = default.player_set_animation
-- Check each player and apply animations
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local model_name = player_model[name]
local model = model_name and models[model_name]
if model and not default.player_attached[name] then
local controls = player:get_player_control()
local walking = false
local animation_speed_mod = model.animation_speed or 35
-- Determine if the player is walking
if controls.up or controls.down or controls.left or controls.right then
walking = true
end
-- Determine if the player is sneaking, and reduce animation speed if so
if controls.sneak then
animation_speed_mod = animation_speed_mod * 0.5
end
-- Apply animations based on what the player is doing
if player:get_hp() == 0 then
player_set_animation(player, "lay", animation_speed_mod)
player:set_eye_offset({x = 0, y = -10, z = 0}, {x = 0, y = -10, z = 0})
elseif walking then
if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil
player_sneak[name] = controls.sneak
end
if controls.LMB or controls.RMB then
player_set_animation(player, "walk_mine", animation_speed_mod)
else
player_set_animation(player, "walk", animation_speed_mod)
end
elseif controls.LMB or controls.RMB then
player_set_animation(player, "mine", animation_speed_mod)
else
player_set_animation(player, "stand", animation_speed_mod * 0.4)
end
end
end
end)

Some files were not shown because too many files have changed in this diff Show More