Update minetest_game mods to 4.13
|
@ -30,12 +30,14 @@ local function check_protection(pos, name, text)
|
|||
end
|
||||
|
||||
-- Register a new liquid
|
||||
-- source = name of the source node
|
||||
-- flowing = name of the flowing node
|
||||
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
|
||||
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
||||
-- source = name of the source node
|
||||
-- flowing = name of the flowing node
|
||||
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
|
||||
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
||||
-- name = text description of the bucket item
|
||||
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
|
||||
-- This function can be called from any mod (that depends on bucket).
|
||||
function bucket.register_liquid(source, flowing, itemname, inventory_image, name)
|
||||
function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups)
|
||||
bucket.liquids[source] = {
|
||||
source = source,
|
||||
flowing = flowing,
|
||||
|
@ -49,6 +51,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||
inventory_image = inventory_image,
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
groups = groups,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
|
@ -105,7 +108,7 @@ end
|
|||
minetest.register_craftitem("bucket:bucket_empty", {
|
||||
description = "Empty Bucket",
|
||||
inventory_image = "bucket.png",
|
||||
stack_max = 1,
|
||||
stack_max = 99,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
|
@ -115,17 +118,41 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||
-- Check if pointing to a liquid source
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local liquiddef = bucket.liquids[node.name]
|
||||
if liquiddef ~= nil and liquiddef.itemname ~= nil and
|
||||
node.name == liquiddef.source then
|
||||
local item_count = user:get_wielded_item():get_count()
|
||||
|
||||
if liquiddef ~= nil
|
||||
and liquiddef.itemname ~= nil
|
||||
and node.name == liquiddef.source then
|
||||
if check_protection(pointed_thing.under,
|
||||
user:get_player_name(),
|
||||
"take ".. node.name) then
|
||||
return
|
||||
end
|
||||
|
||||
-- default set to return filled bucket
|
||||
local giving_back = liquiddef.itemname
|
||||
|
||||
-- check if holding more than 1 empty bucket
|
||||
if item_count > 1 then
|
||||
|
||||
-- if space in inventory add filled bucked, otherwise drop as item
|
||||
local inv = user:get_inventory()
|
||||
if inv:room_for_item("main", {name=liquiddef.itemname}) then
|
||||
inv:add_item("main", liquiddef.itemname)
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
core.add_item(pos, liquiddef.itemname)
|
||||
end
|
||||
|
||||
-- set to return empty buckets minus 1
|
||||
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
|
||||
|
||||
end
|
||||
|
||||
minetest.add_node(pointed_thing.under, {name="air"})
|
||||
|
||||
return ItemStack(liquiddef.itemname)
|
||||
return ItemStack(giving_back)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -135,7 +162,17 @@ bucket.register_liquid(
|
|||
"default:water_flowing",
|
||||
"bucket:bucket_water",
|
||||
"bucket_water.png",
|
||||
"Water Bucket"
|
||||
"Water Bucket",
|
||||
{water_bucket = 1}
|
||||
)
|
||||
|
||||
bucket.register_liquid(
|
||||
"default:river_water_source",
|
||||
"default:river_water_flowing",
|
||||
"bucket:bucket_river_water",
|
||||
"bucket_river_water.png",
|
||||
"River Water Bucket",
|
||||
{water_bucket = 1}
|
||||
)
|
||||
|
||||
bucket.register_liquid(
|
||||
|
@ -152,3 +189,4 @@ minetest.register_craft({
|
|||
burntime = 60,
|
||||
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
|
||||
})
|
||||
|
||||
|
|
After Width: | Height: | Size: 316 B |
|
@ -82,10 +82,15 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
|
|||
"list[current_player;main;5,4.75;8,3;8]"..
|
||||
"list[current_player;craft;8,0;3,3;]"..
|
||||
"list[current_player;craftpreview;12,1;1,1;]"..
|
||||
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
||||
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
|
||||
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
|
||||
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
|
||||
"button[2.7,6.5;1.6,1;creative_next;>>]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_player;craft]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[detached:creative;main]"..
|
||||
"label[5,1.5;Trash:]"..
|
||||
"list[detached:creative_trash;main;5,2;1,1;]"..
|
||||
default.get_hotbar_bg(5,3.5)
|
||||
|
|
|
@ -24,7 +24,6 @@ Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
|||
|
||||
Cisoun's WTFPL texture pack:
|
||||
default_jungletree.png
|
||||
default_jungletree_top.png
|
||||
default_lava.png
|
||||
default_leaves.png
|
||||
default_sapling.png
|
||||
|
@ -57,17 +56,14 @@ VanessaE (WTFPL):
|
|||
default_nc_front.png
|
||||
default_nc_rb.png
|
||||
default_nc_side.png
|
||||
default_grass_*.png
|
||||
default_desert_sand.png
|
||||
default_desert_stone.png
|
||||
default_desert_stone_brick.png
|
||||
default_sand.png
|
||||
default_sandstone_brick.png
|
||||
default_jungletree_top.png
|
||||
|
||||
Calinou (CC BY-SA):
|
||||
default_brick.png
|
||||
default_papyrus.png
|
||||
default_copper_lump.png
|
||||
default_mineral_copper.png
|
||||
default_glass_detail.png
|
||||
|
||||
|
@ -80,10 +76,8 @@ Jordach (CC BY-SA 3.0):
|
|||
PilzAdam (WTFPL):
|
||||
default_jungleleaves.png
|
||||
default_junglesapling.png
|
||||
default_junglewood.png
|
||||
default_obsidian_glass.png
|
||||
default_obsidian_shard.png
|
||||
default_gold_lump.png
|
||||
default_mineral_gold.png
|
||||
default_snowball.png
|
||||
|
||||
|
@ -96,7 +90,6 @@ InfinityProject (WTFPL):
|
|||
Splizard (CC BY-SA 3.0):
|
||||
default_snow.png
|
||||
default_snow_side.png
|
||||
default_ice.png
|
||||
default_pine_sapling.png
|
||||
|
||||
Zeg9 (CC BY-SA 3.0):
|
||||
|
@ -107,34 +100,50 @@ Zeg9 (CC BY-SA 3.0):
|
|||
default_gold_block.png
|
||||
|
||||
paramat (CC BY-SA 3.0):
|
||||
wieldhand.png, based on character.png by Jordach (CC BY-SA 3.0)
|
||||
wieldhand.png, derived from character.png by Jordach (CC BY-SA 3.0)
|
||||
default_pinetree.png
|
||||
default_pinetree_top.png
|
||||
default_pinewood.png
|
||||
default_sandstone_brick.png
|
||||
default_obsidian_brick.png
|
||||
default_river_water.png
|
||||
default_river_water_source_animated.png
|
||||
default_river_water_flowing_animated.png
|
||||
default_acacia_leaves.png
|
||||
default_acacia_sapling.png
|
||||
default_acacia_tree.png
|
||||
default_acacia_tree_top.png
|
||||
default_acacia_wood.png
|
||||
default_dry_grass.png
|
||||
default_dry_grass_side.png
|
||||
default_dry_grass_*.png
|
||||
default_junglewood.png, derived from a texture by BlockMen (CC BY-SA 3.0)
|
||||
default_grass.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
|
||||
default_grass_side.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
|
||||
default_stone_brick.png, derived from a texture by Cisoun (WTFPL)
|
||||
default_desert_stone_brick.png, derived from a texture by VanessaE (WTFPL)
|
||||
|
||||
brunob.santos (CC BY-SA 4.0):
|
||||
default_desert_cobble.png
|
||||
|
||||
BlockMen (CC BY-SA 3.0):
|
||||
default_stone_brick.png
|
||||
default_wood.png
|
||||
default_clay_brick.png
|
||||
default_tool_steelsword.png
|
||||
default_bronze_ingot.png
|
||||
default_copper_ingot.png
|
||||
default_iron_ingot.png
|
||||
default_gold_ingot.png
|
||||
default_tool_steelsword.png
|
||||
default_diamond.png
|
||||
default_diamond_block.png
|
||||
default_book.png
|
||||
default_tool_*.png
|
||||
default_lava_source_animated.png
|
||||
default_lava_flowing_animated.png
|
||||
default_book.png
|
||||
default_paper.png
|
||||
default_stick.png
|
||||
default_chest_front.png
|
||||
default_chest_lock.png
|
||||
default_chest_side.png
|
||||
default_chest_top.png
|
||||
default_mineral_mese.png
|
||||
default_meselamp.png
|
||||
bubble.png
|
||||
heart.png
|
||||
gui_*.png
|
||||
|
@ -146,9 +155,20 @@ Neuromancer (CC BY-SA 3.0):
|
|||
default_dirt.png
|
||||
default_furnace_*.png
|
||||
|
||||
Philipbenr (CC BY-SA 3.0):
|
||||
default_grass.png
|
||||
default_grass_side.png
|
||||
Gambit (WTFPL):
|
||||
default_bronze_ingot.png
|
||||
default_copper_ingot.png
|
||||
default_copper_lump.png
|
||||
default_iron_lump.png
|
||||
default_gold_lump.png
|
||||
default_clay_lump.png
|
||||
default_coal.png
|
||||
default_grass_*.png
|
||||
default_paper.png
|
||||
default_diamond_block.png
|
||||
|
||||
asl97 (WTFPL):
|
||||
default_ice.png
|
||||
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
-- aliases (Minetest 0.4 mod)
|
||||
-- Provides alias for most default items
|
||||
-- mods/default/aliases.lua
|
||||
|
||||
-- Aliases to support loading worlds using nodes following the old naming convention
|
||||
-- These can also be helpful when using chat commands, for example /giveme
|
||||
minetest.register_alias("stone", "default:stone")
|
||||
minetest.register_alias("stone_with_coal", "default:stone_with_coal")
|
||||
minetest.register_alias("stone_with_iron", "default:stone_with_iron")
|
||||
|
@ -65,3 +66,11 @@ minetest.register_alias("lump_of_iron", "default:iron_lump")
|
|||
minetest.register_alias("lump_of_clay", "default:clay_lump")
|
||||
minetest.register_alias("steel_ingot", "default:steel_ingot")
|
||||
minetest.register_alias("clay_brick", "default:clay_brick")
|
||||
minetest.register_alias("snow", "default:snow")
|
||||
|
||||
-- 'mese_block' was used for a while for the block form of mese
|
||||
minetest.register_alias("default:mese_block", "default:mese")
|
||||
|
||||
-- Aliases for corrected pine node names
|
||||
minetest.register_alias("default:pinetree", "default:pine_tree")
|
||||
minetest.register_alias("default:pinewood", "default:pine_wood")
|
||||
|
|
|
@ -15,9 +15,16 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:pinewood 4',
|
||||
output = 'default:pine_wood 4',
|
||||
recipe = {
|
||||
{'default:pinetree'},
|
||||
{'default:pine_tree'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:acacia_wood 4',
|
||||
recipe = {
|
||||
{'default:acacia_tree'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -324,7 +331,7 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:rail 15',
|
||||
output = 'default:rail 24',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
|
||||
|
@ -564,6 +571,14 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:meselamp 1',
|
||||
recipe = {
|
||||
{'', 'default:mese_crystal',''},
|
||||
{'default:mese_crystal', 'default:glass', 'default:mese_crystal'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:obsidian_shard 9',
|
||||
recipe = {
|
||||
|
@ -650,6 +665,12 @@ minetest.register_craft({
|
|||
recipe = "default:cobble",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:stone",
|
||||
recipe = "default:mossycobble",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:desert_stone",
|
||||
|
@ -782,7 +803,7 @@ minetest.register_craft({
|
|||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:sapling",
|
||||
recipe = "group:sapling",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
|
@ -804,12 +825,6 @@ minetest.register_craft({
|
|||
burntime = 370,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:junglesapling",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:grass_1",
|
||||
|
@ -818,7 +833,7 @@ minetest.register_craft({
|
|||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:pine_sapling",
|
||||
burntime = 10,
|
||||
recipe = "default:dry_grass_1",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
|
|
|
@ -11,10 +11,80 @@ minetest.register_craftitem("default:paper", {
|
|||
inventory_image = "default_paper.png",
|
||||
})
|
||||
|
||||
local function book_on_use(itemstack, user, pointed_thing)
|
||||
local player_name = user:get_player_name()
|
||||
local data = minetest.deserialize(itemstack:get_metadata())
|
||||
local title, text, owner = "", "", player_name
|
||||
if data then
|
||||
title, text, owner = data.title, data.text, data.owner
|
||||
end
|
||||
local formspec
|
||||
if owner == player_name then
|
||||
formspec = "size[8,8]"..default.gui_bg..
|
||||
"field[0.5,1;7.5,0;title;Title:;"..
|
||||
minetest.formspec_escape(title).."]"..
|
||||
"textarea[0.5,1.5;7.5,7;text;Contents:;"..
|
||||
minetest.formspec_escape(text).."]"..
|
||||
"button_exit[2.5,7.5;3,1;save;Save]"
|
||||
else
|
||||
formspec = "size[8,8]"..default.gui_bg..
|
||||
"label[0.5,0.5;by "..owner.."]"..
|
||||
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
|
||||
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
|
||||
end
|
||||
minetest.show_formspec(user:get_player_name(), "default:book", formspec)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, form_name, fields)
|
||||
if form_name ~= "default:book" or not fields.save or
|
||||
fields.title == "" or fields.text == "" then
|
||||
return
|
||||
end
|
||||
local inv = player:get_inventory()
|
||||
local stack = player:get_wielded_item()
|
||||
local new_stack, data
|
||||
if stack:get_name() ~= "default:book_written" then
|
||||
local count = stack:get_count()
|
||||
if count == 1 then
|
||||
stack:set_name("default:book_written")
|
||||
else
|
||||
stack:set_count(count - 1)
|
||||
new_stack = ItemStack("default:book_written")
|
||||
end
|
||||
else
|
||||
data = minetest.deserialize(stack:get_metadata())
|
||||
end
|
||||
if not data then data = {} end
|
||||
data.title = fields.title
|
||||
data.text = fields.text
|
||||
data.owner = player:get_player_name()
|
||||
local data_str = minetest.serialize(data)
|
||||
if new_stack then
|
||||
new_stack:set_metadata(data_str)
|
||||
if inv:room_for_item("main", new_stack) then
|
||||
inv:add_item("main", new_stack)
|
||||
else
|
||||
minetest.add_item(player:getpos(), new_stack)
|
||||
end
|
||||
else
|
||||
stack:set_metadata(data_str)
|
||||
end
|
||||
player:set_wielded_item(stack)
|
||||
end)
|
||||
|
||||
minetest.register_craftitem("default:book", {
|
||||
description = "Book",
|
||||
inventory_image = "default_book.png",
|
||||
groups = {book=1},
|
||||
on_use = book_on_use,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:book_written", {
|
||||
description = "Book With Text",
|
||||
inventory_image = "default_book.png",
|
||||
groups = {book=1, not_in_creative_inventory=1},
|
||||
stack_max = 1,
|
||||
on_use = book_on_use,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:coal_lump", {
|
||||
|
|
|
@ -7,20 +7,20 @@
|
|||
function default.node_sound_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="", gain=1.0}
|
||||
{name = "", gain = 1.0}
|
||||
table.dug = table.dug or
|
||||
{name="default_dug_node", gain=0.25}
|
||||
{name = "default_dug_node", gain = 0.25}
|
||||
table.place = table.place or
|
||||
{name="default_place_node_hard", gain=1.0}
|
||||
{name = "default_place_node_hard", gain = 1.0}
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_stone_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_hard_footstep", gain=0.5}
|
||||
{name = "default_hard_footstep", gain = 0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_hard_footstep", gain=1.0}
|
||||
{name = "default_hard_footstep", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -28,11 +28,11 @@ end
|
|||
function default.node_sound_dirt_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_dirt_footstep", gain=1.0}
|
||||
{name = "default_dirt_footstep", gain = 1.0}
|
||||
table.dug = table.dug or
|
||||
{name="default_dirt_footstep", gain=1.5}
|
||||
{name = "default_dirt_footstep", gain = 1.5}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
{name = "default_place_node", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -40,11 +40,11 @@ end
|
|||
function default.node_sound_sand_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_sand_footstep", gain=0.2}
|
||||
{name = "default_sand_footstep", gain = 0.2}
|
||||
table.dug = table.dug or
|
||||
{name="default_sand_footstep", gain=0.4}
|
||||
{name = "default_sand_footstep", gain = 0.4}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
{name = "default_place_node", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -52,9 +52,9 @@ end
|
|||
function default.node_sound_wood_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_wood_footstep", gain=0.5}
|
||||
{name = "default_wood_footstep", gain = 0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_wood_footstep", gain=1.0}
|
||||
{name = "default_wood_footstep", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -62,13 +62,13 @@ end
|
|||
function default.node_sound_leaves_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_grass_footstep", gain=0.35}
|
||||
{name = "default_grass_footstep", gain = 0.35}
|
||||
table.dug = table.dug or
|
||||
{name="default_grass_footstep", gain=0.7}
|
||||
{name = "default_grass_footstep", gain = 0.7}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_crumbly", gain=0.4}
|
||||
{name = "default_dig_crumbly", gain = 0.4}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
{name = "default_place_node", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -76,78 +76,37 @@ end
|
|||
function default.node_sound_glass_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_glass_footstep", gain=0.5}
|
||||
{name = "default_glass_footstep", gain = 0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_break_glass", gain=1.0}
|
||||
{name = "default_break_glass", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
--
|
||||
-- Legacy
|
||||
--
|
||||
|
||||
function default.spawn_falling_node(p, nodename)
|
||||
spawn_falling_node(p, nodename)
|
||||
end
|
||||
|
||||
-- Horrible crap to support old code
|
||||
-- Don't use this and never do what this does, it's completely wrong!
|
||||
-- (More specifically, the client and the C++ code doesn't get the group)
|
||||
function default.register_falling_node(nodename, texture)
|
||||
minetest.log("error", debug.traceback())
|
||||
minetest.log('error', "WARNING: default.register_falling_node is deprecated")
|
||||
if minetest.registered_nodes[nodename] then
|
||||
minetest.registered_nodes[nodename].groups.falling_node = 1
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Global callbacks
|
||||
--
|
||||
|
||||
-- Global environment step function
|
||||
function on_step(dtime)
|
||||
-- print("on_step")
|
||||
end
|
||||
minetest.register_globalstep(on_step)
|
||||
|
||||
function on_placenode(p, node)
|
||||
--print("on_placenode")
|
||||
end
|
||||
minetest.register_on_placenode(on_placenode)
|
||||
|
||||
function on_dignode(p, node)
|
||||
--print("on_dignode")
|
||||
end
|
||||
minetest.register_on_dignode(on_dignode)
|
||||
|
||||
function on_punchnode(p, node)
|
||||
end
|
||||
minetest.register_on_punchnode(on_punchnode)
|
||||
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
|
||||
default.cool_lava_source = function(pos)
|
||||
minetest.set_node(pos, {name="default:obsidian"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
minetest.set_node(pos, {name = "default:obsidian"})
|
||||
minetest.sound_play("default_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
end
|
||||
|
||||
default.cool_lava_flowing = function(pos)
|
||||
minetest.set_node(pos, {name="default:stone"})
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25})
|
||||
minetest.set_node(pos, {name = "default:stone"})
|
||||
minetest.sound_play("default_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:lava_flowing"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_flowing(pos, node, active_object_count, active_object_count_wider)
|
||||
chance = 2,
|
||||
action = function(...)
|
||||
default.cool_lava_flowing(...)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -155,38 +114,72 @@ minetest.register_abm({
|
|||
nodenames = {"default:lava_source"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_source(pos, node, active_object_count, active_object_count_wider)
|
||||
chance = 2,
|
||||
action = function(...)
|
||||
default.cool_lava_source(...)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Papyrus and cactus growing
|
||||
--
|
||||
|
||||
-- wrapping the functions in abm action is necessary to make overriding them possible
|
||||
|
||||
function default.grow_cactus(pos, node)
|
||||
if node.param2 >= 4 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y - 1
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
local height = 0
|
||||
while node.name == "default:cactus" and height < 4 do
|
||||
height = height + 1
|
||||
pos.y = pos.y + 1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "default:cactus"})
|
||||
return true
|
||||
end
|
||||
|
||||
function default.grow_papyrus(pos, node)
|
||||
pos.y = pos.y - 1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name ~= "default:dirt_with_grass" and name ~= "default:dirt" then
|
||||
return
|
||||
end
|
||||
if not minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
local height = 0
|
||||
while node.name == "default:papyrus" and height < 4 do
|
||||
height = height + 1
|
||||
pos.y = pos.y + 1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "default:papyrus"})
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:cactus"},
|
||||
neighbors = {"group:sand"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if minetest.get_item_group(name, "sand") ~= 0 then
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "default:cactus" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="default:cactus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
action = function(...)
|
||||
default.grow_cactus(...)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
|
@ -194,28 +187,12 @@ minetest.register_abm({
|
|||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "default:dirt" or name == "default:dirt_with_grass" then
|
||||
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="default:papyrus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
action = function(...)
|
||||
default.grow_papyrus(...)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- dig upwards
|
||||
--
|
||||
|
@ -229,6 +206,7 @@ function default.dig_up(pos, node, digger)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Leafdecay
|
||||
--
|
||||
|
@ -277,8 +255,10 @@ minetest.register_abm({
|
|||
if trunkp then
|
||||
local n = minetest.get_node(trunkp)
|
||||
local reg = minetest.registered_nodes[n.name]
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area
|
||||
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
|
||||
-- Assume ignore is a trunk, to make the thing
|
||||
-- work at the border of the active area
|
||||
if n.name == "ignore" or (reg and reg.groups.tree and
|
||||
reg.groups.tree ~= 0) then
|
||||
--print("cached trunk still exists")
|
||||
return
|
||||
end
|
||||
|
@ -292,7 +272,8 @@ minetest.register_abm({
|
|||
end
|
||||
default.leafdecay_trunk_find_allow_accumulator =
|
||||
default.leafdecay_trunk_find_allow_accumulator - 1
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area
|
||||
-- Assume ignore is a trunk, to make the thing
|
||||
-- work at the border of the active area
|
||||
local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"})
|
||||
if p1 then
|
||||
do_preserve = true
|
||||
|
@ -323,3 +304,44 @@ minetest.register_abm({
|
|||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Grass growing
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt"},
|
||||
interval = 2,
|
||||
chance = 200,
|
||||
action = function(pos, node)
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and
|
||||
nodedef.liquidtype == "none" and
|
||||
(minetest.get_node_light(above) or 0) >= 13 then
|
||||
if name == "default:snow" or name == "default:snowblock" then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
||||
else
|
||||
minetest.set_node(pos, {name = "default:dirt_with_grass"})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
|
||||
interval = 2,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or
|
||||
nodedef.paramtype == "light") and
|
||||
nodedef.liquidtype == "none") then
|
||||
minetest.set_node(pos, {name = "default:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@ local function active_formspec(fuel_percent, item_percent)
|
|||
"list[current_name;dst;4.75,0.96;2,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
return formspec
|
||||
end
|
||||
|
@ -34,6 +38,10 @@ local inactive_formspec =
|
|||
"list[current_name;dst;4.75,0.96;2,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
|
||||
--
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
-- Minetest 0.4 mod: default
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
-- The API documentation in here was moved into doc/lua_api.txt
|
||||
|
||||
WATER_ALPHA = 160
|
||||
WATER_VISC = 1
|
||||
LAVA_VISC = 7
|
||||
LIGHT_MAX = 14
|
||||
-- The API documentation in here was moved into game_api.txt
|
||||
|
||||
-- Definitions made by this mod that other mods can use too
|
||||
default = {}
|
||||
|
||||
default.LIGHT_MAX = 14
|
||||
|
||||
-- GUI related stuff
|
||||
default.gui_bg = "bgcolor[#080808BB;true]"
|
||||
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
|
||||
|
@ -24,7 +21,7 @@ function default.get_hotbar_bg(x,y)
|
|||
return out
|
||||
end
|
||||
|
||||
default.gui_suvival_form = "size[8,8.5]"..
|
||||
default.gui_survival_form = "size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
|
@ -33,6 +30,8 @@ default.gui_suvival_form = "size[8,8.5]"..
|
|||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
|
||||
"image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_player;craft]"..
|
||||
default.get_hotbar_bg(0,4.25)
|
||||
|
||||
-- Load files
|
||||
|
@ -46,3 +45,4 @@ dofile(minetest.get_modpath("default").."/mapgen.lua")
|
|||
dofile(minetest.get_modpath("default").."/player.lua")
|
||||
dofile(minetest.get_modpath("default").."/trees.lua")
|
||||
dofile(minetest.get_modpath("default").."/aliases.lua")
|
||||
dofile(minetest.get_modpath("default").."/legacy.lua")
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
-- mods/default/legacy.lua
|
||||
|
||||
-- Horrible crap to support old code registering falling nodes
|
||||
-- Don't use this and never do what this does, it's completely wrong!
|
||||
-- (More specifically, the client and the C++ code doesn't get the group)
|
||||
function default.register_falling_node(nodename, texture)
|
||||
minetest.log("error", debug.traceback())
|
||||
minetest.log('error', "WARNING: default.register_falling_node is deprecated")
|
||||
if minetest.registered_nodes[nodename] then
|
||||
minetest.registered_nodes[nodename].groups.falling_node = 1
|
||||
end
|
||||
end
|
||||
|
||||
function default.spawn_falling_node(p, nodename)
|
||||
spawn_falling_node(p, nodename)
|
||||
end
|
||||
|
||||
-- Liquids
|
||||
WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha
|
||||
WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity
|
||||
LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity
|
||||
LIGHT_MAX = default.LIGHT_MAX
|
||||
|
||||
-- Formspecs
|
||||
default.gui_suvival_form = default.gui_survival_form
|
|
@ -15,7 +15,7 @@ function default.player_register_model(name, def)
|
|||
end
|
||||
|
||||
-- Default player appearance
|
||||
default.player_register_model("character.x", {
|
||||
default.player_register_model("character.b3d", {
|
||||
animation_speed = 30,
|
||||
textures = {"character.png", },
|
||||
animations = {
|
||||
|
@ -93,12 +93,12 @@ 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")
|
||||
default.player_set_model(player, "character.b3d")
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
|
||||
-- set GUI
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
player:set_inventory_formspec(default.gui_suvival_form)
|
||||
player:set_inventory_formspec(default.gui_survival_form)
|
||||
end
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||
|
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 583 B After Width: | Height: | Size: 348 B |
After Width: | Height: | Size: 444 B |
After Width: | Height: | Size: 359 B |
After Width: | Height: | Size: 682 B |
After Width: | Height: | Size: 731 B |
After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 351 B |
After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 568 B After Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 314 B |
After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 267 B |
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 423 B |
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 422 B |
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 272 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 647 B After Width: | Height: | Size: 350 B |
After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 611 B |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 313 B |
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 219 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 295 B |
After Width: | Height: | Size: 316 B |
After Width: | Height: | Size: 339 B |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 219 B |
After Width: | Height: | Size: 466 B |
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 558 B |
Before Width: | Height: | Size: 656 B After Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 859 B After Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 490 B |
After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 160 B |