Merge remote-tracking branch 'github/stable-5' into nalc-1.1-dev
@ -4,14 +4,20 @@ See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPLv2.1+)
|
||||
Various Minetest developers and contributors (LGPLv2.1+)
|
||||
|
||||
Authors of media (textures, models and sounds)
|
||||
----------------------------------------------
|
||||
The torch code was derived by sofar from the 'torches' mod by
|
||||
BlockMen (LGPLv2.1+)
|
||||
|
||||
Authors of media (textures, sounds, models and schematics)
|
||||
----------------------------------------------------------
|
||||
Everything not listed in here:
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com> (CC BY-SA 3.0)
|
||||
|
||||
|
||||
Textures
|
||||
--------
|
||||
Cisoun's texture pack (CC BY-SA 3.0):
|
||||
default_jungletree.png
|
||||
default_lava.png
|
||||
@ -23,25 +29,15 @@ Cisoun's texture pack (CC BY-SA 3.0):
|
||||
default_tree_top.png
|
||||
default_water.png
|
||||
|
||||
Cisoun's conifers mod (CC BY-SA 3.0):
|
||||
default_pine_needles.png
|
||||
|
||||
Originating from G4JC's Almost MC Texture Pack (CC BY-SA 3.0):
|
||||
default_torch.png
|
||||
default_torch_on_ceiling.png
|
||||
default_torch_on_floor.png
|
||||
|
||||
VanessaE's animated torches (CC BY-SA 3.0):
|
||||
default_torch_animated.png
|
||||
default_torch_on_ceiling_animated.png
|
||||
default_torch_on_floor_animated.png
|
||||
default_torch_on_floor.png
|
||||
|
||||
RealBadAngel's animated water (CC BY-SA 3.0):
|
||||
default_water_source_animated.png
|
||||
default_water_flowing_animated.png
|
||||
|
||||
VanessaE (CC BY-SA 3.0):
|
||||
default_torch_animated.png
|
||||
default_torch_on_ceiling_animated.png
|
||||
default_torch_on_floor_animated.png
|
||||
default_torch_on_floor.png
|
||||
default_desert_sand.png
|
||||
default_desert_stone.png
|
||||
default_sand.png
|
||||
@ -52,13 +48,6 @@ Calinou (CC BY-SA 3.0):
|
||||
default_brick.png
|
||||
default_papyrus.png
|
||||
default_mineral_copper.png
|
||||
default_glass_detail.png
|
||||
|
||||
MirceaKitsune (CC BY-SA 3.0):
|
||||
character.x
|
||||
|
||||
Jordach (CC BY-SA 3.0):
|
||||
character.png
|
||||
|
||||
PilzAdam (CC BY-SA 3.0):
|
||||
default_jungleleaves.png
|
||||
@ -75,6 +64,7 @@ InfinityProject (CC BY-SA 3.0):
|
||||
|
||||
Splizard (CC BY-SA 3.0):
|
||||
default_pine_sapling.png
|
||||
default_pine_needles.png
|
||||
|
||||
Zeg9 (CC BY-SA 3.0):
|
||||
default_coal_block.png
|
||||
@ -88,11 +78,13 @@ paramat (CC BY-SA 3.0):
|
||||
default_acacia_leaves_simple.png
|
||||
default_acacia_sapling.png
|
||||
default_acacia_bush_sapling.png
|
||||
default_pine_bush_sapling.png
|
||||
default_acacia_tree.png
|
||||
default_acacia_tree_top.png
|
||||
default_acacia_wood.png
|
||||
default_acacia_bush_stem.png
|
||||
default_bush_stem.png
|
||||
default_pine_bush_stem.png
|
||||
default_junglewood.png
|
||||
default_jungletree_top.png
|
||||
default_sandstone_brick.png
|
||||
@ -120,9 +112,23 @@ paramat (CC BY-SA 3.0):
|
||||
default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0)
|
||||
default_marram_grass_*.png -- Derived from textures by TumeniNodes (CC-BY-SA 3.0)
|
||||
default_emergent_jungle_sapling.png
|
||||
default_permafrost.png -- Derived from a texture by Neuromancer (CC BY-SA 3.0)
|
||||
default_stones.png -- Derived from a texture by sofar (CC0 1.0)
|
||||
default_stones_side.png -- Derived from a texture by sofar (CC0 1.0)
|
||||
default_moss.png
|
||||
default_moss_side.png
|
||||
default_fence_rail_acacia_wood
|
||||
default_fence_rail_aspen_wood -- Derived from a texture by sofar (CC BY-SA 3.0)
|
||||
default_fence_rail_junglewood
|
||||
default_fence_rail_pine_wood
|
||||
default_fence_rail_wood -- Derived from a texture by BlockMen (CC BY-SA 3.0)
|
||||
|
||||
brunob.santos (CC BY-SA 4.0):
|
||||
default_desert_cobble.png
|
||||
TumeniNodes (CC BY-SA 3.0):
|
||||
default_desert_cobble.png -- Derived from a texture by brunob.santos (CC BY-SA 3.0)
|
||||
default_coniferous_litter.png
|
||||
default_coniferous_litter_side.png
|
||||
|
||||
BlockMen (CC BY-SA 3.0):
|
||||
default_aspen_leaves.png -- Derived from Sofar's texture
|
||||
@ -152,15 +158,12 @@ sofar (CC BY-SA 3.0):
|
||||
default_aspen_wood, derived from default_pine_wood (by paramat)
|
||||
default_chest_inside
|
||||
|
||||
sofar (WTFPL):
|
||||
sofar (CC0 1.0):
|
||||
default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel
|
||||
|
||||
Neuromancer (CC BY-SA 2.0):
|
||||
Neuromancer (CC BY-SA 3.0):
|
||||
default_cobble.png, based on texture by Brane praefect
|
||||
default_mossycobble.png, based on texture by Brane praefect
|
||||
|
||||
Neuromancer (CC BY-SA 3.0):
|
||||
default_dirt.png
|
||||
default_furnace_*.png
|
||||
|
||||
Gambit (CC BY-SA 3.0):
|
||||
@ -187,7 +190,7 @@ Gambit (CC BY-SA 3.0):
|
||||
asl97 (CC BY-SA 3.0):
|
||||
default_ice.png
|
||||
|
||||
KevDoy (CC BY-SA 3.0)
|
||||
KevDoy (CC BY-SA 3.0):
|
||||
heart.png
|
||||
|
||||
Pithydon (CC BY-SA 3.0)
|
||||
@ -195,11 +198,10 @@ Pithydon (CC BY-SA 3.0)
|
||||
default_coral_orange.png
|
||||
default_coral_skeleton.png
|
||||
|
||||
Ferk (CC0 1.0)
|
||||
Ferk (CC0 1.0):
|
||||
default_item_smoke.png
|
||||
default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart
|
||||
|
||||
npx (CC BY-SA 3.0)
|
||||
npx (CC BY-SA 3.0):
|
||||
default_rainforest_litter.png
|
||||
default_rainforest_litter_side.png
|
||||
|
||||
@ -218,18 +220,42 @@ kilbith (CC BY-SA 3.0):
|
||||
default_tin_ingot.png
|
||||
default_tin_lump.png
|
||||
|
||||
tobyplowy (CC BY-SA 3.0):
|
||||
default_kelp.png
|
||||
|
||||
CloudyProton (CC BY-SA 3.0):
|
||||
default_book_written.png, based on default_book.png by Gambit
|
||||
|
||||
Mossmanikin (CC BY-SA 3.0):
|
||||
default_fern_*.png
|
||||
|
||||
random-geek (CC BY-SA 3.0):
|
||||
default_blueberries.png
|
||||
default_blueberry_overlay.png
|
||||
default_blueberry_bush_leaves.png, derived from default_bush_leaves (by paramat)
|
||||
default_blueberry_bush_sapling.png
|
||||
default_dirt.png -- Derived from a texture by Neuromancer (CC BY-SA 3.0)
|
||||
|
||||
Krock (CC0 1.0):
|
||||
default_glass.png
|
||||
default_glass_detail.png
|
||||
|
||||
Topywo (CC BY-SA 3.0)
|
||||
default_coral_cyan.png
|
||||
default_coral_green.png
|
||||
default_coral_pink.png
|
||||
|
||||
Extex101 (CC BY-SA 3.0)
|
||||
default_large_cactus_seedling.png
|
||||
|
||||
|
||||
Sounds
|
||||
------
|
||||
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/
|
||||
|
||||
sonictechtonic (CC BY 3.0):
|
||||
https://www.freesound.org/people/sonictechtonic/sounds/241872/
|
||||
player_damage.ogg
|
||||
|
||||
Mito551 (sounds) (CC BY-SA 3.0):
|
||||
default_dig_choppy.ogg
|
||||
default_dig_cracky.ogg
|
||||
@ -252,8 +278,6 @@ Mito551 (sounds) (CC BY-SA 3.0):
|
||||
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
|
||||
@ -278,14 +302,14 @@ Metal sounds:
|
||||
Tool breaking sounds added by sofar: CC-BY-3.0
|
||||
default_tool_breaks.* - http://www.freesound.org/people/HerbertBoland/sounds/33206/
|
||||
|
||||
AGFX (CC BY 3.0)
|
||||
AGFX (CC BY 3.0):
|
||||
https://www.freesound.org/people/AGFX/packs/1253/
|
||||
default_water_footstep.1.ogg
|
||||
default_water_footstep.2.ogg
|
||||
default_water_footstep.3.ogg
|
||||
(default_water_footstep.4.ogg is silent)
|
||||
|
||||
blukotek (CC0 1.0)
|
||||
blukotek (CC0 1.0):
|
||||
https://www.freesound.org/people/blukotek/sounds/251660/
|
||||
default_dig_snappy.ogg
|
||||
|
||||
@ -298,3 +322,56 @@ Chests sounds added by sofar, derived of several files mixed together:
|
||||
- http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0
|
||||
|
||||
Ryding (CC0 1.0):
|
||||
http://freesound.org/people/Ryding/sounds/94337/
|
||||
default_snow_footstep.*.ogg
|
||||
|
||||
Ferk (CC0 1.0):
|
||||
default_item_smoke.ogg, based on a sound by http://opengameart.org/users/bart
|
||||
|
||||
|
||||
Models
|
||||
------
|
||||
sofar (CC BY-SA 3.0):
|
||||
chest_open.obj
|
||||
torch_ceiling.obj
|
||||
torch_floor.obj
|
||||
torch_wall.obj
|
||||
|
||||
|
||||
Schematics
|
||||
----------
|
||||
paramat (CC BY-SA 3.0):
|
||||
acacia_bush.mts
|
||||
acacia_tree.mts
|
||||
acacia_tree_from_sapling.mts
|
||||
apple_tree.mts
|
||||
apple_tree_from_sapling.mts
|
||||
aspen_tree.mts
|
||||
aspen_tree_from_sapling.mts
|
||||
bush.mts
|
||||
emergent_jungle_tree.mts
|
||||
emergent_jungle_tree_from_sapling.mts
|
||||
jungle_tree.mts
|
||||
jungle_tree_from_sapling.mts
|
||||
large_cactus.mts
|
||||
papyrus.mts
|
||||
pine_tree.mts
|
||||
pine_tree_from_sapling.mts
|
||||
snowy_pine_tree_from_sapling.mts
|
||||
small_pine_tree.mts
|
||||
small_pine_tree_from_sapling.mts
|
||||
snowy_small_pine_tree_from_sapling.mts
|
||||
|
||||
Shara RedCat (CC BY-SA 3.0):
|
||||
acacia_log.mts
|
||||
apple_log.mts
|
||||
aspen_log.mts
|
||||
jungle_log.mts
|
||||
pine_log.mts
|
||||
|
||||
TumeniNodes (CC BY-SA 3.0):
|
||||
pine_bush.mts
|
||||
|
||||
random-geek (CC BY-SA 3.0):
|
||||
blueberry_bush.mts
|
||||
|
318
mods/default/chests.lua
Normal file
@ -0,0 +1,318 @@
|
||||
default.chest = {}
|
||||
|
||||
function default.chest.get_chest_formspec(pos)
|
||||
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
|
||||
local formspec =
|
||||
"size[8,9]" ..
|
||||
"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]" ..
|
||||
"listring[nodemeta:" .. spos .. ";main]" ..
|
||||
"listring[current_player;main]" ..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
return formspec
|
||||
end
|
||||
|
||||
function default.chest.chest_lid_obstructed(pos)
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local def = minetest.registered_nodes[minetest.get_node(above).name]
|
||||
-- allow ladders, signs, wallmounted things and torches to not obstruct
|
||||
if def and
|
||||
(def.drawtype == "airlike" or
|
||||
def.drawtype == "signlike" or
|
||||
def.drawtype == "torchlike" or
|
||||
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function default.chest.chest_lid_close(pn)
|
||||
local chest_open_info = default.chest.open_chests[pn]
|
||||
local pos = chest_open_info.pos
|
||||
local sound = chest_open_info.sound
|
||||
local swap = chest_open_info.swap
|
||||
|
||||
default.chest.open_chests[pn] = nil
|
||||
for k, v in pairs(default.chest.open_chests) do
|
||||
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
|
||||
param2 = node.param2 })
|
||||
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
||||
end
|
||||
|
||||
default.chest.open_chests = {}
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "default:chest" then
|
||||
return
|
||||
end
|
||||
if not player or not fields.quit then
|
||||
return
|
||||
end
|
||||
local pn = player:get_player_name()
|
||||
|
||||
if not default.chest.open_chests[pn] then
|
||||
return
|
||||
end
|
||||
|
||||
default.chest.chest_lid_close(pn)
|
||||
return true
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local pn = player:get_player_name()
|
||||
if default.chest.open_chests[pn] then
|
||||
default.chest.chest_lid_close(pn)
|
||||
end
|
||||
end)
|
||||
|
||||
function default.chest.register_chest(name, d)
|
||||
local def = table.copy(d)
|
||||
def.drawtype = "mesh"
|
||||
def.visual = "mesh"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.legacy_facedir_simple = true
|
||||
def.is_ground_content = false
|
||||
|
||||
if def.protected then
|
||||
def.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Locked Chest")
|
||||
meta:set_string("owner", "")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end
|
||||
def.after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", "Locked Chest (owned by " ..
|
||||
meta:get_string("owner") .. ")")
|
||||
end
|
||||
def.can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main") and
|
||||
default.can_interact_with_node(player, pos)
|
||||
end
|
||||
def.allow_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
to_list, to_index, count, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return count
|
||||
end
|
||||
def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
if not default.can_interact_with_node(clicker, pos) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.sound_play(def.sound_open, {gain = 0.3,
|
||||
pos = pos, max_hear_distance = 10})
|
||||
if not default.chest.chest_lid_obstructed(pos) then
|
||||
minetest.swap_node(pos,
|
||||
{ name = "default:" .. name .. "_open",
|
||||
param2 = node.param2 })
|
||||
end
|
||||
minetest.after(0.2, minetest.show_formspec,
|
||||
clicker:get_player_name(),
|
||||
"default:chest", default.chest.get_chest_formspec(pos))
|
||||
default.chest.open_chests[clicker:get_player_name()] = { pos = pos,
|
||||
sound = def.sound_close, swap = name }
|
||||
end
|
||||
def.on_blast = function() end
|
||||
def.on_key_use = function(pos, player)
|
||||
local secret = minetest.get_meta(pos):get_string("key_lock_secret")
|
||||
local itemstack = player:get_wielded_item()
|
||||
local key_meta = itemstack:get_meta()
|
||||
|
||||
if itemstack:get_metadata() == "" then
|
||||
return
|
||||
end
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
|
||||
itemstack:set_metadata("")
|
||||
end
|
||||
|
||||
if secret ~= key_meta:get_string("secret") then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.show_formspec(
|
||||
player:get_player_name(),
|
||||
"default:chest_locked",
|
||||
default.chest.get_chest_formspec(pos)
|
||||
)
|
||||
end
|
||||
def.on_skeleton_key_use = function(pos, player, newsecret)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local pn = player:get_player_name()
|
||||
|
||||
-- verify placer is owner of lockable chest
|
||||
if owner ~= pn then
|
||||
minetest.record_protection_violation(pos, pn)
|
||||
minetest.chat_send_player(pn, "You do not own this chest.")
|
||||
return nil
|
||||
end
|
||||
|
||||
local secret = meta:get_string("key_lock_secret")
|
||||
if secret == "" then
|
||||
secret = newsecret
|
||||
meta:set_string("key_lock_secret", secret)
|
||||
end
|
||||
|
||||
return secret, "a locked chest", owner
|
||||
end
|
||||
else
|
||||
def.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Chest")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end
|
||||
def.can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end
|
||||
def.on_rightclick = function(pos, node, clicker)
|
||||
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
|
||||
max_hear_distance = 10})
|
||||
if not default.chest.chest_lid_obstructed(pos) then
|
||||
minetest.swap_node(pos, {
|
||||
name = "default:" .. name .. "_open",
|
||||
param2 = node.param2 })
|
||||
end
|
||||
minetest.after(0.2, minetest.show_formspec,
|
||||
clicker:get_player_name(),
|
||||
"default:chest", default.chest.get_chest_formspec(pos))
|
||||
default.chest.open_chests[clicker:get_player_name()] = { pos = pos,
|
||||
sound = def.sound_close, swap = name }
|
||||
end
|
||||
def.on_blast = function(pos)
|
||||
local drops = {}
|
||||
default.get_inventory_drops(pos, "main", drops)
|
||||
drops[#drops+1] = "default:" .. name
|
||||
minetest.remove_node(pos)
|
||||
return drops
|
||||
end
|
||||
end
|
||||
|
||||
def.on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
||||
end
|
||||
def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves " .. stack:get_name() ..
|
||||
" to chest at " .. minetest.pos_to_string(pos))
|
||||
end
|
||||
def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes " .. stack:get_name() ..
|
||||
" from chest at " .. minetest.pos_to_string(pos))
|
||||
end
|
||||
|
||||
local def_opened = table.copy(def)
|
||||
local def_closed = table.copy(def)
|
||||
|
||||
def_opened.mesh = "chest_open.obj"
|
||||
for i = 1, #def_opened.tiles do
|
||||
if type(def_opened.tiles[i]) == "string" then
|
||||
def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true}
|
||||
elseif def_opened.tiles[i].backface_culling == nil then
|
||||
def_opened.tiles[i].backface_culling = true
|
||||
end
|
||||
end
|
||||
def_opened.drop = "default:" .. name
|
||||
def_opened.groups.not_in_creative_inventory = 1
|
||||
def_opened.selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
|
||||
}
|
||||
def_opened.can_dig = function()
|
||||
return false
|
||||
end
|
||||
def_opened.on_blast = function() end
|
||||
|
||||
def_closed.mesh = nil
|
||||
def_closed.drawtype = nil
|
||||
def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal"
|
||||
def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh
|
||||
def_closed.tiles[3] = def.tiles[3].."^[transformFX"
|
||||
|
||||
minetest.register_node("default:" .. name, def_closed)
|
||||
minetest.register_node("default:" .. name .. "_open", def_opened)
|
||||
|
||||
-- convert old chests to this new variant
|
||||
minetest.register_lbm({
|
||||
label = "update chests to opening chests",
|
||||
name = "default:upgrade_" .. name .. "_v2",
|
||||
nodenames = {"default:" .. name},
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", nil)
|
||||
local inv = meta:get_inventory()
|
||||
local list = inv:get_list("default:chest")
|
||||
if list then
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_list("main", list)
|
||||
inv:set_list("default:chest", nil)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
default.chest.register_chest("chest", {
|
||||
description = "Chest",
|
||||
tiles = {
|
||||
"default_chest_top.png",
|
||||
"default_chest_top.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_front.png",
|
||||
"default_chest_inside.png"
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sound_open = "default_chest_open",
|
||||
sound_close = "default_chest_close",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
})
|
||||
|
||||
default.chest.register_chest("chest_locked", {
|
||||
description = "Locked Chest",
|
||||
tiles = {
|
||||
"default_chest_top.png",
|
||||
"default_chest_top.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_lock.png",
|
||||
"default_chest_inside.png"
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sound_open = "default_chest_open",
|
||||
sound_close = "default_chest_close",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
protected = true,
|
||||
})
|
@ -49,6 +49,13 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:pine_wood",
|
||||
recipe = {
|
||||
{"default:pine_bush_stem"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stick 4',
|
||||
recipe = {
|
||||
@ -763,14 +770,35 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:emergent_jungle_sapling",
|
||||
recipe = {
|
||||
{"default:junglesapling", "default:junglesapling", "default:junglesapling"},
|
||||
{"default:junglesapling", "default:junglesapling", "default:junglesapling"},
|
||||
{"default:junglesapling", "default:junglesapling", "default:junglesapling"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:large_cactus_seedling",
|
||||
recipe = {
|
||||
{"", "default:cactus", ""},
|
||||
{"default:cactus", "default:cactus", "default:cactus"},
|
||||
{"", "default:cactus", ""},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Crafting (tool repair)
|
||||
--
|
||||
|
||||
minetest.register_craft({
|
||||
type = "toolrepair",
|
||||
additional_wear = -0.02,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Cooking recipes
|
||||
--
|
||||
@ -849,6 +877,7 @@ minetest.register_craft({
|
||||
cooktime = 5,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Fuels
|
||||
--
|
||||
@ -940,6 +969,12 @@ minetest.register_craft({
|
||||
burntime = 4,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:pine_bush_sapling",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:aspen_sapling",
|
||||
@ -964,6 +999,12 @@ minetest.register_craft({
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:emergent_jungle_sapling",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
@ -996,6 +1037,37 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_rail_aspen_wood",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_rail_pine_wood",
|
||||
burntime = 4,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_rail_wood",
|
||||
burntime = 5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_rail_acacia_wood",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_rail_junglewood",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:bush_stem",
|
||||
@ -1008,6 +1080,12 @@ minetest.register_craft({
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:pine_bush_stem",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:junglegrass",
|
||||
@ -1026,6 +1104,12 @@ minetest.register_craft({
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:large_cactus_seedling",
|
||||
burntime = 5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:papyrus",
|
||||
@ -1098,6 +1182,18 @@ minetest.register_craft({
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fern_1",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:marram_grass_1",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:paper",
|
||||
|
@ -50,16 +50,14 @@ local function book_on_use(itemstack, user)
|
||||
|
||||
local formspec
|
||||
if owner == player_name then
|
||||
formspec = "size[8,8]" .. default.gui_bg ..
|
||||
default.gui_bg_img ..
|
||||
formspec = "size[8,8]" ..
|
||||
"field[0.5,1;7.5,0;title;Title:;" ..
|
||||
minetest.formspec_escape(title) .. "]" ..
|
||||
"textarea[0.5,1.5;7.5,7;text;Contents:;" ..
|
||||
minetest.formspec_escape(text) .. "]" ..
|
||||
"button_exit[2.5,7.5;3,1;save;Save]"
|
||||
else
|
||||
formspec = "size[8,8]" .. default.gui_bg ..
|
||||
default.gui_bg_img ..
|
||||
formspec = "size[8,8]" ..
|
||||
"label[0.5,0.5;by " .. owner .. "]" ..
|
||||
"tablecolumns[color;text]" ..
|
||||
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
|
||||
@ -121,7 +119,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if inv:room_for_item("main", new_stack) then
|
||||
inv:add_item("main", new_stack)
|
||||
else
|
||||
minetest.add_item(player:getpos(), new_stack)
|
||||
minetest.add_item(player:get_pos(), new_stack)
|
||||
end
|
||||
else
|
||||
stack:get_meta():from_table({ fields = data })
|
||||
@ -247,7 +245,7 @@ minetest.register_craftitem("default:skeleton_key", {
|
||||
itemstack = new_stack
|
||||
else
|
||||
if inv:add_item("main", new_stack):get_count() > 0 then
|
||||
minetest.add_item(user:getpos(), new_stack)
|
||||
minetest.add_item(user:get_pos(), new_stack)
|
||||
end -- else: added to inventory successfully
|
||||
end
|
||||
|
||||
@ -341,3 +339,10 @@ minetest.register_craftitem("default:flint", {
|
||||
description = "Flint",
|
||||
inventory_image = "default_flint.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:blueberries", {
|
||||
description = "Blueberries",
|
||||
inventory_image = "default_blueberries.png",
|
||||
groups = {food_blueberries = 1, food_berry = 1},
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
1
mods/default/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
player_api?
|
@ -1,5 +1,3 @@
|
||||
-- mods/default/functions.lua
|
||||
|
||||
--
|
||||
-- Sounds
|
||||
--
|
||||
@ -117,6 +115,21 @@ function default.node_sound_water_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_snow_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_snow_footstep", gain = 0.2}
|
||||
table.dig = table.dig or
|
||||
{name = "default_snow_footstep", gain = 0.3}
|
||||
table.dug = table.dug or
|
||||
{name = "default_snow_footstep", gain = 0.3}
|
||||
table.place = table.place or
|
||||
{name = "default_place_node", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
@ -145,8 +158,9 @@ if minetest.settings:get_bool("enable_lavacooling") ~= false then
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- optimized helper to put all items in an inventory into a drops list
|
||||
-- Optimized helper to put all items in an inventory into a drops list
|
||||
--
|
||||
|
||||
function default.get_inventory_drops(pos, inventory, drops)
|
||||
@ -161,11 +175,12 @@ function default.get_inventory_drops(pos, inventory, drops)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Papyrus and cactus growing
|
||||
--
|
||||
|
||||
-- wrapping the functions in abm action is necessary to make overriding them possible
|
||||
-- Wrapping the functions in ABM action is necessary to make overriding them possible
|
||||
|
||||
function default.grow_cactus(pos, node)
|
||||
if node.param2 >= 4 then
|
||||
@ -242,7 +257,7 @@ minetest.register_abm({
|
||||
|
||||
|
||||
--
|
||||
-- dig upwards
|
||||
-- Dig upwards
|
||||
--
|
||||
|
||||
function default.dig_up(pos, node, digger)
|
||||
@ -288,7 +303,7 @@ function default.register_fence(name, def)
|
||||
connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
|
||||
{1/8,-5/16,-1/16,1/2,-3/16,1/16}},
|
||||
},
|
||||
connects_to = {"group:fence", "group:wood", "group:tree"},
|
||||
connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"},
|
||||
inventory_image = fence_texture,
|
||||
wield_image = fence_texture,
|
||||
tiles = {def.texture},
|
||||
@ -312,6 +327,71 @@ function default.register_fence(name, def)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Fence rail registration helper
|
||||
--
|
||||
|
||||
function default.register_fence_rail(name, def)
|
||||
minetest.register_craft({
|
||||
output = name .. " 16",
|
||||
recipe = {
|
||||
{ def.material, def.material },
|
||||
{ "", ""},
|
||||
{ def.material, def.material },
|
||||
}
|
||||
})
|
||||
|
||||
local fence_rail_texture = "default_fence_rail_overlay.png^" .. def.texture ..
|
||||
"^default_fence_rail_overlay.png^[makealpha:255,126,126"
|
||||
-- Allow almost everything to be overridden
|
||||
local default_fields = {
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "connected",
|
||||
fixed = {
|
||||
{-1/16, 3/16, -1/16, 1/16, 5/16, 1/16},
|
||||
{-1/16, -3/16, -1/16, 1/16, -5/16, 1/16}
|
||||
},
|
||||
-- connect_top =
|
||||
-- connect_bottom =
|
||||
connect_front = {
|
||||
{-1/16, 3/16, -1/2, 1/16, 5/16, -1/16},
|
||||
{-1/16, -5/16, -1/2, 1/16, -3/16, -1/16}},
|
||||
connect_left = {
|
||||
{-1/2, 3/16, -1/16, -1/16, 5/16, 1/16},
|
||||
{-1/2, -5/16, -1/16, -1/16, -3/16, 1/16}},
|
||||
connect_back = {
|
||||
{-1/16, 3/16, 1/16, 1/16, 5/16, 1/2},
|
||||
{-1/16, -5/16, 1/16, 1/16, -3/16, 1/2}},
|
||||
connect_right = {
|
||||
{1/16, 3/16, -1/16, 1/2, 5/16, 1/16},
|
||||
{1/16, -5/16, -1/16, 1/2, -3/16, 1/16}},
|
||||
},
|
||||
connects_to = {"group:fence", "group:wall"},
|
||||
inventory_image = fence_rail_texture,
|
||||
wield_image = fence_rail_texture,
|
||||
tiles = {def.texture},
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {},
|
||||
}
|
||||
for k, v in pairs(default_fields) do
|
||||
if def[k] == nil then
|
||||
def[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- Always add to the fence group, even if no group provided
|
||||
def.groups.fence = 1
|
||||
|
||||
def.texture = nil
|
||||
def.material = nil
|
||||
|
||||
minetest.register_node(name, def)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Leafdecay
|
||||
--
|
||||
@ -386,6 +466,7 @@ function default.register_leafdecay(def)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Convert dirt to something that fits the environment
|
||||
--
|
||||
@ -482,63 +563,7 @@ minetest.register_abm({
|
||||
|
||||
|
||||
--
|
||||
-- Checks if specified volume intersects a protected volume
|
||||
--
|
||||
|
||||
function default.intersects_protection(minp, maxp, player_name, interval)
|
||||
-- 'interval' is the largest allowed interval for the 3D lattice of checks
|
||||
|
||||
-- Compute the optimal float step 'd' for each axis so that all corners and
|
||||
-- borders are checked. 'd' will be smaller or equal to 'interval'.
|
||||
-- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the
|
||||
-- for loop (which might otherwise not be the case due to rounding errors).
|
||||
local d = {}
|
||||
for _, c in pairs({"x", "y", "z"}) do
|
||||
if maxp[c] > minp[c] then
|
||||
d[c] = (maxp[c] - minp[c]) / math.ceil((maxp[c] - minp[c]) / interval) - 1e-4
|
||||
elseif maxp[c] == minp[c] then
|
||||
d[c] = 1 -- Any value larger than 0 to avoid division by zero
|
||||
else -- maxp[c] < minp[c], print error and treat as protection intersected
|
||||
minetest.log("error", "maxp < minp in 'default.intersects_protection()'")
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
for zf = minp.z, maxp.z, d.z do
|
||||
local z = math.floor(zf + 0.5)
|
||||
for yf = minp.y, maxp.y, d.y do
|
||||
local y = math.floor(yf + 0.5)
|
||||
for xf = minp.x, maxp.x, d.x do
|
||||
local x = math.floor(xf + 0.5)
|
||||
if minetest.is_protected({x = x, y = y, z = z}, player_name) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Coral death near air
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:coral_brown", "default:coral_orange"},
|
||||
neighbors = {"air"},
|
||||
interval = 17,
|
||||
chance = 5,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {name = "default:coral_skeleton"})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- NOTICE: This method is not an official part of the API yet!
|
||||
-- NOTICE: This method is not an official part of the API yet.
|
||||
-- This method may change in future.
|
||||
--
|
||||
|
||||
@ -558,7 +583,7 @@ function default.can_interact_with_node(player, pos)
|
||||
return true
|
||||
end
|
||||
|
||||
-- is player wielding the right key?
|
||||
-- Is player wielding the right key?
|
||||
local item = player:get_wielded_item()
|
||||
if item:get_name() == "default:key" then
|
||||
local key_meta = item:get_meta()
|
||||
|
@ -3,50 +3,43 @@
|
||||
-- Formspecs
|
||||
--
|
||||
|
||||
local function active_formspec(fuel_percent, item_percent)
|
||||
local formspec =
|
||||
"size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||
function default.get_furnace_active_formspec(fuel_percent, item_percent)
|
||||
return "size[8,8.5]"..
|
||||
"list[context;src;2.75,0.5;1,1;]"..
|
||||
"list[context;fuel;2.75,2.5;1,1;]"..
|
||||
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(100-fuel_percent)..":default_furnace_fire_fg.png]"..
|
||||
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||
"list[current_name;dst;4.75,0.96;2,2;]"..
|
||||
"list[context;dst;4.75,0.96;2,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[context;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[context;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;fuel]"..
|
||||
"listring[context;fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
return formspec
|
||||
end
|
||||
|
||||
local inactive_formspec =
|
||||
"size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
|
||||
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
||||
"list[current_name;dst;4.75,0.96;2,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
function default.get_furnace_inactive_formspec()
|
||||
return "size[8,8.5]"..
|
||||
"list[context;src;2.75,0.5;1,1;]"..
|
||||
"list[context;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[context;dst;4.75,0.96;2,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[context;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
end
|
||||
|
||||
--
|
||||
-- Node callback functions that are the same for active and inactive furnace
|
||||
@ -197,7 +190,7 @@ local function furnace_node_timer(pos, elapsed)
|
||||
--
|
||||
-- Update formspec, infotext and node
|
||||
--
|
||||
local formspec = inactive_formspec
|
||||
local formspec
|
||||
local item_state
|
||||
local item_percent = 0
|
||||
if cookable then
|
||||
@ -216,14 +209,14 @@ local function furnace_node_timer(pos, elapsed)
|
||||
end
|
||||
|
||||
local fuel_state = "Empty"
|
||||
local active = "inactive "
|
||||
local active = "inactive"
|
||||
local result = false
|
||||
|
||||
if fuel_totaltime ~= 0 then
|
||||
active = "active "
|
||||
active = "active"
|
||||
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
||||
fuel_state = fuel_percent .. "%"
|
||||
formspec = active_formspec(fuel_percent, item_percent)
|
||||
formspec = default.get_furnace_active_formspec(fuel_percent, item_percent)
|
||||
swap_node(pos, "default:furnace_active")
|
||||
-- make sure timer restarts automatically
|
||||
result = true
|
||||
@ -231,12 +224,14 @@ local function furnace_node_timer(pos, elapsed)
|
||||
if not fuellist[1]:is_empty() then
|
||||
fuel_state = "0%"
|
||||
end
|
||||
formspec = default.get_furnace_inactive_formspec()
|
||||
swap_node(pos, "default:furnace")
|
||||
-- stop timer on the inactive furnace
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
|
||||
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
|
||||
local infotext = "Furnace " .. active .. "\n(Item: " .. item_state ..
|
||||
"; Fuel: " .. fuel_state .. ")"
|
||||
|
||||
--
|
||||
-- Set meta values
|
||||
@ -273,7 +268,7 @@ minetest.register_node("default:furnace", {
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", inactive_formspec)
|
||||
meta:set_string("formspec", default.get_furnace_inactive_formspec())
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('src', 1)
|
||||
inv:set_size('fuel', 1)
|
||||
@ -334,4 +329,3 @@ minetest.register_node("default:furnace_active", {
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
})
|
||||
|
||||
|
@ -9,9 +9,12 @@ default = {}
|
||||
default.LIGHT_MAX = 14
|
||||
|
||||
-- GUI related stuff
|
||||
default.gui_bg = "bgcolor[#080808BB;true]"
|
||||
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
|
||||
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player:set_formspec_prepend([[
|
||||
bgcolor[#080808BB;true]
|
||||
background[5,5;1,1;gui_formbg.png;true]
|
||||
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] ]])
|
||||
end)
|
||||
|
||||
function default.get_hotbar_bg(x,y)
|
||||
local out = ""
|
||||
@ -22,9 +25,6 @@ function default.get_hotbar_bg(x,y)
|
||||
end
|
||||
|
||||
default.gui_survival_form = "size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||
@ -40,6 +40,7 @@ local default_path = minetest.get_modpath("default")
|
||||
dofile(default_path.."/functions.lua")
|
||||
dofile(default_path.."/trees.lua")
|
||||
dofile(default_path.."/nodes.lua")
|
||||
dofile(default_path.."/chests.lua")
|
||||
dofile(default_path.."/furnace.lua")
|
||||
dofile(default_path.."/torch.lua")
|
||||
dofile(default_path.."/tools.lua")
|
||||
@ -47,6 +48,5 @@ dofile(default_path.."/item_entity.lua")
|
||||
dofile(default_path.."/craftitems.lua")
|
||||
dofile(default_path.."/crafting.lua")
|
||||
dofile(default_path.."/mapgen.lua")
|
||||
dofile(default_path.."/player.lua")
|
||||
dofile(default_path.."/aliases.lua")
|
||||
dofile(default_path.."/legacy.lua")
|
||||
|
@ -16,7 +16,7 @@ local item = {
|
||||
burn_up = function(self)
|
||||
-- disappear in a smoke puff
|
||||
self.object:remove()
|
||||
local p = self.object:getpos()
|
||||
local p = self.object:get_pos()
|
||||
minetest.sound_play("default_item_smoke", {
|
||||
pos = p,
|
||||
max_hear_distance = 8,
|
||||
@ -48,7 +48,7 @@ local item = {
|
||||
if self.ignite_timer > 10 then
|
||||
self.ignite_timer = 0
|
||||
|
||||
local node = minetest.get_node_or_nil(self.object:getpos())
|
||||
local node = minetest.get_node_or_nil(self.object:get_pos())
|
||||
if not node then
|
||||
return
|
||||
end
|
||||
|
@ -23,3 +23,27 @@ LIGHT_MAX = default.LIGHT_MAX
|
||||
|
||||
-- Formspecs
|
||||
default.gui_suvival_form = default.gui_survival_form
|
||||
default.gui_bg = ""
|
||||
default.gui_bg_img = ""
|
||||
default.gui_slots = ""
|
||||
|
||||
-- Players
|
||||
if minetest.get_modpath("player_api") then
|
||||
default.registered_player_models = player_api.registered_models
|
||||
default.player_register_model = player_api.register_model
|
||||
default.player_attached = player_api.player_attached
|
||||
default.player_get_animation = player_api.get_animation
|
||||
default.player_set_model = player_api.set_model
|
||||
default.player_set_textures = player_api.set_textures
|
||||
default.player_set_animation = player_api.set_animation
|
||||
end
|
||||
|
||||
-- Chests
|
||||
default.register_chest = default.chest.register_chest
|
||||
|
||||
-- Check for a volume intersecting protection
|
||||
function default.intersects_protection(minp, maxp, player_name, interval)
|
||||
minetest.log("warning", "default.intersects_protection() is " ..
|
||||
"deprecated, use minetest.is_area_protected() instead.")
|
||||
minetest.is_area_protected(minp, maxp, player_name, interval)
|
||||
end
|
||||
|
@ -2,8 +2,8 @@ License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2011-2016 Various Minetest developers and contributors
|
||||
Copyright (C) 2011-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2011-2018 Various Minetest developers and contributors
|
||||
|
||||
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;
|
||||
@ -19,7 +19,8 @@ Licenses of media (textures, models and sounds)
|
||||
-----------------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2010-2017:
|
||||
Copyright (C) 2010-2018:
|
||||
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Cisoun
|
||||
G4JC
|
||||
@ -44,7 +45,12 @@ Copyright (C) 2010-2017:
|
||||
GreenXenith
|
||||
kaeza
|
||||
kilbith
|
||||
tobyplowy
|
||||
CloudyProton
|
||||
TumeniNodes
|
||||
Mossmanikin
|
||||
random-geek
|
||||
Extex101
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
@ -76,73 +82,8 @@ http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Copyright (C) 2014-2016 brunob.santos
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)
|
||||
Copyright (C) 2014-2016 Neuromancer
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/2.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
Attribution 3.0 Unported (CC BY 3.0)
|
||||
|
||||
Copyright (C) 2009 cmusounddesign
|
||||
Copyright (C) 2010 Tomlija
|
||||
Copyright (C) 2010 lsprice
|
||||
@ -175,3 +116,41 @@ rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
||||
|
||||
Iwan Gabovitch
|
||||
Ottomaani138
|
||||
Ogrebane
|
||||
blukotek
|
||||
Sevin7
|
||||
Yoyodaman234
|
||||
Ryding
|
||||
|
||||
No Copyright
|
||||
|
||||
The person who associated a work with this deed has dedicated the work to the
|
||||
public domain by waiving all of his or her rights to the work worldwide under
|
||||
copyright law, including all related and neighboring rights, to the extent
|
||||
allowed by law.
|
||||
|
||||
You can copy, modify, distribute and perform the work, even for commercial
|
||||
purposes, all without asking permission. See Other Information below.
|
||||
|
||||
Other Information:
|
||||
|
||||
In no way are the patent or trademark rights of any person affected by CC0, nor
|
||||
are the rights that other persons may have in the work or in how the work is
|
||||
used, such as publicity or privacy rights.
|
||||
|
||||
Unless expressly stated otherwise, the person who associated a work with this
|
||||
deed makes no warranties about the work, and disclaims liability for all uses
|
||||
of the work, to the fullest extent permitted by applicable law.
|
||||
|
||||
When using or citing the work, you should not imply endorsement by the author
|
||||
or the affirmer.
|
||||
|
||||
For more details:
|
||||
https://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
@ -1,154 +0,0 @@
|
||||
-- Minetest 0.4 mod: player
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
-- Player animation blending
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
local animation_blend = 0
|
||||
|
||||
default.registered_player_models = { }
|
||||
|
||||
-- Local for speed.
|
||||
local models = default.registered_player_models
|
||||
|
||||
function default.player_register_model(name, def)
|
||||
models[name] = def
|
||||
end
|
||||
|
||||
-- Default player appearance
|
||||
default.player_register_model("character.b3d", {
|
||||
animation_speed = 30,
|
||||
textures = {"character.png", },
|
||||
animations = {
|
||||
-- Standard animations.
|
||||
stand = { x= 0, y= 79, },
|
||||
lay = { x=162, y=166, },
|
||||
walk = { x=168, y=187, },
|
||||
mine = { x=189, y=198, },
|
||||
walk_mine = { x=200, y=219, },
|
||||
sit = { x= 81, y=160, },
|
||||
},
|
||||
})
|
||||
|
||||
-- Player stats and animations
|
||||
local player_model = {}
|
||||
local player_textures = {}
|
||||
local player_anim = {}
|
||||
local player_sneak = {}
|
||||
default.player_attached = {}
|
||||
|
||||
function default.player_get_animation(player)
|
||||
local name = player:get_player_name()
|
||||
return {
|
||||
model = player_model[name],
|
||||
textures = player_textures[name],
|
||||
animation = player_anim[name],
|
||||
}
|
||||
end
|
||||
|
||||
-- Called when a player's appearance needs to be updated
|
||||
function default.player_set_model(player, model_name)
|
||||
local name = player:get_player_name()
|
||||
local model = models[model_name]
|
||||
if model then
|
||||
if player_model[name] == model_name then
|
||||
return
|
||||
end
|
||||
player:set_properties({
|
||||
mesh = model_name,
|
||||
textures = player_textures[name] or model.textures,
|
||||
visual = "mesh",
|
||||
visual_size = model.visual_size or {x=1, y=1},
|
||||
})
|
||||
default.player_set_animation(player, "stand")
|
||||
else
|
||||
player:set_properties({
|
||||
textures = { "player.png", "player_back.png", },
|
||||
visual = "upright_sprite",
|
||||
})
|
||||
end
|
||||
player_model[name] = model_name
|
||||
end
|
||||
|
||||
function default.player_set_textures(player, textures)
|
||||
local name = player:get_player_name()
|
||||
player_textures[name] = textures
|
||||
player:set_properties({textures = textures,})
|
||||
end
|
||||
|
||||
function default.player_set_animation(player, anim_name, speed)
|
||||
local name = player:get_player_name()
|
||||
if player_anim[name] == anim_name then
|
||||
return
|
||||
end
|
||||
local model = player_model[name] and models[player_model[name]]
|
||||
if not (model and model.animations[anim_name]) then
|
||||
return
|
||||
end
|
||||
local anim = model.animations[anim_name]
|
||||
player_anim[name] = anim_name
|
||||
player:set_animation(anim, speed or model.animation_speed, animation_blend)
|
||||
end
|
||||
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_model(player, "character.b3d")
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
player_model[name] = nil
|
||||
player_anim[name] = nil
|
||||
player_textures[name] = nil
|
||||
end)
|
||||
|
||||
-- Localize for better performance.
|
||||
local player_set_animation = default.player_set_animation
|
||||
local player_attached = default.player_attached
|
||||
|
||||
-- Check each player and apply animations
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local model_name = player_model[name]
|
||||
local model = model_name and models[model_name]
|
||||
if model and not player_attached[name] then
|
||||
local controls = player:get_player_control()
|
||||
local walking = false
|
||||
local animation_speed_mod = model.animation_speed or 30
|
||||
|
||||
-- Determine if the player is walking
|
||||
if controls.up or controls.down or controls.left or controls.right then
|
||||
walking = true
|
||||
end
|
||||
|
||||
-- Determine if the player is sneaking, and reduce animation speed if so
|
||||
if controls.sneak then
|
||||
animation_speed_mod = animation_speed_mod / 2
|
||||
end
|
||||
|
||||
-- Apply animations based on what the player is doing
|
||||
if player:get_hp() == 0 then
|
||||
player_set_animation(player, "lay")
|
||||
elseif walking then
|
||||
if player_sneak[name] ~= controls.sneak then
|
||||
player_anim[name] = nil
|
||||
player_sneak[name] = controls.sneak
|
||||
end
|
||||
if controls.LMB then
|
||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "walk", animation_speed_mod)
|
||||
end
|
||||
elseif controls.LMB then
|
||||
player_set_animation(player, "mine")
|
||||
else
|
||||
player_set_animation(player, "stand", animation_speed_mod)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
BIN
mods/default/schematics/blueberry_bush.mts
Normal file
BIN
mods/default/schematics/emergent_jungle_tree.mts
Normal file
BIN
mods/default/schematics/emergent_jungle_tree_from_sapling.mts
Normal file
BIN
mods/default/schematics/pine_bush.mts
Normal file
BIN
mods/default/schematics/small_pine_tree.mts
Normal file
BIN
mods/default/schematics/small_pine_tree_from_sapling.mts
Normal file
BIN
mods/default/schematics/snowy_small_pine_tree_from_sapling.mts
Normal file
BIN
mods/default/sounds/default_snow_footstep.5.ogg
Normal file
BIN
mods/default/textures/default_blueberries.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
mods/default/textures/default_blueberry_bush_leaves.png
Normal file
After Width: | Height: | Size: 813 B |
BIN
mods/default/textures/default_blueberry_bush_sapling.png
Normal file
After Width: | Height: | Size: 204 B |
BIN
mods/default/textures/default_blueberry_overlay.png
Normal file
After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 160 B |
BIN
mods/default/textures/default_coniferous_litter.png
Normal file
After Width: | Height: | Size: 873 B |
BIN
mods/default/textures/default_coniferous_litter_side.png
Normal file
After Width: | Height: | Size: 371 B |
BIN
mods/default/textures/default_coral_cyan.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
mods/default/textures/default_coral_green.png
Normal file
After Width: | Height: | Size: 287 B |
BIN
mods/default/textures/default_coral_pink.png
Normal file
After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 5.8 KiB |
BIN
mods/default/textures/default_emergent_jungle_sapling.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
mods/default/textures/default_fence_rail_acacia_wood.png
Normal file
After Width: | Height: | Size: 444 B |
BIN
mods/default/textures/default_fence_rail_aspen_wood.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
mods/default/textures/default_fence_rail_junglewood.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
mods/default/textures/default_fence_rail_overlay.png
Normal file
After Width: | Height: | Size: 141 B |
BIN
mods/default/textures/default_fence_rail_pine_wood.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
mods/default/textures/default_fence_rail_wood.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
mods/default/textures/default_fern_1.png
Normal file
After Width: | Height: | Size: 370 B |
BIN
mods/default/textures/default_fern_2.png
Normal file
After Width: | Height: | Size: 691 B |
BIN
mods/default/textures/default_fern_3.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 125 B |
BIN
mods/default/textures/default_kelp.png
Normal file
After Width: | Height: | Size: 312 B |
BIN
mods/default/textures/default_large_cactus_seedling.png
Normal file
After Width: | Height: | Size: 256 B |
BIN
mods/default/textures/default_marram_grass_1.png
Normal file
After Width: | Height: | Size: 253 B |
BIN
mods/default/textures/default_marram_grass_2.png
Normal file
After Width: | Height: | Size: 447 B |
BIN
mods/default/textures/default_marram_grass_3.png
Normal file
After Width: | Height: | Size: 341 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 128 B |
BIN
mods/default/textures/default_moss.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
mods/default/textures/default_moss_side.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
mods/default/textures/default_permafrost.png
Normal file
After Width: | Height: | Size: 266 B |
BIN
mods/default/textures/default_pine_bush_sapling.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
mods/default/textures/default_pine_bush_stem.png
Normal file
After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 391 B After Width: | Height: | Size: 766 B |
BIN
mods/default/textures/default_stones.png
Normal file
After Width: | Height: | Size: 405 B |
BIN
mods/default/textures/default_stones_side.png
Normal file
After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 140 B |
@ -50,6 +50,20 @@ minetest.register_tool("default:pick_stone", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:pick_bronze", {
|
||||
description = "Bronze Pickaxe",
|
||||
inventory_image = "default_tool_bronzepick.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
cracky = {times={[1]=4.50, [2]=1.80, [3]=0.90}, uses=20, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:pick_steel", {
|
||||
description = "Steel Pickaxe",
|
||||
inventory_image = "default_tool_steelpick.png",
|
||||
@ -64,20 +78,6 @@ minetest.register_tool("default:pick_steel", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:pick_bronze", {
|
||||
description = "Bronze Pickaxe",
|
||||
inventory_image = "default_tool_bronzepick.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:pick_mese", {
|
||||
description = "Mese Pickaxe",
|
||||
inventory_image = "default_tool_mesepick.png",
|
||||
@ -141,6 +141,21 @@ minetest.register_tool("default:shovel_stone", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:shovel_bronze", {
|
||||
description = "Bronze Shovel",
|
||||
inventory_image = "default_tool_bronzeshovel.png",
|
||||
wield_image = "default_tool_bronzeshovel.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.1,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
crumbly = {times={[1]=1.65, [2]=1.05, [3]=0.45}, uses=25, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=3},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:shovel_steel", {
|
||||
description = "Steel Shovel",
|
||||
inventory_image = "default_tool_steelshovel.png",
|
||||
@ -156,21 +171,6 @@ minetest.register_tool("default:shovel_steel", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:shovel_bronze", {
|
||||
description = "Bronze Shovel",
|
||||
inventory_image = "default_tool_bronzeshovel.png",
|
||||
wield_image = "default_tool_bronzeshovel.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.1,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=3},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:shovel_mese", {
|
||||
description = "Mese Shovel",
|
||||
inventory_image = "default_tool_meseshovel.png",
|
||||
@ -234,6 +234,20 @@ minetest.register_tool("default:axe_stone", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:axe_bronze", {
|
||||
description = "Bronze Axe",
|
||||
inventory_image = "default_tool_bronzeaxe.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
choppy={times={[1]=2.75, [2]=1.70, [3]=1.15}, uses=20, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:axe_steel", {
|
||||
description = "Steel Axe",
|
||||
inventory_image = "default_tool_steelaxe.png",
|
||||
@ -248,20 +262,6 @@ minetest.register_tool("default:axe_steel", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:axe_bronze", {
|
||||
description = "Bronze Axe",
|
||||
inventory_image = "default_tool_bronzeaxe.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:axe_mese", {
|
||||
description = "Mese Axe",
|
||||
inventory_image = "default_tool_meseaxe.png",
|
||||
@ -283,7 +283,7 @@ minetest.register_tool("default:axe_diamond", {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2},
|
||||
choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy=7},
|
||||
},
|
||||
@ -323,6 +323,20 @@ minetest.register_tool("default:sword_stone", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:sword_bronze", {
|
||||
description = "Bronze Sword",
|
||||
inventory_image = "default_tool_bronzesword.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.8,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
snappy={times={[1]=2.75, [2]=1.30, [3]=0.375}, uses=25, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=6},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:sword_steel", {
|
||||
description = "Steel Sword",
|
||||
inventory_image = "default_tool_steelsword.png",
|
||||
@ -337,20 +351,6 @@ minetest.register_tool("default:sword_steel", {
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:sword_bronze", {
|
||||
description = "Bronze Sword",
|
||||
inventory_image = "default_tool_bronzesword.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.8,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=6},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:sword_mese", {
|
||||
description = "Mese Sword",
|
||||
inventory_image = "default_tool_mesesword.png",
|
||||
|
@ -1,39 +1,17 @@
|
||||
|
||||
--[[
|
||||
|
||||
Torch mod - formerly mod "Torches"
|
||||
======================
|
||||
|
||||
(c) Copyright BlockMen (2013-2015)
|
||||
(C) Copyright sofar <sofar@foo-projects.org> (2016)
|
||||
|
||||
This mod changes the default torch drawtype from "torchlike" to "mesh",
|
||||
giving the torch a three dimensional appearance. The mesh contains the
|
||||
proper pixel mapping to make the animation appear as a particle above
|
||||
the torch, while in fact the animation is just the texture of the mesh.
|
||||
|
||||
|
||||
License:
|
||||
~~~~~~~~
|
||||
(c) Copyright BlockMen (2013-2015)
|
||||
|
||||
Textures and Meshes/Models:
|
||||
CC-BY 3.0 BlockMen
|
||||
Note that the models were entirely done from scratch by sofar.
|
||||
|
||||
Code:
|
||||
Licensed under the GNU LGPL version 2.1 or higher.
|
||||
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;
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
--]]
|
||||
local function on_flood(pos, oldnode, newnode)
|
||||
minetest.add_item(pos, ItemStack("default:torch 1"))
|
||||
-- Play flame-extinguish sound if liquid is not an 'igniter'
|
||||
local nodedef = minetest.registered_items[newnode.name]
|
||||
if not (nodedef and nodedef.groups and
|
||||
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
||||
minetest.sound_play(
|
||||
"default_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.1}
|
||||
)
|
||||
end
|
||||
-- Remove the torch node
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_node("default:torch", {
|
||||
description = "Torch",
|
||||
@ -84,7 +62,9 @@ minetest.register_node("default:torch", {
|
||||
itemstack:set_name("default:torch")
|
||||
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
|
||||
minetest.register_node("default:torch_wall", {
|
||||
@ -106,6 +86,8 @@ minetest.register_node("default:torch_wall", {
|
||||
wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
|
||||
minetest.register_node("default:torch_ceiling", {
|
||||
@ -127,6 +109,8 @@ minetest.register_node("default:torch_ceiling", {
|
||||
wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
|
@ -81,10 +81,22 @@ function default.grow_sapling(pos)
|
||||
minetest.log("action", "A bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_bush(pos)
|
||||
elseif node.name == "default:blueberry_bush_sapling" then
|
||||
minetest.log("action", "A blueberry bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_blueberry_bush(pos)
|
||||
elseif node.name == "default:acacia_bush_sapling" then
|
||||
minetest.log("action", "An acacia bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_acacia_bush(pos)
|
||||
elseif node.name == "default:pine_bush_sapling" then
|
||||
minetest.log("action", "A pine bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_pine_bush(pos)
|
||||
elseif node.name == "default:emergent_jungle_sapling" then
|
||||
minetest.log("action", "An emergent jungle sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_new_emergent_jungle_tree(pos)
|
||||
end
|
||||
end
|
||||
|
||||
@ -379,7 +391,7 @@ end
|
||||
function default.grow_new_apple_tree(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/apple_tree_from_sapling.mts"
|
||||
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||
minetest.place_schematic({x = pos.x - 3, y = pos.y - 1, z = pos.z - 3},
|
||||
path, "random", nil, false)
|
||||
end
|
||||
|
||||
@ -394,11 +406,27 @@ function default.grow_new_jungle_tree(pos)
|
||||
end
|
||||
|
||||
|
||||
-- New emergent jungle tree
|
||||
|
||||
function default.grow_new_emergent_jungle_tree(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/emergent_jungle_tree_from_sapling.mts"
|
||||
minetest.place_schematic({x = pos.x - 3, y = pos.y - 5, z = pos.z - 3},
|
||||
path, "random", nil, false)
|
||||
end
|
||||
|
||||
|
||||
-- New pine tree
|
||||
|
||||
function default.grow_new_pine_tree(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/pine_tree_from_sapling.mts"
|
||||
local path
|
||||
if math.random() > 0.5 then
|
||||
path = minetest.get_modpath("default") ..
|
||||
"/schematics/pine_tree_from_sapling.mts"
|
||||
else
|
||||
path = minetest.get_modpath("default") ..
|
||||
"/schematics/small_pine_tree_from_sapling.mts"
|
||||
end
|
||||
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
@ -407,8 +435,14 @@ end
|
||||
-- New snowy pine tree
|
||||
|
||||
function default.grow_new_snowy_pine_tree(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/snowy_pine_tree_from_sapling.mts"
|
||||
local path
|
||||
if math.random() > 0.5 then
|
||||
path = minetest.get_modpath("default") ..
|
||||
"/schematics/snowy_pine_tree_from_sapling.mts"
|
||||
else
|
||||
path = minetest.get_modpath("default") ..
|
||||
"/schematics/snowy_small_pine_tree_from_sapling.mts"
|
||||
end
|
||||
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||
path, "random", nil, false)
|
||||
end
|
||||
@ -446,6 +480,15 @@ function default.grow_bush(pos)
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
-- Blueberry bush
|
||||
|
||||
function default.grow_blueberry_bush(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/blueberry_bush.mts"
|
||||
minetest.place_schematic({x = pos.x - 1, y = pos.y, z = pos.z - 1},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
|
||||
-- Acacia bush
|
||||
|
||||
@ -457,6 +500,26 @@ function default.grow_acacia_bush(pos)
|
||||
end
|
||||
|
||||
|
||||
-- Pine bush
|
||||
|
||||
function default.grow_pine_bush(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/pine_bush.mts"
|
||||
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
|
||||
-- Large cactus
|
||||
|
||||
function default.grow_large_cactus(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/large_cactus.mts"
|
||||
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||
path, "random", nil, false)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Sapling 'on place' function to check protection of node and resulting tree volume
|
||||
--
|
||||
@ -490,14 +553,16 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
|
||||
return itemstack
|
||||
end
|
||||
-- Check tree volume for protection
|
||||
if default.intersects_protection(
|
||||
if minetest.is_area_protected(
|
||||
vector.add(pos, minp_relative),
|
||||
vector.add(pos, maxp_relative),
|
||||
player_name,
|
||||
interval) then
|
||||
minetest.record_protection_violation(pos, player_name)
|
||||
-- Print extra information to explain
|
||||
minetest.chat_send_player(player_name, "Tree will intersect protection")
|
||||
minetest.chat_send_player(player_name,
|
||||
itemstack:get_definition().description .. " will intersect protection " ..
|
||||
"on growth")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|