initial import

master
kaen 2016-08-19 22:01:31 -07:00
commit 3903b7bbae
361 changed files with 28016 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
## Generic ignorable patterns and files
*~
.*.swp
*bak*
tags
*.vim
## Files related to minetest development cycle
*.patch
doc/

7
LICENSE.md Normal file
View File

@ -0,0 +1,7 @@
voxlegends (c) kaen 2016
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

12
Makefile Normal file
View File

@ -0,0 +1,12 @@
.PHONY: doc check
all: doc check test
test:
lua ./unittest/run.lua
doc:
ldoc -f markdown mods/at/
check:
luacheck mods/at/

9
README.md Normal file
View File

@ -0,0 +1,9 @@
voxlegends
===
A persistent realtime procedurally generated open world multiplayer survival roguelike RPG. Well, eventually.
License
===
MIT unless otherwise noted, see individual subdirectories for component licenses.

1
game.conf Normal file
View File

@ -0,0 +1 @@
name = Adventure Test

81
minetest.conf Normal file
View File

@ -0,0 +1,81 @@
# 1 day-night cycle lasts 24 minutes instead of 20.
time_speed = 60
# Decreased acceleration compared to minetest_game.
movement_acceleration_default = 2.4
movement_acceleration_air = 1.2
# Very fast acceleration in fast mode for more control.
movement_acceleration_fast = 24
# Walking is 20 % faster than in minetest_game. Makes playing without the "fast"
# privilege less boring.
movement_speed_walk = 4.8
# 40% the speed of walking.
movement_speed_crouch = 1.92
# 5 times faster than walking.
movement_speed_fast = 24
# Makes climbing speed faster. Also makes ladders more
# useful.
movement_speed_climb = 4
# Faster movement in liquids. Jumping at the water surface also speeds up swimming.
movement_liquid_fluidity = 1.6
# Slightly less gravity.
movement_gravity = 9.5
# Jump height slightly reduced.
movement_speed_jump = 6.35
# Give 1 wooden pickaxe, 10 torches, 10 saplings to new players. Edit
# `mods/give_initial_stuff/init.lua` to change.
give_initial_stuff = true
# Give "home" and "spawn" privileges to new players.
default_privs = interact, shout, home, spawn
# Higher player limit by default.
max_users = 20
# Server settings for improved performance:
max_block_generate_distance = 8
max_block_send_distance = 8
max_simultaneous_block_sends_per_client = 10000
max_simultaneous_block_sends_server_total = 10000
active_block_range = 1
server_map_save_interval = 15.3
# Use mgv7 if not specified by user:
mg_name = v7
# Enable dungeons on new worlds.
mg_flags = trees, caves, dungeons
# Enable jungles on new worlds, disable biome blend and mud flow (faster, looks
# better).
mgv6_spflags = jungles, nobiomeblend, nomudflow, snowbiomes
# More beaches.
mgv6_freq_beach = -0.15
# Map generation attributes specific to Mapgen V7.
# Currently supported: mountains, ridges.
mgv7_spflags = mountains, ridges
# Noise parameters for biome API temperature, humidity and biome blend:
mg_biome_np_heat = 50, 50, (1000, 1000, 1000), 5349, 3, 0.5, 2.0
mg_biome_np_heat_blend = 0, 1.5, (8, 8, 8), 13, 2, 1.0, 2.0
mg_biome_np_humidity = 50, 50, (1000, 1000, 1000), 842, 3, 0.5, 2.0
mg_biome_np_humidity_blend = 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0
mgv7_np_terrain_base = 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0
mgv7_np_terrain_alt = 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0
mgv7_np_terrain_persist = 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0
mgv7_np_height_select = -12, 24, (500, 500, 500), 4213, 6, 0.7, 2.0
mgv7_np_filler_depth = 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
mgv7_np_mount_height = 256, 112, (1000, 1000, 1000), 72449, 3, 0.6, 2.0
mgv7_np_ridge_uwater = 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0
mgv7_np_mountain = -0.6, 1, (250, 350, 250), 5333, 5, 0.63, 2.0
mgv7_np_ridge = 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0
mgv7_np_cave1 = 0, 12, (100, 100, 100), 52534, 4, 0.5, 2.0
mgv7_np_cave2 = 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0

28
minetest.conf.example Normal file
View File

@ -0,0 +1,28 @@
# This file contains settings of minetest_game that can be changed in
# minetest.conf
#
# By default, all the settings are commented and not functional.
# Uncomment settings by removing the preceding #.
# Whether creative mode (fast digging of all blocks, unlimited resources) should be enabled
#creative_mode = false
# The time in seconds after which the bones of a dead player can be looted by everyone
# 0 to disable
#share_bones_time = 1200
# Whether fire should be disabled (all fire nodes will instantly disappear)
#disable_fire = false
# Whether steel tools, torches and cobblestone should be given to new players
#give_initial_stuff = false
# Whether the TNT mod should be enabled
#enable_tnt = <true in singleplayer, false in multiplayer>
# The radius of a TNT explosion
#tnt_radius = 3
# Enable the stairs mod ABM that replaces the old 'upside down'
# stair and slab nodes in old maps with the new param2 versions.
#enable_stairs_replace_abm = false

211
mods/default/README.txt Normal file
View File

@ -0,0 +1,211 @@
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_jungletree.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
Cisoun's conifers mod (WTFPL):
default_pine_needles.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_desert_sand.png
default_desert_stone.png
default_sand.png
default_jungletree_top.png
Calinou (CC BY-SA):
default_brick.png
default_papyrus.png
default_mineral_copper.png
default_glass_detail.png
MirceaKitsune (WTFPL):
character.x
Jordach (CC BY-SA 3.0):
character.png
PilzAdam (WTFPL):
default_jungleleaves.png
default_junglesapling.png
default_obsidian_glass.png
default_obsidian_shard.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_pine_sapling.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, derived from character.png by Jordach (CC BY-SA 3.0)
default_pinetree.png
default_pinetree_top.png
default_pinewood.png
default_sandstone_brick.png
default_obsidian_brick.png
default_river_water.png
default_river_water_source_animated.png
default_river_water_flowing_animated.png
default_acacia_leaves.png
default_acacia_sapling.png
default_acacia_tree.png
default_acacia_tree_top.png
default_acacia_wood.png
default_dry_grass.png
default_dry_grass_side.png
default_dry_grass_*.png
default_junglewood.png, derived from a texture by BlockMen (CC BY-SA 3.0)
default_grass.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
default_grass_side.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
default_stone_brick.png, derived from a texture by Cisoun (WTFPL)
default_desert_stone_brick.png, derived from a texture by VanessaE (WTFPL)
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_wood.png
default_clay_brick.png
default_iron_ingot.png
default_gold_ingot.png
default_tool_steelsword.png
default_diamond.png
default_book.png
default_tool_*.png
default_lava_source_animated.png
default_lava_flowing_animated.png
default_stick.png
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_mineral_mese.png
default_meselamp.png
bubble.png
heart.png
gui_*.png
Neuromancer (CC BY-SA 2.0):
default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect
Neuromancer (CC BY-SA 3.0):
default_dirt.png
default_furnace_*.png
Gambit (WTFPL):
default_bronze_ingot.png
default_copper_ingot.png
default_copper_lump.png
default_iron_lump.png
default_gold_lump.png
default_clay_lump.png
default_coal.png
default_grass_*.png
default_paper.png
default_diamond_block.png
asl97 (WTFPL):
default_ice.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

76
mods/default/aliases.lua Normal file
View File

@ -0,0 +1,76 @@
-- mods/default/aliases.lua
-- Aliases to support loading worlds using nodes following the old naming convention
-- These can also be helpful when using chat commands, for example /giveme
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")
minetest.register_alias("snow", "default:snow")
-- 'mese_block' was used for a while for the block form of mese
minetest.register_alias("default:mese_block", "default:mese")
-- Aliases for corrected pine node names
minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood")

839
mods/default/crafting.lua Normal file
View File

@ -0,0 +1,839 @@
-- 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:pine_wood 4',
recipe = {
{'default:pine_tree'},
}
})
minetest.register_craft({
output = 'default:acacia_wood 4',
recipe = {
{'default:acacia_tree'},
}
})
minetest.register_craft({
output = 'default:stick 4',
recipe = {
{'group:wood'},
}
})
minetest.register_craft({
output = 'default:fence_wood 2',
recipe = {
{'group:stick', 'group:stick', 'group:stick'},
{'group:stick', 'group:stick', 'group:stick'},
}
})
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 4',
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_mese',
recipe = {
{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'},
{'', '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: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_mese',
recipe = {
{'default:mese_crystal'},
{'group:stick'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'default:shovel_diamond',
recipe = {
{'default:diamond'},
{'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_mese',
recipe = {
{'default:mese_crystal', 'default:mese_crystal'},
{'default:mese_crystal', 'group:stick'},
{'', '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_wood',
recipe = {
{'group:wood', 'group:wood'},
{'group:stick', 'group:wood'},
{'group:stick',''},
}
})
minetest.register_craft({
output = 'default:axe_stone',
recipe = {
{'group:stone', 'group:stone'},
{'group:stick', 'group:stone'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_steel',
recipe = {
{'default:steel_ingot', 'default:steel_ingot'},
{'group:stick', 'default:steel_ingot'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_bronze',
recipe = {
{'default:bronze_ingot', 'default:bronze_ingot'},
{'group:stick', 'default:bronze_ingot'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_mese',
recipe = {
{'default:mese_crystal', 'default:mese_crystal'},
{'group:stick', 'default:mese_crystal'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_diamond',
recipe = {
{'default:diamond', 'default:diamond'},
{'group:stick', 'default:diamond'},
{'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_mese',
recipe = {
{'default:mese_crystal'},
{'default:mese_crystal'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'default:sword_diamond',
recipe = {
{'default:diamond'},
{'default:diamond'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'default:rail 24',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
{'default:steel_ingot', '', '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', 'default:steel_ingot', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
}
})
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({
type = "shapeless",
output = "default:bronze_ingot",
recipe = {"default:steel_ingot", "default:copper_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: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: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',
recipe = {
{'group:sand', 'group:sand'},
{'group:sand', 'group:sand'},
}
})
minetest.register_craft({
output = 'default:sand 4',
recipe = {
{'default:sandstone'},
}
})
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'},
}
})
minetest.register_craft({
output = 'default:brick',
recipe = {
{'default:clay_brick', 'default:clay_brick'},
{'default:clay_brick', 'default:clay_brick'},
}
})
minetest.register_craft({
output = 'default:clay_brick 4',
recipe = {
{'default:brick'},
}
})
minetest.register_craft({
output = 'default:paper',
recipe = {
{'default:papyrus', 'default:papyrus', 'default:papyrus'},
}
})
minetest.register_craft({
output = 'default:book',
recipe = {
{'default:paper'},
{'default:paper'},
{'default:paper'},
}
})
minetest.register_craft({
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',
recipe = {
{'group:stick', '', 'group:stick'},
{'group:stick', 'group:stick', 'group:stick'},
{'group:stick', '', 'group:stick'},
}
})
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:meselamp 1',
recipe = {
{'', 'default:mese_crystal',''},
{'default:mese_crystal', 'default:glass', '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:obsidianbrick 4',
recipe = {
{'default:obsidian', 'default:obsidian'},
{'default:obsidian', 'default:obsidian'}
}
})
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', 'default:snow', 'default:snow'},
{'default:snow', 'default:snow', 'default:snow'},
}
})
minetest.register_craft({
output = 'default:snow 9',
recipe = {
{'default:snowblock'},
}
})
--
-- Crafting (tool repair)
--
minetest.register_craft({
type = "toolrepair",
additional_wear = -0.02,
})
--
-- 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:stone",
recipe = "default:mossycobble",
})
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:copper_ingot",
recipe = "default:copper_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",
})
--
-- Fuels
--
minetest.register_craft({
type = "fuel",
recipe = "group:tree",
burntime = 30,
})
minetest.register_craft({
type = "fuel",
recipe = "default:junglegrass",
burntime = 2,
})
minetest.register_craft({
type = "fuel",
recipe = "group:leaves",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "default:cactus",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "default:papyrus",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "default:bookshelf",
burntime = 30,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_wood",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "default:ladder",
burntime = 5,
})
minetest.register_craft({
type = "fuel",
recipe = "group:wood",
burntime = 7,
})
minetest.register_craft({
type = "fuel",
recipe = "default:lava_source",
burntime = 60,
})
minetest.register_craft({
type = "fuel",
recipe = "default:torch",
burntime = 4,
})
minetest.register_craft({
type = "fuel",
recipe = "default:sign_wall",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "default:chest",
burntime = 30,
})
minetest.register_craft({
type = "fuel",
recipe = "default:chest_locked",
burntime = 30,
})
minetest.register_craft({
type = "fuel",
recipe = "default:nyancat",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "default:nyancat_rainbow",
burntime = 1,
})
minetest.register_craft({
type = "fuel",
recipe = "group:sapling",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "default:apple",
burntime = 3,
})
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:grass_1",
burntime = 2,
})
minetest.register_craft({
type = "fuel",
recipe = "default:dry_grass_1",
burntime = 2,
})

163
mods/default/craftitems.lua Normal file
View File

@ -0,0 +1,163 @@
-- mods/default/craftitems.lua
minetest.register_craftitem("default:stick", {
description = "Stick",
inventory_image = "default_stick.png",
groups = {stick=1},
})
minetest.register_craftitem("default:paper", {
description = "Paper",
inventory_image = "default_paper.png",
})
local function book_on_use(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local data = minetest.deserialize(itemstack:get_metadata())
local title, text, owner = "", "", player_name
if data then
title, text, owner = data.title, data.text, data.owner
end
local formspec
if owner == player_name then
formspec = "size[8,8]"..default.gui_bg..
"field[0.5,1;7.5,0;title;Title:;"..
minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;text;Contents:;"..
minetest.formspec_escape(text).."]"..
"button_exit[2.5,7.5;3,1;save;Save]"
else
formspec = "size[8,8]"..default.gui_bg..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
end
minetest.show_formspec(user:get_player_name(), "default:book", formspec)
end
minetest.register_on_player_receive_fields(function(player, form_name, fields)
if form_name ~= "default:book" or not fields.save or
fields.title == "" or fields.text == "" then
return
end
local inv = player:get_inventory()
local stack = player:get_wielded_item()
local new_stack, data
if stack:get_name() ~= "default:book_written" then
local count = stack:get_count()
if count == 1 then
stack:set_name("default:book_written")
else
stack:set_count(count - 1)
new_stack = ItemStack("default:book_written")
end
else
data = minetest.deserialize(stack:get_metadata())
end
if not data then data = {} end
data.title = fields.title
data.text = fields.text
data.owner = player:get_player_name()
local data_str = minetest.serialize(data)
if new_stack then
new_stack:set_metadata(data_str)
if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack)
else
minetest.add_item(player:getpos(), new_stack)
end
else
stack:set_metadata(data_str)
end
player:set_wielded_item(stack)
end)
minetest.register_craftitem("default:book", {
description = "Book",
inventory_image = "default_book.png",
groups = {book=1},
on_use = book_on_use,
})
minetest.register_craftitem("default:book_written", {
description = "Book With Text",
inventory_image = "default_book.png",
groups = {book=1, not_in_creative_inventory=1},
stack_max = 1,
on_use = book_on_use,
})
minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump",
inventory_image = "default_coal_lump.png",
groups = {coal = 1}
})
minetest.register_craftitem("default:iron_lump", {
description = "Iron Lump",
inventory_image = "default_iron_lump.png",
})
minetest.register_craftitem("default:copper_lump", {
description = "Copper Lump",
inventory_image = "default_copper_lump.png",
})
minetest.register_craftitem("default:mese_crystal", {
description = "Mese Crystal",
inventory_image = "default_mese_crystal.png",
})
minetest.register_craftitem("default:gold_lump", {
description = "Gold Lump",
inventory_image = "default_gold_lump.png",
})
minetest.register_craftitem("default:diamond", {
description = "Diamond",
inventory_image = "default_diamond.png",
})
minetest.register_craftitem("default:clay_lump", {
description = "Clay Lump",
inventory_image = "default_clay_lump.png",
})
minetest.register_craftitem("default:steel_ingot", {
description = "Steel Ingot",
inventory_image = "default_steel_ingot.png",
groups = {ingot=1},
})
minetest.register_craftitem("default:copper_ingot", {
description = "Copper Ingot",
inventory_image = "default_copper_ingot.png",
groups = {ingot=1},
})
minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot",
inventory_image = "default_bronze_ingot.png",
groups = {ingot=1},
})
minetest.register_craftitem("default:gold_ingot", {
description = "Gold Ingot",
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",
inventory_image = "default_clay_brick.png",
})
minetest.register_craftitem("default:obsidian_shard", {
description = "Obsidian Shard",
inventory_image = "default_obsidian_shard.png",
})

348
mods/default/functions.lua Normal file
View File

@ -0,0 +1,348 @@
-- mods/default/functions.lua
--
-- Sounds
--
function default.node_sound_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "", gain = 1.0}
table.dug = table.dug or
{name = "default_dug_node", gain = 0.25}
table.place = table.place or
{name = "default_place_node_hard", gain = 1.0}
return table
end
function default.node_sound_stone_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.5}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 1.0}
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 = 1.0}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.5}
table.place = table.place or
{name = "default_place_node", 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.2}
table.dug = table.dug or
{name = "default_sand_footstep", gain = 0.4}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
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.5}
table.dug = table.dug or
{name = "default_wood_footstep", gain = 1.0}
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.35}
table.dug = table.dug or
{name = "default_grass_footstep", gain = 0.7}
table.dig = table.dig or
{name = "default_dig_crumbly", gain = 0.4}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_glass_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_glass_footstep", gain = 0.5}
table.dug = table.dug or
{name = "default_break_glass", gain = 1.0}
default.node_sound_defaults(table)
return table
end
--
-- Lavacooling
--
default.cool_lava_source = function(pos)
minetest.set_node(pos, {name = "default:obsidian"})
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
default.cool_lava_flowing = function(pos)
minetest.set_node(pos, {name = "default:stone"})
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
minetest.register_abm({
nodenames = {"default:lava_flowing"},
neighbors = {"group:water"},
interval = 1,
chance = 2,
action = function(...)
default.cool_lava_flowing(...)
end,
})
minetest.register_abm({
nodenames = {"default:lava_source"},
neighbors = {"group:water"},
interval = 1,
chance = 2,
action = function(...)
default.cool_lava_source(...)
end,
})
--
-- Papyrus and cactus growing
--
-- wrapping the functions in abm action is necessary to make overriding them possible
function default.grow_cactus(pos, node)
if node.param2 >= 4 then
return
end
pos.y = pos.y - 1
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
return
end
pos.y = pos.y + 1
local height = 0
while node.name == "default:cactus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
node = minetest.get_node(pos)
end
if height == 4 or node.name ~= "air" then
return
end
minetest.set_node(pos, {name = "default:cactus"})
return true
end
function default.grow_papyrus(pos, node)
pos.y = pos.y - 1
local name = minetest.get_node(pos).name
if name ~= "default:dirt_with_grass" and name ~= "default:dirt" and
name ~= "default:sand" then
return
end
if not minetest.find_node_near(pos, 3, {"group:water"}) then
return
end
pos.y = pos.y + 1
local height = 0
while node.name == "default:papyrus" and height < 4 do
height = height + 1
pos.y = pos.y + 1
node = minetest.get_node(pos)
end
if height == 4 or node.name ~= "air" then
return
end
minetest.set_node(pos, {name = "default:papyrus"})
return true
end
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},
interval = 50,
chance = 20,
action = function(...)
default.grow_cactus(...)
end
})
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass", "default:sand"},
interval = 50,
chance = 20,
action = function(...)
default.grow_papyrus(...)
end
})
--
-- dig upwards
--
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
--
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)
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
node.param2 = 1
minetest.set_node(pos, node)
end
minetest.register_abm({
nodenames = {"group:leafdecay"},
neighbors = {"air", "group:liquid"},
-- A low interval and a high inverse chance spreads the load
interval = 2,
chance = 5,
action = function(p0, node, _, _)
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
local do_preserve = false
local d = minetest.registered_nodes[node.name].groups.leafdecay
if not d or d == 0 then
--print("not groups.leafdecay")
return
end
local n0 = minetest.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
local 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
local p_drop = {
x = p0.x - 0.5 + math.random(),
y = p0.y - 0.5 + math.random(),
z = p0.z - 0.5 + math.random(),
}
minetest.add_item(p_drop, itemname)
end
end
-- Remove node
minetest.remove_node(p0)
nodeupdate(p0)
end
end
})
--
-- Grass growing
--
minetest.register_abm({
nodenames = {"default:dirt"},
interval = 2,
chance = 200,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and
nodedef.liquidtype == "none" and
(minetest.get_node_light(above) or 0) >= 13 then
if name == "default:snow" or name == "default:snowblock" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
else
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
end
})
minetest.register_abm({
nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
interval = 2,
chance = 20,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or
nodedef.paramtype == "light") and
nodedef.liquidtype == "none") then
minetest.set_node(pos, {name = "default:dirt"})
end
end
})

291
mods/default/furnace.lua Normal file
View File

@ -0,0 +1,291 @@
--
-- Formspecs
--
local function active_formspec(fuel_percent, item_percent)
local formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
"list[current_name;dst;4.75,0.96;2,2;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
default.get_hotbar_bg(0, 4.25)
return formspec
end
local inactive_formspec =
"size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;src;2.75,0.5;1,1;]"..
"list[current_name;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[current_name;dst;4.75,0.96;2,2;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[current_name;dst]"..
"listring[current_player;main]"..
"listring[current_name;src]"..
"listring[current_player;main]"..
default.get_hotbar_bg(0, 4.25)
--
-- Node callback functions that are the same for active and inactive furnace
--
local function can_dig(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", "Furnace is empty")
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end
--
-- Node definitions
--
minetest.register_node("default:furnace", {
description = "Furnace",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_front.png"
},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
})
minetest.register_node("default:furnace_active", {
description = "Furnace",
tiles = {
"default_furnace_top.png", "default_furnace_bottom.png",
"default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}
},
paramtype2 = "facedir",
light_source = 8,
drop = "default:furnace",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
})
--
-- ABM
--
local function swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
minetest.swap_node(pos, node)
end
minetest.register_abm({
nodenames = {"default:furnace", "default:furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
--
-- Inizialize metadata
--
local meta = minetest.get_meta(pos)
local fuel_time = meta:get_float("fuel_time") or 0
local src_time = meta:get_float("src_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
--
-- Inizialize inventory
--
local inv = meta:get_inventory()
for listname, size in pairs({
src = 1,
fuel = 1,
dst = 4,
}) do
if inv:get_size(listname) ~= size then
inv:set_size(listname, size)
end
end
local srclist = inv:get_list("src")
local fuellist = inv:get_list("fuel")
local dstlist = inv:get_list("dst")
--
-- Cooking
--
-- Check if we have cookable content
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cookable = true
if cooked.time == 0 then
cookable = false
end
-- Check if we have enough fuel to burn
if fuel_time < fuel_totaltime then
-- The furnace is currently active and has enough fuel
fuel_time = fuel_time + 1
-- If there is a cookable item then check if it is ready yet
if cookable then
src_time = src_time + 1
if src_time >= cooked.time then
-- Place result in dst list if possible
if inv:room_for_item("dst", cooked.item) then
inv:add_item("dst", cooked.item)
inv:set_stack("src", 1, aftercooked.items[1])
src_time = 0
end
end
end
else
-- Furnace ran out of fuel
if cookable then
-- We need to get new fuel
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
if fuel.time == 0 then
-- No valid fuel in fuel list
fuel_totaltime = 0
fuel_time = 0
src_time = 0
else
-- Take fuel from fuel list
inv:set_stack("fuel", 1, afterfuel.items[1])
fuel_totaltime = fuel.time
fuel_time = 0
end
else
-- We don't need to get new fuel since there is no cookable item
fuel_totaltime = 0
fuel_time = 0
src_time = 0
end
end
--
-- Update formspec, infotext and node
--
local formspec = inactive_formspec
local item_state = ""
local item_percent = 0
if cookable then
item_percent = math.floor(src_time / cooked.time * 100)
item_state = item_percent .. "%"
else
if srclist[1]:is_empty() then
item_state = "Empty"
else
item_state = "Not cookable"
end
end
local fuel_state = "Empty"
local active = "inactive "
if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then
active = "active "
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
fuel_state = fuel_percent .. "%"
formspec = active_formspec(fuel_percent, item_percent)
swap_node(pos, "default:furnace_active")
else
if not fuellist[1]:is_empty() then
fuel_state = "0%"
end
swap_node(pos, "default:furnace")
end
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
--
-- Set meta values
--
meta:set_float("fuel_totaltime", fuel_totaltime)
meta:set_float("fuel_time", fuel_time)
meta:set_float("src_time", src_time)
meta:set_string("formspec", formspec)
meta:set_string("infotext", infotext)
end,
})

48
mods/default/init.lua Normal file
View File

@ -0,0 +1,48 @@
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
-- The API documentation in here was moved into game_api.txt
-- Definitions made by this mod that other mods can use too
default = {}
default.LIGHT_MAX = 14
-- GUI related stuff
default.gui_bg = "bgcolor[#080808BB;true]"
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#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
default.gui_survival_form = "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
"image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"listring[current_player;main]"..
"listring[current_player;craft]"..
default.get_hotbar_bg(0,4.25)
-- Load files
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/nodes.lua")
dofile(minetest.get_modpath("default").."/furnace.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")
dofile(minetest.get_modpath("default").."/legacy.lua")

25
mods/default/legacy.lua Normal file
View File

@ -0,0 +1,25 @@
-- mods/default/legacy.lua
-- Horrible crap to support old code registering falling nodes
-- 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
function default.spawn_falling_node(p, nodename)
spawn_falling_node(p, nodename)
end
-- Liquids
WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha
WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity
LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity
LIGHT_MAX = default.LIGHT_MAX
-- Formspecs
default.gui_suvival_form = default.gui_survival_form

1138
mods/default/mapgen.lua Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

1740
mods/default/nodes.lua Normal file

File diff suppressed because it is too large Load Diff

159
mods/default/player.lua Normal file
View File

@ -0,0 +1,159 @@
-- Minetest 0.4 mod: player
-- See README.txt for licensing and other information.
-- 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.b3d", {
animation_speed = 30,
textures = {"character.png", },
animations = {
-- Standard animations.
stand = { x= 0, y= 79, },
lay = { x=162, y=166, },
walk = { x=168, y=187, },
mine = { x=189, y=198, },
walk_mine = { x=200, y=219, },
-- Extra animations (not currently used by the game).
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.b3d")
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI
if not minetest.setting_getbool("creative_mode") then
player:set_inventory_formspec(default.gui_survival_form)
end
player:hud_set_hotbar_image("gui_hotbar.png")
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
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
local player_attached = default.player_attached
-- 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 player_attached[name] then
local controls = player:get_player_control()
local walking = false
local animation_speed_mod = model.animation_speed or 30
-- 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 / 2
end
-- Apply animations based on what the player is doing
if player:get_hp() == 0 then
player_set_animation(player, "lay")
elseif walking then
if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil
player_sneak[name] = controls.sneak
end
if controls.LMB then
player_set_animation(player, "walk_mine", animation_speed_mod)
else
player_set_animation(player, "walk", animation_speed_mod)
end
elseif controls.LMB then
player_set_animation(player, "mine")
else
player_set_animation(player, "stand", animation_speed_mod)
end
end
end
end)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

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