projects
/
oweals
/
minetest_game.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Saplings: Reduce grow time to ABM equivalent
[oweals/minetest_game.git]
/
mods
/
default
/
nodes.lua
diff --git
a/mods/default/nodes.lua
b/mods/default/nodes.lua
index 76e88afd03a359ee06d6f4fc25f1828929994fc5..701e70b644fef46f1b8c98c9972a0036cbe0aff6 100644
(file)
--- a/
mods/default/nodes.lua
+++ b/
mods/default/nodes.lua
@@
-608,7
+608,7
@@
minetest.register_node("default:sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
- minetest.get_node_timer(pos):start(math.random(
2400,48
00))
+ minetest.get_node_timer(pos):start(math.random(
300, 15
00))
end,
on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
@@
-693,7
+693,7
@@
minetest.register_node("default:jungletree", {
})
minetest.register_node("default:junglewood", {
})
minetest.register_node("default:junglewood", {
- description = "Jungle
w
ood Planks",
+ description = "Jungle
W
ood Planks",
paramtype2 = "facedir",
place_param2 = 0,
tiles = {"default_junglewood.png"},
paramtype2 = "facedir",
place_param2 = 0,
tiles = {"default_junglewood.png"},
@@
-742,7
+742,7
@@
minetest.register_node("default:junglesapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
- minetest.get_node_timer(pos):start(math.random(
2400,48
00))
+ minetest.get_node_timer(pos):start(math.random(
300, 15
00))
end,
on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
@@
-821,7
+821,7
@@
minetest.register_node("default:pine_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
- minetest.get_node_timer(pos):start(math.random(
2400,48
00))
+ minetest.get_node_timer(pos):start(math.random(
300, 15
00))
end,
on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
@@
-901,7
+901,7
@@
minetest.register_node("default:acacia_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
- minetest.get_node_timer(pos):start(math.random(
2400,48
00))
+ minetest.get_node_timer(pos):start(math.random(
300, 15
00))
end,
on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
@@
-979,7
+979,7
@@
minetest.register_node("default:aspen_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
- minetest.get_node_timer(pos):start(math.random(
2400,48
00))
+ minetest.get_node_timer(pos):start(math.random(
300, 15
00))
end,
on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
@@
-1362,7
+1362,7
@@
minetest.register_node("default:bush_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
- minetest.get_node_timer(pos):start(math.random(
1200, 24
00))
+ minetest.get_node_timer(pos):start(math.random(
300, 15
00))
end,
on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
@@
-1433,7
+1433,7
@@
minetest.register_node("default:acacia_bush_sapling", {
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
- minetest.get_node_timer(pos):start(math.random(
1200, 24
00))
+ minetest.get_node_timer(pos):start(math.random(
300, 15
00))
end,
on_place = function(itemstack, placer, pointed_thing)
end,
on_place = function(itemstack, placer, pointed_thing)
@@
-1773,23
+1773,24
@@
local function get_chest_formspec(pos)
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
- "list[nodemeta:" .. spos .. ";
default:chest
;0,0.3;8,4;]" ..
+ "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]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
- "listring[nodemeta:" .. spos .. ";
default:chest
]" ..
+ "listring[nodemeta:" .. spos .. ";
main
]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
return formspec
end
local function chest_lid_obstructed(pos)
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
return formspec
end
local function chest_lid_obstructed(pos)
- local above = {
x = pos.x, y = pos.y + 1, z = pos.z
}
+ 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
local def = minetest.registered_nodes[minetest.get_node(above).name]
-- allow ladders, signs, wallmounted things and torches to not obstruct
- if def.drawtype == "airlike" or
+ if def and
+ (def.drawtype == "airlike" or
def.drawtype == "signlike" or
def.drawtype == "torchlike" or
def.drawtype == "signlike" or
def.drawtype == "torchlike" or
- (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
+ (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")
)
then
return false
end
return true
return false
end
return true
@@
-1842,7
+1843,7
@@
function default.register_chest(name, d)
meta:set_string("infotext", "Locked Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
meta:set_string("infotext", "Locked Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
- inv:set_size("
default:chest
", 8*4)
+ inv:set_size("
main
", 8*4)
end
def.after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
end
def.after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
@@
-1853,7
+1854,7
@@
function default.register_chest(name, d)
def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
- return inv:is_empty("
default:chest
") and
+ 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,
default.can_interact_with_node(player, pos)
end
def.allow_metadata_inventory_move = function(pos, from_list, from_index,
@@
-1939,12
+1940,12
@@
function default.register_chest(name, d)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Chest")
local inv = meta:get_inventory()
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Chest")
local inv = meta:get_inventory()
- inv:set_size("
default:chest
", 8*4)
+ inv:set_size("
main
", 8*4)
end
def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
end
def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
- return inv:is_empty("
default:chest
")
+ return inv:is_empty("
main
")
end
def.on_rightclick = function(pos, node, clicker)
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
end
def.on_rightclick = function(pos, node, clicker)
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
@@
-1989,17
+1990,28
@@
function default.register_chest(name, d)
local def_closed = table.copy(def)
def_opened.mesh = "chest_open.obj"
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.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.can_dig = function()
return false
end
- def_closed.mesh = "cube.obj"
+ 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)
minetest.register_node("default:" .. name, def_closed)
minetest.register_node("default:" .. name .. "_open", def_opened)
@@
-2007,16
+2019,18
@@
function default.register_chest(name, d)
-- convert old chests to this new variant
minetest.register_lbm({
label = "update chests to opening chests",
-- convert old chests to this new variant
minetest.register_lbm({
label = "update chests to opening chests",
- name = "default:upgrade_" .. name,
+ 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()
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("main")
- inv:set_list("main", nil)
- inv:set_size("default:chest", 8*4)
- inv:set_list("default:chest", list)
+ 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
end
})
end
@@
-2024,7
+2038,14
@@
end
default.register_chest("chest", {
description = "Chest",
default.register_chest("chest", {
description = "Chest",
- tiles = { "default_chest_wood.png" },
+ 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",
sounds = default.node_sound_wood_defaults(),
sound_open = "default_chest_open",
sound_close = "default_chest_close",
@@
-2033,7
+2054,14
@@
default.register_chest("chest", {
default.register_chest("chest_locked", {
description = "Locked Chest",
default.register_chest("chest_locked", {
description = "Locked Chest",
- tiles = { "default_chest_wood_locked.png" },
+ 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",
sounds = default.node_sound_wood_defaults(),
sound_open = "default_chest_open",
sound_close = "default_chest_close",
@@
-2244,7
+2272,7
@@
default.register_fence("default:fence_acacia_wood", {
})
default.register_fence("default:fence_junglewood", {
})
default.register_fence("default:fence_junglewood", {
- description = "Jungle
w
ood Fence",
+ description = "Jungle
W
ood Fence",
texture = "default_fence_junglewood.png",
inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
texture = "default_fence_junglewood.png",
inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",