Add player skin choosing by nick.

master
Sullome 2014-07-10 20:45:36 +04:00
parent 57c89512b9
commit 77e3fa0ac1
177 changed files with 8067 additions and 6908 deletions

View File

@ -27,7 +27,6 @@ Cisoun's WTFPL texture pack:
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_stone_brick.png
default_dirt.png
default_grass.png
default_grass_side.png
@ -38,23 +37,14 @@ Cisoun's WTFPL texture pack:
default_sapling.png
default_sign_wall.png
default_stone.png
default_tool_mesepick.png
default_tool_steelpick.png
default_tool_steelshovel.png
default_tool_stonepick.png
default_tool_stoneshovel.png
default_tool_woodpick.png
default_tool_woodshovel.png
default_tree.png
default_tree_top.png
default_water.png
Originating from G4JC's Almost MC Texture Pack:
default_wood.png
default_torch.png
default_torch_on_ceiling.png
default_torch_on_floor.png
default_cobble.png
VanessaE's animated torches (WTFPL):
default_torch_animated.png
@ -80,11 +70,7 @@ VanessaE (WTFPL):
Calinou (CC BY-SA):
default_brick.png
default_clay_brick.png
default_papyrus.png
default_tool_steelsword.png
default_bronze_ingot.png
default_copper_ingot.png
default_copper_lump.png
default_mineral_copper.png
@ -101,21 +87,8 @@ PilzAdam (WTFPL):
default_obsidian_glass.png
default_obsidian_shard.png
default_mossycobble.png
default_gold_ingot.png
default_gold_lump.png
default_mineral_gold.png
default_diamond.png
default_tool_diamondpick.png
default_tool_diamondsword.png
default_tool_diamondshovel.png
default_tool_diamondaxe.png
default_tool_meseaxe.png
default_tool_meseshovel.png
default_tool_mesesword.png
default_tool_bronzeaxe.png
default_tool_bronzepick.png
default_tool_bronzeshovel.png
default_tool_bronzesword.png
default_snowball.png
jojoa1997 (WTFPL):
@ -135,10 +108,33 @@ Zeg9 (CC BY-SA 3.0):
default_copper_block.png
default_bronze_block.png
default_gold_block.png
default_diamond_block.png
kaeza (WTFPL):
paramat (CC BY-SA 3.0):
wieldhand.png, based on character.png by Jordach (CC BY-SA 3.0)
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_stone_brick.png
default_wood.png
default_cobble.png
default_clay_brick.png
default_tool_steelsword.png
default_bronze_ingot.png
default_copper_ingot.png
default_gold_ingot.png
default_diamond.png
default_diamond_block.png
default_tool_*.png
default_lava_source_animated.png
default_lava_flowing_animated.png
default_book.png
default_paper.png
default_stick.png
bubble.png
heart.png
gui_*.png
Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/

67
default/aliases.lua Normal file
View File

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

View File

@ -208,6 +208,60 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'default:axe_wood',
recipe = {
{'group:wood', 'group:wood'},
{'default:stick', 'group:wood'},
{'default:stick',''},
}
})
minetest.register_craft({
output = 'default:axe_stone',
recipe = {
{'group:stone', 'group:stone'},
{'default:stick', 'group:stone'},
{'default:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_steel',
recipe = {
{'default:steel_ingot', 'default:steel_ingot'},
{'default:stick', 'default:steel_ingot'},
{'default:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_bronze',
recipe = {
{'default:bronze_ingot', 'default:bronze_ingot'},
{'default:stick', 'default:bronze_ingot'},
{'default:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_mese',
recipe = {
{'default:mese_crystal', 'default:mese_crystal'},
{'default:stick', 'default:mese_crystal'},
{'default:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_diamond',
recipe = {
{'default:diamond', 'default:diamond'},
{'default:stick', 'default:diamond'},
{'default:stick', ''},
}
})
minetest.register_craft({
output = 'default:sword_wood',
recipe = {
@ -416,7 +470,7 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:sandstonebrick',
output = 'default:sandstonebrick 4',
recipe = {
{'default:sandstone', 'default:sandstone'},
{'default:sandstone', 'default:sandstone'},
@ -520,7 +574,7 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:stonebrick',
output = 'default:stonebrick 4',
recipe = {
{'default:stone', 'default:stone'},
{'default:stone', 'default:stone'},
@ -528,7 +582,7 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:desert_stonebrick',
output = 'default:desert_stonebrick 4',
recipe = {
{'default:desert_stone', 'default:desert_stone'},
{'default:desert_stone', 'default:desert_stone'},
@ -581,6 +635,12 @@ minetest.register_craft({
recipe = "default:cobble",
})
minetest.register_craft({
type = "cooking",
output = "default:desert_stone",
recipe = "default:desert_cobble",
})
minetest.register_craft({
type = "cooking",
output = "default:steel_ingot",

View File

@ -81,11 +81,6 @@ minetest.register_craftitem("default:clay_brick", {
inventory_image = "default_clay_brick.png",
})
minetest.register_craftitem("default:scorched_stuff", {
description = "Scorched Stuff",
inventory_image = "default_scorched_stuff.png",
})
minetest.register_craftitem("default:obsidian_shard", {
description = "Obsidian Shard",
inventory_image = "default_obsidian_shard.png",

View File

@ -266,6 +266,19 @@ minetest.register_abm({
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
--

View File

@ -11,6 +11,30 @@ LIGHT_MAX = 14
-- Definitions made by this mod that other mods can use too
default = {}
-- 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_suvival_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]"..
default.get_hotbar_bg(0,4.25)
-- Load files
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/nodes.lua")
@ -18,4 +42,6 @@ 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")

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

7457
default/models/character.x Normal file

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ minetest.register_node("default:desert_stone", {
tiles = {"default_desert_stone.png"},
is_ground_content = true,
groups = {cracky=3, stone=1},
drop = 'default:desert_stone',
drop = 'default:desert_cobble',
legacy_mineral = true,
sounds = default.node_sound_stone_defaults(),
})
@ -255,10 +255,10 @@ minetest.register_node("default:junglewood", {
minetest.register_node("default:jungleleaves", {
description = "Jungle Leaves",
drawtype = "allfaces_optional",
waving = 1,
visual_scale = 1.3,
tiles = {"default_jungleleaves.png"},
paramtype = "light",
waving = 1,
is_ground_content = false,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
drop = {
@ -299,6 +299,7 @@ minetest.register_node("default:junglesapling", {
minetest.register_node("default:junglegrass", {
description = "Jungle Grass",
drawtype = "plantlike",
waving = 1,
visual_scale = 1.3,
tiles = {"default_junglegrass.png"},
inventory_image = "default_junglegrass.png",
@ -318,10 +319,10 @@ minetest.register_node("default:junglegrass", {
minetest.register_node("default:leaves", {
description = "Leaves",
drawtype = "allfaces_optional",
waving = 1,
visual_scale = 1.3,
tiles = {"default_leaves.png"},
paramtype = "light",
waving = 1,
is_ground_content = false,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
drop = {
@ -349,7 +350,10 @@ minetest.register_node("default:cactus", {
is_ground_content = true,
groups = {snappy=1,choppy=3,flammable=2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
on_place = minetest.rotate_node,
after_dig_node = function(pos, node, metadata, digger)
default.dig_up(pos, node, digger)
end,
})
minetest.register_node("default:papyrus", {
@ -367,14 +371,77 @@ minetest.register_node("default:papyrus", {
},
groups = {snappy=3,flammable=2},
sounds = default.node_sound_leaves_defaults(),
after_dig_node = function(pos, node, metadata, digger)
default.dig_up(pos, node, digger)
end,
})
default.bookshelf_formspec =
"size[8,7;]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;books;0,0.3;8,2;]"..
"list[current_player;main;0,2.85;8,1;]"..
"list[current_player;main;0,4.08;8,3;8]"..
default.get_hotbar_bg(0,2.85)
minetest.register_node("default:bookshelf", {
description = "Bookshelf",
tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
is_ground_content = false,
groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", default.bookshelf_formspec)
local inv = meta:get_inventory()
inv:set_size("books", 8*2)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("books")
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
if listname == "books" then
if stack:get_name() == "default:book" then
return 1
else
return 0
end
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
local to_stack = inv:get_stack(to_list, to_index)
if to_list == "books" then
if stack:get_name() == "default:book" and to_stack:is_empty() then
return 1
else
return 0
end
end
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in bookshelf at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to bookshelf at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from bookshelf at "..minetest.pos_to_string(pos))
end,
})
minetest.register_node("default:glass", {
@ -389,12 +456,13 @@ minetest.register_node("default:glass", {
sounds = default.node_sound_glass_defaults(),
})
local fence_texture = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126"
minetest.register_node("default:fence_wood", {
description = "Wooden Fence",
drawtype = "fencelike",
tiles = {"default_wood.png"},
inventory_image = "default_fence.png",
wield_image = "default_fence.png",
inventory_image = fence_texture,
wield_image = fence_texture,
paramtype = "light",
is_ground_content = false,
selection_box = {
@ -665,16 +733,26 @@ minetest.register_node("default:sign_wall", {
default.chest_formspec =
"size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
default.get_hotbar_bg(0,4.85)
function default.get_locked_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec =
"size[8,9]"..
"list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"
return formspec
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[nodemeta:".. spos .. ";main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
default.get_hotbar_bg(0,4.85)
return formspec
end
@ -750,10 +828,6 @@ minetest.register_node("default:chest_locked", {
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return count
@ -761,10 +835,6 @@ minetest.register_node("default:chest_locked", {
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_count()
@ -772,18 +842,10 @@ minetest.register_node("default:chest_locked", {
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
return 0
end
return stack:get_count()
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
" moves stuff in locked chest at "..minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" moves stuff to locked chest at "..minetest.pos_to_string(pos))
@ -804,25 +866,54 @@ minetest.register_node("default:chest_locked", {
end,
})
function default.furnace_active(pos, 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-percent)..":default_furnace_fire_fg.png]"..
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
(item_percent*100)..":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]"..
default.get_hotbar_bg(0,4.25)
return formspec
end
function default.get_furnace_active_formspec(pos, percent)
local formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
return formspec
local meta = minetest.get_meta(pos)local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local cooked = nil
local aftercooked = nil
if srclist then
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
local item_percent = 0
if cooked then
item_percent = meta:get_float("src_time")/cooked.time
end
return default.furnace_active(pos, percent, item_percent)
end
default.furnace_inactive_formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
"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]"..
default.get_hotbar_bg(0,4.25)
minetest.register_node("default:furnace", {
description = "Furnace",
@ -855,6 +946,9 @@ minetest.register_node("default:furnace", {
return true
end,
allow_metadata_inventory_put = function(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
@ -873,6 +967,9 @@ minetest.register_node("default:furnace", {
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, 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()
local stack = inv:get_stack(from_list, from_index)
@ -891,12 +988,33 @@ minetest.register_node("default:furnace", {
return 0
end
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
})
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", "default_furnace_front_active.png"},
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",
@ -926,6 +1044,9 @@ minetest.register_node("default:furnace_active", {
return true
end,
allow_metadata_inventory_put = function(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
@ -944,6 +1065,9 @@ minetest.register_node("default:furnace_active", {
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, 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()
local stack = inv:get_stack(from_list, from_index)
@ -962,6 +1086,12 @@ minetest.register_node("default:furnace_active", {
return 0
end
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
})
local function swap_node(pos,name)
@ -1042,7 +1172,7 @@ minetest.register_abm({
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
if fuel.time <= 0 then
if not fuel or fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
swap_node(pos,"default:furnace")
meta:set_string("formspec", default.furnace_inactive_formspec)
@ -1073,6 +1203,14 @@ minetest.register_node("default:cobble", {
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:desert_cobble", {
description = "Desert Cobblestone",
tiles = {"default_desert_cobble.png"},
is_ground_content = true,
groups = {cracky=3, stone=2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:mossycobble", {
description = "Mossy Cobblestone",
tiles = {"default_mossycobble.png"},
@ -1223,12 +1361,12 @@ minetest.register_node("default:apple", {
minetest.register_node("default:dry_shrub", {
description = "Dry Shrub",
drawtype = "plantlike",
waving = 1,
visual_scale = 1.0,
tiles = {"default_dry_shrub.png"},
inventory_image = "default_dry_shrub.png",
wield_image = "default_dry_shrub.png",
paramtype = "light",
waving = 1,
walkable = false,
is_ground_content = true,
buildable_to = true,
@ -1243,6 +1381,7 @@ minetest.register_node("default:dry_shrub", {
minetest.register_node("default:grass_1", {
description = "Grass",
drawtype = "plantlike",
waving = 1,
tiles = {"default_grass_1.png"},
-- use a bigger inventory image
inventory_image = "default_grass_3.png",
@ -1265,80 +1404,27 @@ minetest.register_node("default:grass_1", {
end,
})
minetest.register_node("default:grass_2", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_2.png"},
inventory_image = "default_grass_2.png",
wield_image = "default_grass_2.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "default:grass_1",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:grass_3", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_3.png"},
inventory_image = "default_grass_3.png",
wield_image = "default_grass_3.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "default:grass_1",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:grass_4", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_4.png"},
inventory_image = "default_grass_4.png",
wield_image = "default_grass_4.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "default:grass_1",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:grass_5", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_5.png"},
inventory_image = "default_grass_5.png",
wield_image = "default_grass_5.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "default:grass_1",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
for i=2,5 do
minetest.register_node("default:grass_"..i, {
description = "Grass",
drawtype = "plantlike",
waving = 1,
tiles = {"default_grass_"..i..".png"},
inventory_image = "default_grass_"..i..".png",
wield_image = "default_grass_"..i..".png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "default:grass_1",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
end
minetest.register_node("default:ice", {
description = "Ice",

208
default/player.lua Normal file
View File

@ -0,0 +1,208 @@
-- 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_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
default.player_set_textures(player, {player:get_player_name() .. ".png"})
-- set GUI
if not minetest.setting_getbool("creative_mode") then
player:set_inventory_formspec(default.gui_suvival_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
-- 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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 649 B

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 B

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 B

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 906 B

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 364 B

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