Cleanup
This commit is contained in:
parent
1688f8e2f0
commit
6f737fae58
40
mods/default/food.lua
Normal file
40
mods/default/food.lua
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
minetest.register_craftitem("default:old_bread", {
|
||||||
|
description = "Old Bread",
|
||||||
|
inventory_image = "default_oldbread.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
stack_max = 60
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("default:old_apple", {
|
||||||
|
description = "Old Apple",
|
||||||
|
inventory_image = "default_oldapple.png",
|
||||||
|
on_use = minetest.item_eat(1),
|
||||||
|
stack_max = 60
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("default:apple", {
|
||||||
|
description = "Apple",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 1.0,
|
||||||
|
tiles = {"default_apple.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
inventory_image = "default_apple.png",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
||||||
|
},
|
||||||
|
groups = {dig=default.dig.instant, fleshy=3, flammable=2, leafdecay=3, leafdecay_drop=1},
|
||||||
|
on_use = minetest.item_eat(1),
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
after_place_node = function(pos, placer, itemstack)
|
||||||
|
if placer:is_player() then
|
||||||
|
minetest.set_node(pos, {name = "default:apple", param2 = 1})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
stack_max = 60
|
||||||
|
})
|
||||||
|
|
||||||
|
|
@ -105,35 +105,6 @@ function default.drop_node_inventory()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FIXME this is bugged when a player is (timed-out?)
|
|
||||||
-- and a kick will result in a crash
|
|
||||||
-- Something about inv being nil?
|
|
||||||
|
|
||||||
function default.drop_player_inventory(pos, digger)
|
|
||||||
pos.y = pos.y+1.5
|
|
||||||
local inv = digger:get_inventory()
|
|
||||||
for i = 1, inv:get_size("main") do
|
|
||||||
local stack = inv:get_stack("main", i)
|
|
||||||
if not stack:is_empty() then
|
|
||||||
local p = { x = pos.x + math.random(0, 5)/5 - 0.5,
|
|
||||||
y = pos.y,
|
|
||||||
z = pos.z + math.random(0, 5)/5 - 0.5
|
|
||||||
}
|
|
||||||
minetest.add_item(p, stack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for i = 1, inv:get_size("craft") do
|
|
||||||
local stack = inv:get_stack("craft", i)
|
|
||||||
if not stack:is_empty() then
|
|
||||||
local p = { x = pos.x + math.random(0, 5)/5 - 0.5,
|
|
||||||
y = pos.y,
|
|
||||||
z = pos.z + math.random(0, 5)/5 - 0.5
|
|
||||||
}
|
|
||||||
minetest.add_item(p, stack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Grow trees
|
-- Grow trees
|
||||||
--
|
--
|
||||||
@ -373,6 +344,21 @@ minetest.register_abm({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = "default:ice",
|
||||||
|
interval = 30,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node)
|
||||||
|
if (minetest.get_node_light(pos)) < 13 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.set_node(pos, {name = "default:water_source"})
|
||||||
|
nodeupdate(pos)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode)
|
minetest.register_on_placenode(function(pos, newnode, placer, oldnode)
|
||||||
if placer:is_player() then
|
if placer:is_player() then
|
||||||
if newnode.name == "default:sapling" or
|
if newnode.name == "default:sapling" or
|
||||||
|
@ -135,6 +135,7 @@ local modpath = minetest.get_modpath("default")
|
|||||||
|
|
||||||
dofile(modpath .. "/functions.lua")
|
dofile(modpath .. "/functions.lua")
|
||||||
dofile(modpath .. "/nodes.lua")
|
dofile(modpath .. "/nodes.lua")
|
||||||
|
dofile(modpath .. "/food.lua")
|
||||||
dofile(modpath .. "/furnace.lua")
|
dofile(modpath .. "/furnace.lua")
|
||||||
dofile(modpath .. "/tools.lua")
|
dofile(modpath .. "/tools.lua")
|
||||||
dofile(modpath .. "/craftitems.lua")
|
dofile(modpath .. "/craftitems.lua")
|
||||||
|
@ -960,7 +960,6 @@ minetest.register_node("default:sign_wall_protected", {
|
|||||||
|
|
||||||
default.chest_formspec =
|
default.chest_formspec =
|
||||||
"size[8,9]" ..
|
"size[8,9]" ..
|
||||||
--default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
default.gui_bg_img ..
|
||||||
default.gui_slots ..
|
default.gui_slots ..
|
||||||
"list[current_name;main;0,0.3;8,4;]" ..
|
"list[current_name;main;0,0.3;8,4;]" ..
|
||||||
@ -974,7 +973,6 @@ function default.get_locked_chest_formspec(pos)
|
|||||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||||
local formspec =
|
local formspec =
|
||||||
"size[8,9]" ..
|
"size[8,9]" ..
|
||||||
--default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
default.gui_bg_img ..
|
||||||
default.gui_slots ..
|
default.gui_slots ..
|
||||||
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
|
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
|
||||||
@ -1044,6 +1042,7 @@ minetest.register_node("default:chest_locked", {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("infotext", "Locked Chest")
|
||||||
meta:set_string("owner", "")
|
meta:set_string("owner", "")
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8 * 4)
|
inv:set_size("main", 8 * 4)
|
||||||
@ -1053,13 +1052,10 @@ minetest.register_node("default:chest_locked", {
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
|
return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
allow_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
|
to_list, to_index, count, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if not has_locked_chest_privilege(meta, player) then
|
if not has_locked_chest_privilege(meta, player) then
|
||||||
minetest.log("action", player:get_player_name() ..
|
|
||||||
" tried to access a locked chest belonging to " ..
|
|
||||||
meta:get_string("owner") .. " at " ..
|
|
||||||
minetest.pos_to_string(pos))
|
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
@ -1177,7 +1173,6 @@ minetest.register_node("default:bronzeblock", {
|
|||||||
stack_max = 20
|
stack_max = 20
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("default:goldblock", {
|
minetest.register_node("default:goldblock", {
|
||||||
description = "Gold Block",
|
description = "Gold Block",
|
||||||
tiles = {"default_gold_block.png"},
|
tiles = {"default_gold_block.png"},
|
||||||
@ -1234,45 +1229,6 @@ minetest.register_node("default:sapling", {
|
|||||||
stack_max = 60
|
stack_max = 60
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:apple", {
|
|
||||||
description = "Apple",
|
|
||||||
drawtype = "plantlike",
|
|
||||||
visual_scale = 1.0,
|
|
||||||
tiles = {"default_apple.png"},
|
|
||||||
is_ground_content = false,
|
|
||||||
inventory_image = "default_apple.png",
|
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
|
||||||
},
|
|
||||||
groups = {dig=default.dig.instant, fleshy=3, flammable=2, leafdecay=3, leafdecay_drop=1},
|
|
||||||
on_use = minetest.item_eat(1),
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
after_place_node = function(pos, placer, itemstack)
|
|
||||||
if placer:is_player() then
|
|
||||||
minetest.set_node(pos, {name="default:apple", param2=1})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
stack_max = 60
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:old_apple", {
|
|
||||||
description = "Old Apple",
|
|
||||||
inventory_image = "default_oldapple.png",
|
|
||||||
on_use = minetest.item_eat(1),
|
|
||||||
stack_max = 60
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("default:old_bread", {
|
|
||||||
description = "Old Bread",
|
|
||||||
inventory_image = "default_oldbread.png",
|
|
||||||
on_use = minetest.item_eat(2),
|
|
||||||
stack_max = 60
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:dry_shrub", {
|
minetest.register_node("default:dry_shrub", {
|
||||||
description = "Dry Shrub",
|
description = "Dry Shrub",
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -1309,20 +1265,6 @@ minetest.register_node("default:ice", {
|
|||||||
stack_max = 40
|
stack_max = 40
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = "default:ice",
|
|
||||||
interval = 30,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node)
|
|
||||||
if (minetest.get_node_light(pos)) < 13 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
minetest.set_node(pos, {name = "default:water_source"})
|
|
||||||
nodeupdate(pos)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("default:snow", {
|
minetest.register_node("default:snow", {
|
||||||
description = "Snow",
|
description = "Snow",
|
||||||
tiles = {"default_snow.png"},
|
tiles = {"default_snow.png"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user