version 0.21
63
mods/default/README.txt
Normal file
|
@ -0,0 +1,63 @@
|
|||
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 (sounds)
|
||||
--------------------------------------
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
Authors of media files
|
||||
-----------------------
|
||||
MirceaKitsune (WTFPL):
|
||||
character.x
|
||||
|
||||
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
|
812
mods/default/crafting.lua
Normal file
|
@ -0,0 +1,812 @@
|
|||
-- mods/default/crafting.lua
|
||||
|
||||
--
|
||||
-- Crafting definition
|
||||
--
|
||||
|
||||
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:acaciawood 4',
|
||||
recipe = {
|
||||
{'default:acaciatree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sprucewood 4',
|
||||
recipe = {
|
||||
{'default:sprucetree'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:mossycobble',
|
||||
recipe = {
|
||||
{'default:cobble', 'default:vine'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stonebrickmossy',
|
||||
recipe = {
|
||||
{'default:stonebrick', 'default:vine'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stick 4',
|
||||
recipe = {
|
||||
{'group:wood'},
|
||||
{'group:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'fences:fence_wood 2',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'signs:sign_wall',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:torch 4',
|
||||
recipe = {
|
||||
{'default:coal_lump'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:torch 4',
|
||||
recipe = {
|
||||
{'default:charcoal_lump'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:pick_wood',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:pick_stone',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone', 'group:stone'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:pick_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:pick_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:pick_diamond',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond', 'default:diamond'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:shovel_wood',
|
||||
recipe = {
|
||||
{'group:wood'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:shovel_stone',
|
||||
recipe = {
|
||||
{'group:stone'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:shovel_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:shovel_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:shovel_diamond',
|
||||
recipe = {
|
||||
{'default:diamond'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_wood',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood'},
|
||||
{'group:wood', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_stone',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone'},
|
||||
{'group:stone', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot', 'default:gold_ingot'},
|
||||
{'default:gold_ingot', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:axe_diamond',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond'},
|
||||
{'default:diamond', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sword_wood',
|
||||
recipe = {
|
||||
{'group:wood'},
|
||||
{'group:wood'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sword_stone',
|
||||
recipe = {
|
||||
{'group:stone'},
|
||||
{'group:stone'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sword_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'default:steel_ingot'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sword_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot'},
|
||||
{'default:gold_ingot'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sword_diamond',
|
||||
recipe = {
|
||||
{'default:diamond'},
|
||||
{'default:diamond'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:flint_and_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', ''},
|
||||
{'', 'default:flint'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:pole",
|
||||
recipe = {
|
||||
{'','','default:stick'},
|
||||
{'','default:stick','farming:string'},
|
||||
{'default:stick','','farming:string'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:pole",
|
||||
recipe = {
|
||||
{'', '', 'default:stick'},
|
||||
{'', 'default:stick', 'default:string'},
|
||||
{'default:stick', '', 'default:string'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:rail 15',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default: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:furnace',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone', 'group:stone'},
|
||||
{'group:stone', '', 'group:stone'},
|
||||
{'group:stone', 'group:stone', 'group:stone'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:haybale',
|
||||
recipe = {
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'farming:wheat_harvested 9',
|
||||
recipe = {
|
||||
{'default:haybale'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sea_lantern',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_cry', 'default:prismarine_shard'},
|
||||
{'default:prismarine_cry', 'default:prismarine_cry', 'default:prismarine_cry'},
|
||||
{'default:prismarine_shard', 'default:prismarine_cry', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:prismarine',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:prismarine_brick',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:prismarine_dark',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'dye:black', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
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: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:gold_nugget 9",
|
||||
recipe = {{"default:gold_ingot"}},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sandstone',
|
||||
recipe = {
|
||||
{'group:sand', 'group:sand'},
|
||||
{'group:sand', 'group:sand'},
|
||||
}
|
||||
})
|
||||
|
||||
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:reeds', 'default:reeds', 'default:reeds'},
|
||||
}
|
||||
})
|
||||
|
||||
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 = {
|
||||
{'default:stick', '', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stonebrick',
|
||||
recipe = {
|
||||
{'default:stone', 'default:stone'},
|
||||
{'default:stone', 'default:stone'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "default:gunpowder",
|
||||
recipe = {
|
||||
'default:sand',
|
||||
'default:gravel',
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'dye:white 3',
|
||||
recipe = {
|
||||
{'default:bone'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:lapisblock',
|
||||
recipe = {
|
||||
{'dye:blue', 'dye:blue', 'dye:blue'},
|
||||
{'dye:blue', 'dye:blue', 'dye:blue'},
|
||||
{'dye:blue', 'dye:blue', 'dye:blue'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'dye:blue 9',
|
||||
recipe = {
|
||||
{'default:lapisblock'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:emeraldblock",
|
||||
recipe = {
|
||||
{'default:emerald', 'default:emerald', 'default:emerald'},
|
||||
{'default:emerald', 'default:emerald', 'default:emerald'},
|
||||
{'default:emerald', 'default:emerald', 'default:emerald'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:emerald 9',
|
||||
recipe = {
|
||||
{'default:emeraldblock'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:glowstone",
|
||||
recipe = {
|
||||
{'default:glowstone_dust', 'default:glowstone_dust'},
|
||||
{'default:glowstone_dust', 'default:glowstone_dust'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:glowstone_dust 4',
|
||||
recipe = {
|
||||
{'default:glowstone'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:redstone_dust',
|
||||
recipe = {{"mesecons:wire_00000000_off"}},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:apple_gold",
|
||||
recipe = {
|
||||
{"default:gold_nugget", "default:gold_nugget", "default:gold_nugget"},
|
||||
{"default:gold_nugget", 'default:apple', "default:gold_nugget"},
|
||||
{"default:gold_nugget", "default:gold_nugget", "default:gold_nugget"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:sugar",
|
||||
recipe = {
|
||||
{"default:reeds"},
|
||||
}
|
||||
})
|
||||
|
||||
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'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:quartz_block',
|
||||
recipe = {
|
||||
{'default:quartz_crystal', 'default:quartz_crystal'},
|
||||
{'default:quartz_crystal', 'default:quartz_crystal'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:quartz_chiseled 2',
|
||||
recipe = {
|
||||
{'stairs:slab_quartzblock'},
|
||||
{'stairs:slab_quartzblock'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:quartz_pillar 2',
|
||||
recipe = {
|
||||
{'default:quartz_block'},
|
||||
{'default:quartz_block'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- 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:stone",
|
||||
recipe = "default:cobble",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:steel_ingot",
|
||||
recipe = "default:stone_with_iron",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:gold_ingot",
|
||||
recipe = "default:stone_with_gold",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:clay_brick",
|
||||
recipe = "default:clay_lump",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:fish",
|
||||
recipe = "default:fish_raw",
|
||||
cooktime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:charcoal_lump",
|
||||
recipe = "group:tree",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:sponge",
|
||||
recipe = "default:sponge_wet",
|
||||
})
|
||||
|
||||
--
|
||||
-- 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:reeds",
|
||||
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 = "signs:sign_wall",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:chest",
|
||||
burntime = 30,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:sapling",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:apple",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:apple_gold",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:coal_lump",
|
||||
burntime = 40,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:haybale",
|
||||
burntime = 40,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:charcoal_lump",
|
||||
burntime = 45,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:junglesapling",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:grass_1",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
--Temporary
|
||||
--
|
||||
minetest.register_craft({
|
||||
output = "default:string",
|
||||
recipe = {{"default:paper", "default:paper"}},
|
||||
})
|
147
mods/default/craftitems.lua
Normal file
|
@ -0,0 +1,147 @@
|
|||
-- mods/default/craftitems.lua
|
||||
|
||||
--
|
||||
-- Crafting items
|
||||
--
|
||||
|
||||
minetest.register_craftitem("default:stick", {
|
||||
description = "Stick",
|
||||
inventory_image = "default_stick.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:paper", {
|
||||
description = "Paper",
|
||||
inventory_image = "default_paper.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:book", {
|
||||
description = "Book",
|
||||
inventory_image = "default_book.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:coal_lump", {
|
||||
description = "Coal Lump",
|
||||
inventory_image = "default_coal_lump.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:charcoal_lump", {
|
||||
description = "Charcoal Lump",
|
||||
inventory_image = "default_charcoal_lump.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:gold_nugget", {
|
||||
description = "Gold Nugget",
|
||||
inventory_image = "default_gold_nugget.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:diamond", {
|
||||
description = "Diamond",
|
||||
inventory_image = "default_diamond.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:clay_lump", {
|
||||
description = "Clay Lump",
|
||||
inventory_image = "default_clay_lump.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:steel_ingot", {
|
||||
description = "Steel Ingot",
|
||||
inventory_image = "default_steel_ingot.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:gold_ingot", {
|
||||
description = "Gold Ingot",
|
||||
inventory_image = "default_gold_ingot.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:emerald", {
|
||||
description = "Emerald",
|
||||
inventory_image = "default_emerald.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:clay_brick", {
|
||||
description = "Clay Brick",
|
||||
inventory_image = "default_clay_brick.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:flint", {
|
||||
description = "Flint",
|
||||
inventory_image = "default_flint.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:gunpowder", {
|
||||
description = "Gunpowder",
|
||||
inventory_image = "default_gunpowder.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:bone", {
|
||||
description = "Bone",
|
||||
inventory_image = "default_bone.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:glowstone_dust", {
|
||||
description = "Glowstone Dust",
|
||||
inventory_image = "default_glowstone_dust.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:fish_raw", {
|
||||
description = "Raw Fish",
|
||||
groups = {},
|
||||
inventory_image = "default_fish.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:fish", {
|
||||
description = "Cooked Fish",
|
||||
groups = {},
|
||||
inventory_image = "default_fish_cooked.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:sugar", {
|
||||
description = "Sugar",
|
||||
inventory_image = "default_sugar.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:string",{
|
||||
description = "String",
|
||||
inventory_image = "default_string.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:prismarine_cry", {
|
||||
description = "Prismarine Crystals",
|
||||
inventory_image = "default_prismarine_crystals.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:prismarine_shard", {
|
||||
description = "Prismarine Shard",
|
||||
inventory_image = "default_prismarine_shard.png",
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:quartz_crystal", {
|
||||
description = "Quartz Crystal",
|
||||
inventory_image = "default_quartz_crystal.png",
|
||||
stack_max = 64,
|
||||
})
|
885
mods/default/functions.lua
Normal file
|
@ -0,0 +1,885 @@
|
|||
--
|
||||
-- On Die
|
||||
--
|
||||
--if minetest.setting_get("keepInventory") == false then
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
local inv = player:get_inventory()
|
||||
local pos = player:getpos()
|
||||
for i,stack in ipairs(inv:get_list("main")) do
|
||||
local x = math.random(0, 9)/3
|
||||
local z = math.random(0, 9)/3
|
||||
pos.x = pos.x + x
|
||||
pos.z = pos.z + z
|
||||
minetest.env:add_item(pos, stack)
|
||||
stack:clear()
|
||||
inv:set_stack("main", i, stack)
|
||||
pos.x = pos.x - x
|
||||
pos.z = pos.z - z
|
||||
end
|
||||
end)
|
||||
--end
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
|
||||
default.cool_lava_source = function(pos)
|
||||
minetest.env:set_node(pos, {name="default:obsidian"})
|
||||
end
|
||||
|
||||
default.cool_lava_flowing = function(pos)
|
||||
minetest.env:set_node(pos, {name="default:stone"})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:lava_flowing"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
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 = 1,
|
||||
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
|
||||
--
|
||||
|
||||
-- Functions
|
||||
grow_cactus = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.env:get_node(pos).name
|
||||
if minetest.get_item_group(name, "sand") ~= 0 then
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.env: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.env:get_node(pos).name == "air" then
|
||||
minetest.env:set_node(pos, {name="default:cactus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
grow_reeds = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.env:get_node(pos).name
|
||||
if name == "default:dirt" or name == "default:dirt_with_grass" then
|
||||
if minetest.env:find_node_near(pos, 3, {"group:water"}) == nil then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.env:get_node(pos).name == "default:reeds" and height < 3 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 3 then
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:set_node(pos, {name="default:reeds"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ABMs
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:cactus"},
|
||||
neighbors = {"group:sand"},
|
||||
interval = 25,
|
||||
chance = 10,
|
||||
action = function(pos)
|
||||
grow_cactus(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:reeds"},
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 25,
|
||||
chance = 10,
|
||||
action = function(pos)
|
||||
grow_reeds(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- Papyrus and cactus drop
|
||||
--
|
||||
|
||||
local timber_nodenames={"default:reeds", "default:cactus"}
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while timber_nodenames[i]~=nil do
|
||||
if node.name==timber_nodenames[i] then
|
||||
np={x=pos.x, y=pos.y+1, z=pos.z}
|
||||
while minetest.env:get_node(np).name==timber_nodenames[i] do
|
||||
minetest.env:remove_node(np)
|
||||
minetest.env:add_item(np, timber_nodenames[i])
|
||||
np={x=np.x, y=np.y+1, z=np.z}
|
||||
end
|
||||
end
|
||||
i=i+1
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Flint and Steel
|
||||
--
|
||||
|
||||
function get_nodedef_field(nodename, fieldname)
|
||||
if not minetest.registered_nodes[nodename] then
|
||||
return nil
|
||||
end
|
||||
return minetest.registered_nodes[nodename][fieldname]
|
||||
end
|
||||
|
||||
function set_fire(pointed_thing)
|
||||
local n = minetest.env:get_node(pointed_thing.above)
|
||||
if n.name ~= "" and n.name == "air" and not minetest.is_protected(pointed_thing.above, "fire") then
|
||||
minetest.env:add_node(pointed_thing.above, {name="fire:basic_flame"})
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Fire Particles
|
||||
--
|
||||
|
||||
function add_fire(pos)
|
||||
local null = {x=0, y=0, z=0}
|
||||
pos.y = pos.y+0.19
|
||||
minetest.add_particle(pos, null, null, 1.1,
|
||||
1.5, true, "default_fire_particle"..tostring(math.random(1,2)) ..".png")
|
||||
pos.y = pos.y +0.01
|
||||
minetest.add_particle(pos, null, null, 0.8,
|
||||
1.5, true, "default_fire_particle"..tostring(math.random(1,2)) ..".png")
|
||||
end
|
||||
|
||||
--
|
||||
-- Bone Meal
|
||||
--
|
||||
|
||||
local n
|
||||
local n2
|
||||
local pos
|
||||
|
||||
function apple_leave()
|
||||
if math.random(0, 10) == 3 then
|
||||
return {name = "default:apple"}
|
||||
else
|
||||
return {name = "default:leaves"}
|
||||
end
|
||||
end
|
||||
|
||||
function air_leave()
|
||||
if math.random(0, 50) == 3 then
|
||||
return {name = "air"}
|
||||
else
|
||||
return {name = "default:leaves"}
|
||||
end
|
||||
end
|
||||
|
||||
function generate_tree(pos, trunk, leaves, typearbre)
|
||||
pos.y = pos.y-1
|
||||
local nodename = minetest.env:get_node(pos).name
|
||||
|
||||
pos.y = pos.y+1
|
||||
if not minetest.env:get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if typearbre == nil or typearbre == 1 then
|
||||
node = {name = ""}
|
||||
for dy=1,4 do
|
||||
pos.y = pos.y+dy
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
node = {name = trunk}
|
||||
for dy=0,4 do
|
||||
pos.y = pos.y+dy
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, node)
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
node = {name = leaves}
|
||||
pos.y = pos.y+3
|
||||
local rarity = 0
|
||||
if math.random(0, 10) == 3 then
|
||||
rarity = 1
|
||||
end
|
||||
for dx=-2,2 do
|
||||
for dz=-2,2 do
|
||||
for dy=0,3 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
|
||||
if dx == 0 and dz == 0 and dy==3 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
minetest.env:add_node(pos, apple_leave())
|
||||
else
|
||||
minetest.env:add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
elseif dx == 0 and dz == 0 and dy==4 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
minetest.env:add_node(pos, apple_leave())
|
||||
else
|
||||
minetest.env:add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
minetest.env:add_node(pos, apple_leave())
|
||||
else
|
||||
minetest.env:add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
minetest.env:add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
minetest.env:add_node(pos, apple_leave())
|
||||
else
|
||||
minetest.env:add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif typearbre == 2 then
|
||||
node = {name = ""}
|
||||
|
||||
-- can place big tree ?
|
||||
local tree_size = math.random(15, 25)
|
||||
for dy=1,4 do
|
||||
pos.y = pos.y+dy
|
||||
if minetest.env:get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
--Cheak for placing big tree
|
||||
pos.y = pos.y-1
|
||||
for dz=0,1 do
|
||||
pos.z = pos.z + dz
|
||||
--> 0
|
||||
if minetest.env:get_node(pos).name == "default:dirt_with_grass"
|
||||
or minetest.env:get_node(pos).name == "default:dirt" then else
|
||||
return
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
--> 1
|
||||
if minetest.env:get_node(pos).name == "default:dirt_with_grass"
|
||||
or minetest.env:get_node(pos).name == "default:dirt" then else
|
||||
return
|
||||
end
|
||||
pos.x = pos.x-1
|
||||
pos.z = pos.z - dz
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
|
||||
|
||||
-- Make tree with vine
|
||||
node = {name = trunk}
|
||||
for dy=0,tree_size do
|
||||
pos.y = pos.y+dy
|
||||
|
||||
for dz=-1,2 do
|
||||
if dz == -1 then
|
||||
pos.z = pos.z + dz
|
||||
if math.random(1, 3) == 1 and minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, {name = "default:vine", param2 = 4})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if math.random(1, 3) == 1 and minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, {name = "default:vine", param2 = 4})
|
||||
end
|
||||
pos.x = pos.x-1
|
||||
pos.z = pos.z - dz
|
||||
elseif dz == 2 then
|
||||
pos.z = pos.z + dz
|
||||
if math.random(1, 3) == 1 and minetest.env:get_node(pos).name == "air"then
|
||||
minetest.env:add_node(pos, {name = "default:vine", param2 = 5})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if math.random(1, 3) == 1 and minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, {name = "default:vine", param2 = 5})
|
||||
end
|
||||
pos.x = pos.x-1
|
||||
pos.z = pos.z - dz
|
||||
else
|
||||
pos.z = pos.z + dz
|
||||
pos.x = pos.x-1
|
||||
if math.random(1, 3) == 1 and minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, {name = "default:vine", param2 = 2})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, {name = trunk, param2=2})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, {name = trunk, param2=2})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if math.random(1, 3) == 1 and minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, {name = "default:vine", param2 = 3})
|
||||
end
|
||||
pos.x = pos.x-2
|
||||
pos.z = pos.z - dz
|
||||
end
|
||||
end
|
||||
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
-- make leaves
|
||||
node = {name = leaves}
|
||||
pos.y = pos.y+tree_size-4
|
||||
for dx=-5,5 do
|
||||
for dz=-5,5 do
|
||||
for dy=0,3 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
|
||||
if dx == 0 and dz == 0 and dy==3 then
|
||||
if minetest.env:get_node(pos).name == "air" or minetest.env:get_node(pos).name == "default:vine" and math.random(1, 2) == 1 then
|
||||
minetest.env:add_node(pos, node)
|
||||
end
|
||||
elseif dx == 0 and dz == 0 and dy==4 then
|
||||
if minetest.env:get_node(pos).name == "air" or minetest.env:get_node(pos).name == "default:vine" and math.random(1, 5) == 1 then
|
||||
minetest.env:add_node(pos, node)
|
||||
minetest.env:add_node(pos, air_leave())
|
||||
end
|
||||
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" or minetest.env:get_node(pos).name == "default:vine" then
|
||||
minetest.env:add_node(pos, node)
|
||||
end
|
||||
else
|
||||
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
|
||||
if minetest.env:get_node(pos).name == "air" or minetest.env:get_node(pos).name == "default:vine" and math.random(1, 3) == 1 then
|
||||
minetest.env:add_node(pos, node)
|
||||
end
|
||||
else
|
||||
if math.random(1, 5) == 1 and minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:add_node(pos, node)
|
||||
end
|
||||
end
|
||||
end
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local plant_tab = {}
|
||||
local rnd_max = 5
|
||||
minetest.after(0.5, function()
|
||||
plant_tab[0] = "air"
|
||||
plant_tab[1] = "default:grass"
|
||||
plant_tab[2] = "default:grass"
|
||||
plant_tab[3] = "default:grass"
|
||||
plant_tab[4] = "default:grass"
|
||||
plant_tab[5] = "default:grass"
|
||||
|
||||
if minetest.get_modpath("flowers") ~= nil then
|
||||
rnd_max = 16
|
||||
plant_tab[6] = "flowers:dandelion_yellow"
|
||||
plant_tab[7] = "flowers:rose"
|
||||
plant_tab[8] = "flowers:oxeye_daisy"
|
||||
plant_tab[9] = "flowers:tulip_orange"
|
||||
plant_tab[10] = "flowers:tulip_red"
|
||||
plant_tab[11] = "flowers:tulip_white"
|
||||
plant_tab[12] = "flowers:tulip_pink"
|
||||
plant_tab[13] = "flowers:allium"
|
||||
plant_tab[14] = "flowers:paeonia"
|
||||
plant_tab[15] = "flowers:houstonia"
|
||||
plant_tab[16] = "flowers:blue_orchid"
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
function duengen(pointed_thing)
|
||||
pos = pointed_thing.under
|
||||
n = minetest.env:get_node(pos)
|
||||
if n.name == "" then return end
|
||||
local stage = ""
|
||||
if n.name == "default:sapling" then
|
||||
minetest.env:add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:tree", "default:leaves", 1)
|
||||
elseif string.find(n.name, "farming:wheat_") ~= nil then
|
||||
stage = string.sub(n.name, 15)
|
||||
if stage == "3" then
|
||||
minetest.env:add_node(pos, {name="farming:wheat"})
|
||||
elseif math.random(1,5) < 3 then
|
||||
minetest.env:add_node(pos, {name="farming:wheat"})
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:wheat_"..math.random(2,3)})
|
||||
end
|
||||
elseif string.find(n.name, "farming:potato_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 16))
|
||||
if stage == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:potato_"..math.random(stage,2)})
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:potato"})
|
||||
end
|
||||
elseif string.find(n.name, "farming:carrot_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 16))
|
||||
if stage == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:carrot_"..math.random(stage,2)})
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:carrot"})
|
||||
end
|
||||
elseif string.find(n.name, "farming:pumpkin_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 17))
|
||||
if stage == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:pumpkin_"..math.random(stage,2)})
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:pumpkintige_unconnect"})
|
||||
end
|
||||
elseif string.find(n.name, "farming:melontige_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 18))
|
||||
if stage == 1 then
|
||||
minetest.env:add_node(pos, {name="farming:melontige_"..math.random(stage,2)})
|
||||
else
|
||||
minetest.env:add_node(pos, {name="farming:melontige_unconnect"})
|
||||
end
|
||||
elseif n.name ~= "" and n.name == "default:junglesapling" then
|
||||
minetest.env:add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:jungletree", "default:jungleleaves", 2)
|
||||
elseif n.name ~="" and n.name == "default:reeds" then
|
||||
grow_reeds(pos)
|
||||
elseif n.name ~="" and n.name == "default:cactus" then
|
||||
grow_cactus(pos)
|
||||
elseif n.name == "default:dirt_with_grass" then
|
||||
for i = -2, 3, 1 do
|
||||
for j = -3, 2, 1 do
|
||||
pos = pointed_thing.above
|
||||
pos = {x=pos.x+i, y=pos.y, z=pos.z+j}
|
||||
n = minetest.env:get_node(pos)
|
||||
n2 = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
|
||||
if n.name ~= "" and n.name == "air" and n2.name == "default:dirt_with_grass" then
|
||||
if math.random(0,5) > 3 then
|
||||
minetest.env:add_node(pos, {name=plant_tab[math.random(0, rnd_max)]})
|
||||
else
|
||||
minetest.env:add_node(pos, {name=plant_tab[math.random(0, 5)]})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
------------------------------
|
||||
-- Try generate grass dirt ---
|
||||
------------------------------
|
||||
-- turn dirt to dirt with grass
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt"},
|
||||
neighbors = {"air"},
|
||||
interval = 30,
|
||||
chance = 20,
|
||||
action = function(pos)
|
||||
local can_change = 0
|
||||
for i=1,4 do
|
||||
p = {x=pos.x, y=pos.y+i, z=pos.z}
|
||||
n = minetest.env:get_node(p)
|
||||
-- On verifie si il y a de l'air
|
||||
if (n.name=="air") then
|
||||
can_change = can_change + 1
|
||||
end
|
||||
end
|
||||
if can_change > 3 then
|
||||
local light = minetest.get_node_light(pos)
|
||||
if light or light > 10 then
|
||||
minetest.env:add_node(pos, {name="default:dirt_with_grass"})
|
||||
end
|
||||
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
--------------------------
|
||||
-- Try generate tree ---
|
||||
--------------------------
|
||||
-- Normal tree
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:sapling"},
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 30,
|
||||
chance = 15,
|
||||
action = function(pos)
|
||||
local light = minetest.get_node_light(pos)
|
||||
if light or light > 10 then
|
||||
minetest.env:add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:tree", "default:leaves", 1)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Jungle Tree
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:junglesapling"},
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 30,
|
||||
chance = 15,
|
||||
action = function(pos)
|
||||
local light = minetest.get_node_light(pos)
|
||||
if light or light > 10 then
|
||||
minetest.env:add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:jungletree", "default:jungleleaves", 2)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
---------------------
|
||||
-- Vine generating --
|
||||
---------------------
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:vine"},
|
||||
interval = 80,
|
||||
chance = 5,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local newpos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(newpos)
|
||||
if n.name == "air" then
|
||||
walldir = node.param2
|
||||
minetest.env:add_node(newpos, {name = "default:vine", param2 = walldir})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Snowballs
|
||||
--
|
||||
|
||||
snowball_GRAVITY=9
|
||||
snowball_VELOCITY=19
|
||||
|
||||
--Shoot snowball.
|
||||
snow_shoot_snowball=function (item, player, pointed_thing)
|
||||
local playerpos=player:getpos()
|
||||
local obj=minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "default:snowball_entity")
|
||||
local dir=player:get_look_dir()
|
||||
obj:setvelocity({x=dir.x*snowball_VELOCITY, y=dir.y*snowball_VELOCITY, z=dir.z*snowball_VELOCITY})
|
||||
obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3})
|
||||
item:take_item()
|
||||
return item
|
||||
end
|
||||
|
||||
--The snowball Entity
|
||||
snowball_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
textures = {"default_snowball.png"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
}
|
||||
|
||||
--Snowball_entity.on_step()--> called when snowball is moving.
|
||||
snowball_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.env:get_node(pos)
|
||||
|
||||
--Become item when hitting a node.
|
||||
if self.lastpos.x~=nil then --If there is no lastpos for some reason.
|
||||
if node.name ~= "air" then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z} -- Set lastpos-->Node will be added at last pos outside the node
|
||||
end
|
||||
|
||||
minetest.register_entity("default:snowball_entity", snowball_ENTITY)
|
||||
|
||||
-- Global environment step function
|
||||
function on_step(dtime)
|
||||
-- print("on_step")
|
||||
end
|
||||
minetest.register_globalstep(on_step)
|
||||
|
||||
function on_placenode(p, node)
|
||||
--print("on_placenode")
|
||||
end
|
||||
minetest.register_on_placenode(on_placenode)
|
||||
|
||||
function on_dignode(p, node)
|
||||
--print("on_dignode")
|
||||
end
|
||||
minetest.register_on_dignode(on_dignode)
|
||||
|
||||
function on_punchnode(p, node)
|
||||
end
|
||||
minetest.register_on_punchnode(on_punchnode)
|
||||
|
||||
-- END
|
||||
|
||||
-- Support old code
|
||||
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
|
||||
|
||||
--Sounds
|
||||
|
||||
|
||||
--
|
||||
-- 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.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_sand_footstep", gain=1.0}
|
||||
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.85}
|
||||
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
|
||||
|
||||
-- Leaf Decay
|
||||
|
||||
-- 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
|
||||
|
||||
default.leafdecay_trunk_cache = {}
|
||||
default.leafdecay_enable_cache = true
|
||||
-- Spread the load of finding trunks
|
||||
default.leafdecay_trunk_find_allow_accumulator = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
local finds_per_second = 5000
|
||||
default.leafdecay_trunk_find_allow_accumulator =
|
||||
math.floor(dtime * finds_per_second)
|
||||
end)
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:leafdecay"},
|
||||
neighbors = {"air", "group:liquid"},
|
||||
-- A low interval and a high inverse chance spreads the load
|
||||
interval = 2,
|
||||
chance = 5,
|
||||
|
||||
action = function(p0, node, _, _)
|
||||
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
|
||||
local do_preserve = false
|
||||
local d = minetest.registered_nodes[node.name].groups.leafdecay
|
||||
if not d or d == 0 then
|
||||
--print("not groups.leafdecay")
|
||||
return
|
||||
end
|
||||
local n0 = minetest.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
|
||||
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
|
||||
})
|
||||
|
||||
------------------------
|
||||
-- Create Color Glass --
|
||||
------------------------
|
||||
function AddGlass(desc, recipeitem, color)
|
||||
|
||||
minetest.register_node("default:glass"..color, {
|
||||
description = desc,
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"xpanes_pane_glass"..color..".png"},
|
||||
inventory_image = minetest.inventorycube("xpanes_pane_glass"..color..".png"),
|
||||
paramtype = "light",
|
||||
use_texture_alpha = true,
|
||||
stack_max = 64,
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drop = "",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:glass_'..color..'',
|
||||
recipe = {
|
||||
{'default:glass', 'group:dye,'..recipeitem}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
27
mods/default/init.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
-- Minetest 0.4 mod: default
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
-- The API documentation in here was moved into doc/lua_api.txt
|
||||
|
||||
WATER_ALPHA = 160
|
||||
WATER_VISC = 1
|
||||
LAVA_VISC = 7
|
||||
LIGHT_MAX = 20
|
||||
|
||||
-- Definitions made by this mod that other mods can use too
|
||||
default = {}
|
||||
|
||||
-- Load files
|
||||
dofile(minetest.get_modpath("default").."/functions.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")
|
||||
|
||||
-- Aliases
|
||||
minetest.register_alias("default:desert_sand", "default:sand")
|
||||
minetest.register_alias("default:desert_stone", "default:sandstone")
|
||||
minetest.register_alias("default:iron_lump", "default:stone_with_iron")
|
||||
minetest.register_alias("default:gold_lump", "default:stone_with_gold")
|
509
mods/default/mapgen.lua
Normal file
|
@ -0,0 +1,509 @@
|
|||
-- mods/default/mapgen.lua
|
||||
|
||||
--
|
||||
-- Aliases for map generator outputs
|
||||
--
|
||||
|
||||
minetest.register_alias("mapgen_air", "air")
|
||||
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:leaves")
|
||||
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_desert_sand", "default:sand")
|
||||
minetest.register_alias("mapgen_desert_stone", "default:sandstone")
|
||||
|
||||
--
|
||||
-- Ore generation
|
||||
--
|
||||
|
||||
--
|
||||
-- Coal
|
||||
--
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 500,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -12,
|
||||
})
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 1000,
|
||||
clust_num_ores = 6,
|
||||
clust_size = 3,
|
||||
height_min = -11,
|
||||
height_max = 64,
|
||||
})
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 5000,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 2,
|
||||
height_min = 65,
|
||||
height_max = 67,
|
||||
})
|
||||
|
||||
--
|
||||
-- Iron
|
||||
--
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 830,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -10,
|
||||
})
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 1660,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -9,
|
||||
height_max = 0,
|
||||
})
|
||||
|
||||
--
|
||||
-- Gold
|
||||
--
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 5000,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -35,
|
||||
})
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -35,
|
||||
height_max = -33,
|
||||
})
|
||||
|
||||
--
|
||||
-- Diamond
|
||||
--
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 5000,
|
||||
clust_num_ores = 2,
|
||||
clust_size = 2,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = -55,
|
||||
height_max = -52,
|
||||
})
|
||||
|
||||
--
|
||||
-- Redstone
|
||||
--
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_redstone",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_redstone",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 10,
|
||||
clust_size = 4,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
|
||||
--
|
||||
-- Emerald
|
||||
--
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_emerald",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 2,
|
||||
height_min = -59,
|
||||
height_max = -35,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_emerald",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 50000,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -59,
|
||||
height_max = -35,
|
||||
})
|
||||
|
||||
--
|
||||
-- Lapis Lazuli
|
||||
--
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_lapis",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 7,
|
||||
clust_size = 4,
|
||||
height_min = -50,
|
||||
height_max = -46,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_lapis",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 4,
|
||||
height_min = -59,
|
||||
height_max = -50,
|
||||
})
|
||||
|
||||
--
|
||||
-- Glowstone
|
||||
--
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:glowstone",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 50000,
|
||||
clust_num_ores = 10,
|
||||
clust_size = 5,
|
||||
height_min = -59,
|
||||
height_max = -0,
|
||||
})
|
||||
|
||||
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.env:get_node(p2).name == wherein then
|
||||
minetest.env:set_node(p2, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--print("generate_ore done")
|
||||
end
|
||||
|
||||
function default.make_reeds(pos, size)
|
||||
for y=0,size-1 do
|
||||
local p = {x=pos.x, y=pos.y+y, z=pos.z}
|
||||
local nn = minetest.env:get_node(p).name
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
minetest.env:set_node(p, {name="default:reeds"})
|
||||
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.env:get_node(p).name
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
minetest.env:set_node(p, {name="default:cactus"})
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Generate clay
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 4
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=0+1,divs-1-1 do
|
||||
for divz=0+1,divs-1-1 do
|
||||
local cx = minp.x + math.floor((divx+0.5)*divlen)
|
||||
local cz = minp.z + math.floor((divz+0.5)*divlen)
|
||||
if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
|
||||
minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then
|
||||
local is_shallow = true
|
||||
local num_water_around = 0
|
||||
if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if num_water_around >= 2 then
|
||||
is_shallow = false
|
||||
end
|
||||
if is_shallow then
|
||||
for x1=-divlen,divlen do
|
||||
for z1=-divlen,divlen do
|
||||
if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
|
||||
minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generate reeds
|
||||
local perlin1 = minetest.env: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 reeds amount from perlin noise
|
||||
local reeds_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20)
|
||||
-- Find random positions for reeds based on this random
|
||||
local pr = PseudoRandom(seed+1)
|
||||
for i=0,reeds_amount do
|
||||
local x = pr:next(x0, x1)
|
||||
local z = pr:next(z0, z1)
|
||||
if minetest.env:get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and
|
||||
minetest.env:find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then
|
||||
default.make_reeds({x=x,y=2,z=z}, pr:next(2, 4))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generate cactuses
|
||||
local perlin1 = minetest.env: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.env: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.env: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}, pr:next(3, 4))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generate grass
|
||||
local perlin1 = minetest.env:get_perlin(329, 3, 0.6, 100)
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 5
|
||||
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}) * 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.env: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.env: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.env:get_node({x=x,y=ground_y,z=z}).name
|
||||
-- If desert sand, add dry shrub
|
||||
if nn == "default:desert_sand" then
|
||||
minetest.env:set_node(p,{name="default:dry_shrub"})
|
||||
|
||||
-- If dirt with grass, add grass
|
||||
elseif nn == "default:dirt_with_grass" then
|
||||
minetest.env:set_node(p,{name="default:grass"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate nyan cats
|
||||
--generate_nyancats(seed, minp, maxp)
|
||||
end)
|
||||
|
||||
local function replace(old, new, min, max)
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = new,
|
||||
wherein = old,
|
||||
clust_scarcity = 1,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
height_min = min,
|
||||
height_max = max,
|
||||
})
|
||||
end
|
||||
replace("air", "default:bedrock", -90, -80)
|
||||
replace("air", "default:lava_source", -80, -70)
|
||||
replace("default:stone", "default:bedrock", -90, -80)
|
||||
replace("default:gravel", "default:bedrock", -90, -80)
|
||||
replace("default:dirt", "default:bedrock", -90, -80)
|
||||
replace("default:sand", "default:bedrock", -90, -80)
|
||||
replace("default:cobble", "default:bedrock", -90, -80)
|
||||
replace("default:mossycobble", "default:bedrock", -90, -80)
|
||||
replace("stairs:stair_cobble", "default:bedrock", -90, -80)
|
||||
replace("default:lava_source", "default:bedrock", -90, -80)
|
||||
replace("default:lava_flowing", "default:bedrock", -90, -80)
|
||||
replace("default:water_source", "default:bedrock", -90, -80)
|
||||
replace("default:water_flowing", "default:bedrock", -90, -80)
|
||||
|
||||
local function bedrock(old)
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:bedrock",
|
||||
wherein = old,
|
||||
clust_scarcity = 5,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -64,
|
||||
height_max = -60,
|
||||
})
|
||||
end
|
||||
bedrock("air")
|
||||
bedrock("default:stone")
|
||||
bedrock("default:gravel")
|
||||
bedrock("default:dirt")
|
||||
bedrock("default:sand")
|
||||
bedrock("default:cobble")
|
||||
bedrock("default:mossycobble")
|
||||
bedrock("stairs:stair_cobble")
|
||||
bedrock("default:lava_source")
|
||||
bedrock("default:lava_flowing")
|
||||
bedrock("default:water_source")
|
||||
bedrock("default:water_flowing")
|
||||
|
BIN
mods/default/models/character.blend
Normal file
BIN
mods/default/models/character.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
6556
mods/default/models/character.x
Normal file
1889
mods/default/nodes.lua
Normal file
201
mods/default/player.lua
Normal file
|
@ -0,0 +1,201 @@
|
|||
-- 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 = 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.x")
|
||||
player:set_physics_override({sneak_glitch=false})
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
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 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)
|
BIN
mods/default/sounds/default_break_glass.1.ogg
Normal file
BIN
mods/default/sounds/default_break_glass.2.ogg
Normal file
BIN
mods/default/sounds/default_break_glass.3.ogg
Normal file
BIN
mods/default/sounds/default_cool_lava.1.ogg
Normal file
BIN
mods/default/sounds/default_cool_lava.2.ogg
Normal file
BIN
mods/default/sounds/default_cool_lava.3.ogg
Normal file
BIN
mods/default/sounds/default_dig_choppy.ogg
Normal file
BIN
mods/default/sounds/default_dig_cracky.ogg
Normal file
BIN
mods/default/sounds/default_dig_crumbly.ogg
Normal file
BIN
mods/default/sounds/default_dig_dig_immediate.ogg
Normal file
BIN
mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg
Normal file
BIN
mods/default/sounds/default_dirt_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_dirt_footstep.2.ogg
Normal file
BIN
mods/default/sounds/default_dug_node.1.ogg
Normal file
BIN
mods/default/sounds/default_dug_node.2.ogg
Normal file
BIN
mods/default/sounds/default_glass_footstep.ogg
Normal file
BIN
mods/default/sounds/default_grass_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_grass_footstep.2.ogg
Normal file
BIN
mods/default/sounds/default_grass_footstep.3.ogg
Normal file
BIN
mods/default/sounds/default_gravel_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_gravel_footstep.2.ogg
Normal file
BIN
mods/default/sounds/default_gravel_footstep.3.ogg
Normal file
BIN
mods/default/sounds/default_gravel_footstep.4.ogg
Normal file
BIN
mods/default/sounds/default_hard_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_hard_footstep.2.ogg
Normal file
BIN
mods/default/sounds/default_hard_footstep.3.ogg
Normal file
BIN
mods/default/sounds/default_place_node.1.ogg
Normal file
BIN
mods/default/sounds/default_place_node.2.ogg
Normal file
BIN
mods/default/sounds/default_place_node.3.ogg
Normal file
BIN
mods/default/sounds/default_place_node_hard.1.ogg
Normal file
BIN
mods/default/sounds/default_place_node_hard.2.ogg
Normal file
BIN
mods/default/sounds/default_sand_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_sand_footstep.2.ogg
Normal file
BIN
mods/default/sounds/default_snow_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_snow_footstep.2.ogg
Normal file
BIN
mods/default/sounds/default_snow_footstep.3.ogg
Normal file
BIN
mods/default/sounds/default_wood_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_wood_footstep.2.ogg
Normal file
BIN
mods/default/textures/bubble.png
Normal file
After Width: | Height: | Size: 240 B |
BIN
mods/default/textures/crack_anylength.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
mods/default/textures/default_acacialeaves.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
mods/default/textures/default_acaciasapling.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
mods/default/textures/default_acaciatree.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
mods/default/textures/default_acaciatree_top.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
mods/default/textures/default_acaciawood.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
mods/default/textures/default_apple.png
Normal file
After Width: | Height: | Size: 411 B |
BIN
mods/default/textures/default_apple_gold.png
Normal file
After Width: | Height: | Size: 293 B |
BIN
mods/default/textures/default_bedrock.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
mods/default/textures/default_bone.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
mods/default/textures/default_book.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
mods/default/textures/default_bookshelf.png
Normal file
After Width: | Height: | Size: 586 B |
BIN
mods/default/textures/default_brick.png
Normal file
After Width: | Height: | Size: 658 B |
BIN
mods/default/textures/default_cactus_bottom.png
Normal file
After Width: | Height: | Size: 187 B |
BIN
mods/default/textures/default_cactus_side.png
Normal file
After Width: | Height: | Size: 939 B |
BIN
mods/default/textures/default_cactus_top.png
Normal file
After Width: | Height: | Size: 718 B |
BIN
mods/default/textures/default_charcoal_lump.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
mods/default/textures/default_chest_bg.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
mods/default/textures/default_chest_front.png
Normal file
After Width: | Height: | Size: 659 B |
BIN
mods/default/textures/default_chest_front_big.png
Normal file
After Width: | Height: | Size: 567 B |
BIN
mods/default/textures/default_chest_side.png
Normal file
After Width: | Height: | Size: 555 B |
BIN
mods/default/textures/default_chest_side_big.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
mods/default/textures/default_chest_top.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
mods/default/textures/default_chest_top_big.png
Normal file
After Width: | Height: | Size: 496 B |
BIN
mods/default/textures/default_clay.png
Normal file
After Width: | Height: | Size: 736 B |
BIN
mods/default/textures/default_clay_brick.png
Normal file
After Width: | Height: | Size: 360 B |
BIN
mods/default/textures/default_clay_lump.png
Normal file
After Width: | Height: | Size: 372 B |
BIN
mods/default/textures/default_cloud.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
mods/default/textures/default_coal_block.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
mods/default/textures/default_coal_lump.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
mods/default/textures/default_cobble.png
Normal file
After Width: | Height: | Size: 894 B |
BIN
mods/default/textures/default_diamond.png
Normal file
After Width: | Height: | Size: 375 B |
BIN
mods/default/textures/default_diamond_block.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
mods/default/textures/default_dirt.png
Normal file
After Width: | Height: | Size: 910 B |
BIN
mods/default/textures/default_dry_shrub.png
Normal file
After Width: | Height: | Size: 385 B |
BIN
mods/default/textures/default_emerald.png
Normal file
After Width: | Height: | Size: 491 B |
BIN
mods/default/textures/default_emerald_block.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
mods/default/textures/default_fence.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
mods/default/textures/default_fire_particle1.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
mods/default/textures/default_fire_particle2.png
Normal file
After Width: | Height: | Size: 582 B |
BIN
mods/default/textures/default_fish.png
Normal file
After Width: | Height: | Size: 342 B |
BIN
mods/default/textures/default_fish_cooked.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
mods/default/textures/default_flint.png
Normal file
After Width: | Height: | Size: 253 B |
BIN
mods/default/textures/default_furnace_bg.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
mods/default/textures/default_furnace_bottom.png
Normal file
After Width: | Height: | Size: 881 B |
BIN
mods/default/textures/default_furnace_fire_bg.png
Normal file
After Width: | Height: | Size: 838 B |
BIN
mods/default/textures/default_furnace_fire_fg.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
mods/default/textures/default_furnace_front.png
Normal file
After Width: | Height: | Size: 806 B |
BIN
mods/default/textures/default_furnace_front_active.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mods/default/textures/default_furnace_side.png
Normal file
After Width: | Height: | Size: 779 B |