first commit

master
Ginger Pollard 2014-12-21 02:50:06 -05:00
commit 1450c6c510
5 changed files with 472 additions and 0 deletions

2
depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
wool

150
init.lua Normal file
View File

@ -0,0 +1,150 @@
function grow_tree(data, a, pos)
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_tree = minetest.get_content_id("default:tree")
local c_leaves = minetest.get_content_id("xmas:leaves")
--local c_star = minetest.get_content_id("xmas:star")
local x, y, z = pos.x, pos.y, pos.z
for yy = y, y+18 do
for twx = -1, 1 do
for twz = -1, 1 do
local vi = a:index(x+twx, yy, z+twz)
if a:contains(x+twx, yy, z+twz) and (data[vi] == c_air or yy == y) then
data[vi] = c_tree
end
end
end
end
--[[local vi = a:index(x, y+25, z)
if a:contains(x, y+25, z) and (data[vi] == c_air or yy == y) then
data[vi] = c_star
end]]
for yindex = 3, 24 do
for xindex = -12, 12 do
for zindex = -12, 12 do
if a:contains(x+xindex, y+yindex, z+zindex) and math.abs(xindex) <= (23-yindex)/2 and math.abs(zindex) <= (23-yindex)/2 then
local vi = a:index(x+xindex, y+yindex, z+zindex)
if data[vi] == (c_air or c_ignore) and math.abs(xindex)+math.abs(zindex) <= (23-yindex)/1.25 then
if math.random(100) <=100 then
if (math.abs(xindex) == (23-yindex)/2 or math.abs(zindex) == (23-yindex)/2) and math.random(1, 100) <= 16 then
local c_fruit = minetest.get_content_id("xmas:ball_"..math.random(1,4))
data[vi] = c_fruit
else
data[vi] = c_leaves
end
end
end
end
end
end
end
end
minetest.register_abm({
nodenames = {"xmas:sapling"},
interval = 1,
chance = 1,
action = function(pos, node)
minetest.log("action", "A xmas tree grows @"..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y-2, z=pos.z-16}, {x=pos.x+16, y=pos.y+26, z=pos.z+16})
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
local data = vm:get_data()
grow_tree(data, a, pos)
vm:set_data(data)
vm:write_to_map(data)
vm:update_map()
end
})
minetest.register_node("xmas:sapling", {
description = "Xmas Tree Sapling",
drawtype = "plantlike",
visual_scale = 2,
tiles = {"xmas_sapling.png"},
inventory_image = "xmas_sapling.png",
wield_image = "xmas_sapling.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
selection_box = {
type = "fixed",
fixed = {-0.65, -0.80, -0.65, 0.65, 0.525, 0.65}
},
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("xmas:leaves", {
description = "Jungle Leaves",
drawtype = "plantlike",
visual_scale = 1.5,
tiles = {"xmas_leaves.png"},
paramtype = "light",
waving = 1,
is_ground_content = false,
groups = {snappy=3,leafdecay=13,flammable=2,not_in_creative_inventory=1},
drop = "",
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("xmas:ball_1", {
description = "Xmas Ball Red",
mesh = "ball.obj",
drawtype = "mesh",
tiles = {"wool_red.png"},
paramtype = "light",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,leafdecay=12},
sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
selection_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
})
minetest.register_node("xmas:ball_2", {
description = "Xmas Ball Blue",
mesh = "ball.obj",
drawtype = "mesh",
tiles = {"wool_blue.png"},
paramtype = "light",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,leafdecay=12},
sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
selection_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
})
minetest.register_node("xmas:ball_3", {
description = "Xmas Ball Silver",
mesh = "ball.obj",
drawtype = "mesh",
tiles = {"wool_grey.png"},
paramtype = "light",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,leafdecay=12},
sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
selection_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
})
minetest.register_node("xmas:ball_4", {
description = "Xmas Ball Purple",
mesh = "ball.obj",
drawtype = "mesh",
tiles = {"wool_violet.png"},
paramtype = "light",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,leafdecay=12},
sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
selection_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
})
--[[minetest.register_node("xmas:star", {
description = "Xmas Star",
mesh = "star.obj",
drawtype = "mesh",
tiles = {"wool_yellow.png"},
paramtype = "light",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,leafdecay=12},
sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
selection_box = {type = "fixed",fixed = {{-1.0, -1.0, -1.0, 1.0, 1.0, 1.0},},},
})]]

320
models/ball.obj Normal file
View File

@ -0,0 +1,320 @@
# Blender v2.66 (sub 1) OBJ File: ''
# www.blender.org
mtllib ball.mtl
o Mball_Meta
v -0.600000 -0.774694 0.600000
v -0.774694 -0.600000 0.600000
v -0.600000 -0.600000 0.774694
v -0.960477 -0.200000 0.600000
v -0.600000 -0.200000 0.960477
v -0.960477 0.200000 0.600000
v -0.600000 0.200000 0.960477
v -1.000000 -0.200000 0.511270
v -1.000000 0.200000 0.511270
v -1.000000 0.511270 0.200000
v -0.960477 0.600000 0.200000
v -0.774694 0.600000 0.600000
v -0.600000 0.774694 0.600000
v -0.600000 0.960477 0.200000
v -0.960477 0.600000 -0.200000
v -0.600000 0.960477 -0.200000
v -1.000000 0.511270 -0.200000
v -1.131212 0.200000 0.200000
v -1.131212 0.200000 -0.200000
v -0.511270 0.200000 1.000000
v -0.511270 -0.200000 1.000000
v -0.600000 0.600000 0.774694
v -0.200000 0.600000 0.960477
v -0.200000 0.511270 1.000000
v -0.200000 0.960477 0.600000
v 0.200000 0.960477 0.600000
v 0.200000 0.600000 0.960477
v -0.200000 0.200000 1.131212
v 0.200000 0.511270 1.000000
v 0.200000 0.200000 1.131212
v -1.000000 -0.511270 0.200000
v -0.960477 -0.600000 0.200000
v -0.960477 -0.600000 -0.200000
v -1.000000 -0.511270 -0.200000
v -0.600000 -0.960477 0.200000
v -0.600000 -0.960477 -0.200000
v -0.511270 -1.000000 0.200000
v -0.511270 -1.000000 -0.200000
v -0.200000 -1.000000 -0.511270
v -0.200000 -0.960477 -0.600000
v -0.600000 -0.774694 -0.600000
v -0.200000 -1.131212 -0.200000
v 0.200000 -1.131212 -0.200000
v 0.200000 -1.000000 -0.511270
v -0.200000 -0.600000 -0.960477
v -0.600000 -0.600000 -0.774694
v 0.200000 -0.960477 -0.600000
v 0.200000 -0.600000 -0.960477
v -0.200000 -0.960477 0.600000
v -0.200000 -1.000000 0.511270
v 0.200000 -0.960477 0.600000
v 0.200000 -1.000000 0.511270
v -0.200000 -0.600000 0.960477
v 0.200000 -0.600000 0.960477
v -0.200000 -0.511270 1.000000
v 0.200000 -0.511270 1.000000
v 0.511270 -0.200000 1.000000
v 0.600000 -0.200000 0.960477
v 0.600000 -0.600000 0.774694
v 0.511270 0.200000 1.000000
v 0.600000 0.200000 0.960477
v 0.200000 -0.200000 1.131212
v 0.960477 0.200000 0.600000
v 0.960477 -0.200000 0.600000
v 0.774694 -0.600000 0.600000
v 0.600000 -0.774694 0.600000
v 0.600000 -0.960477 0.200000
v 0.511270 -1.000000 0.200000
v 0.200000 -1.131212 0.200000
v 0.511270 -1.000000 -0.200000
v 0.600000 -0.960477 -0.200000
v 0.960477 -0.600000 0.200000
v 0.960477 -0.600000 -0.200000
v -0.774694 -0.600000 -0.600000
v -0.960477 -0.200000 -0.600000
v -1.000000 -0.200000 -0.511270
v -0.960477 0.200000 -0.600000
v -1.000000 0.200000 -0.511270
v -0.600000 -0.200000 -0.960477
v -0.600000 0.200000 -0.960477
v -1.131212 -0.200000 -0.200000
v -1.131212 -0.200000 0.200000
v -0.600000 0.774694 -0.600000
v -0.774694 0.600000 -0.600000
v -0.600000 0.600000 -0.774694
v -0.511270 0.200000 -1.000000
v -0.200000 0.511270 -1.000000
v -0.200000 0.600000 -0.960477
v -0.200000 0.200000 -1.131212
v 0.200000 0.200000 -1.131212
v 0.200000 0.511270 -1.000000
v 0.511270 0.200000 -1.000000
v 0.200000 -0.200000 -1.131212
v 0.511270 -0.200000 -1.000000
v 0.200000 -0.511270 -1.000000
v 0.600000 -0.600000 -0.774694
v 0.600000 -0.200000 -0.960477
v 0.600000 0.200000 -0.960477
v 0.200000 0.600000 -0.960477
v -0.200000 0.960477 -0.600000
v -0.200000 1.000000 -0.511270
v -0.511270 1.000000 -0.200000
v -0.200000 1.131212 -0.200000
v 0.200000 1.000000 -0.511270
v 0.200000 1.131212 -0.200000
v 0.511270 1.000000 -0.200000
v 0.200000 1.131212 0.200000
v 0.511270 1.000000 0.200000
v 0.600000 0.960477 0.200000
v 0.600000 0.960477 -0.200000
v 0.200000 1.000000 0.511270
v 0.600000 0.774694 0.600000
v 0.200000 0.960477 -0.600000
v -0.200000 -0.200000 1.131212
v -0.200000 -1.131212 0.200000
v -0.200000 1.131212 0.200000
v -0.200000 1.000000 0.511270
v -0.511270 1.000000 0.200000
v -0.200000 -0.200000 -1.131212
v -0.200000 -0.511270 -1.000000
v -0.511270 -0.200000 -1.000000
v 0.774694 0.600000 0.600000
v 0.600000 0.600000 0.774694
v 1.000000 0.511270 0.200000
v 1.000000 0.200000 0.511270
v 0.960477 0.600000 0.200000
v 0.960477 0.600000 -0.200000
v 1.000000 0.511270 -0.200000
v 1.131212 0.200000 -0.200000
v 1.131212 0.200000 0.200000
v 1.000000 0.200000 -0.511270
v 1.000000 -0.200000 -0.511270
v 1.131212 -0.200000 -0.200000
v 1.000000 -0.511270 -0.200000
v 0.960477 -0.200000 -0.600000
v 0.774694 -0.600000 -0.600000
v 0.960477 0.200000 -0.600000
v 1.131212 -0.200000 0.200000
v 1.000000 -0.511270 0.200000
v 1.000000 -0.200000 0.511270
v 0.600000 -0.774694 -0.600000
v 0.600000 0.774694 -0.600000
v 0.600000 0.600000 -0.774694
v 0.774694 0.600000 -0.600000
usemtl None
s 1
f 3 2 1
f 5 4 2 3
f 7 6 4 5
f 4 6 9 8
f 6 12 11 10
f 9 6 10
f 14 11 12 13
f 16 15 11 14
f 11 15 17 10
f 17 19 18 10
f 18 9 10
f 21 20 7 5
f 24 23 22 7
f 20 24 7
f 22 23 25 13
f 23 27 26 25
f 20 28 24
f 28 30 29 24
f 29 27 23 24
f 2 4 8 31
f 32 2 31
f 34 33 32 31
f 32 33 36 35
f 36 38 37 35
f 40 39 38 36
f 41 40 36
f 38 39 42
f 39 44 43 42
f 46 45 40 41
f 45 48 47 40
f 47 44 39 40
f 1 37 50 49
f 35 37 1
f 50 52 51 49
f 51 54 53 49
f 53 54 56 55
f 59 58 57 56
f 54 59 56
f 61 60 57 58
f 57 60 30 62
f 64 63 61 58
f 57 62 56
f 65 64 58 59
f 68 67 66 51
f 52 68 51
f 68 52 69
f 43 70 68 69
f 68 70 71 67
f 71 73 72 67
f 67 72 65 66
f 75 74 33 34
f 76 75 34
f 78 77 75 76
f 75 77 80 79
f 81 19 78 76
f 74 75 79 46
f 81 76 34
f 55 21 5 3
f 53 55 3
f 1 2 32 35
f 1 49 53 3
f 12 22 13
f 22 12 6 7
f 18 19 81 82
f 82 81 34 31
f 9 18 82 8
f 8 82 31
f 74 46 41
f 33 74 41 36
f 85 84 83
f 77 84 85 80
f 88 87 86 80
f 85 88 80
f 89 86 87
f 91 90 89 87
f 92 90 91
f 90 92 94 93
f 93 94 95
f 97 96 48 95
f 94 97 95
f 94 92 98 97
f 88 99 91 87
f 83 84 15 16
f 101 100 83 16
f 102 101 16
f 101 102 103
f 105 104 101 103
f 106 104 105
f 108 106 105 107
f 110 106 108 109
f 109 108 111 26
f 112 109 26
f 111 108 107
f 101 104 113 100
f 84 77 78 17
f 15 84 17
f 78 19 17
f 62 30 28 114
f 56 62 114 55
f 28 20 21 114
f 114 21 55
f 42 43 69 115
f 69 52 50 115
f 37 38 42 115
f 50 37 115
f 107 105 103 116
f 117 111 107 116
f 26 111 117 25
f 103 102 118 116
f 118 102 16 14
f 118 117 116
f 117 118 14 13
f 25 117 13
f 89 90 93 119
f 119 93 95 120
f 95 48 45 120
f 121 86 89 119
f 121 119 120
f 80 86 121 79
f 121 120 45 46
f 79 121 46
f 113 99 88 100
f 100 88 85 83
f 65 59 66
f 66 59 54 51
f 123 122 112
f 63 122 123 61
f 122 63 125 124
f 126 122 124
f 128 127 126 124
f 130 129 128 124
f 129 131 128
f 131 129 133 132
f 132 133 134
f 136 135 132 134
f 73 136 134
f 135 137 131 132
f 125 130 124
f 27 123 112 26
f 61 123 27 29
f 60 61 29
f 30 60 29
f 133 129 130 138
f 134 133 138 139
f 138 130 125 140
f 138 140 139
f 72 73 134 139
f 125 63 64 140
f 64 65 72 139
f 140 64 139
f 126 127 110 109
f 122 126 109 112
f 96 136 141
f 141 136 73 71
f 48 96 141 47
f 71 70 44 47
f 141 71 47
f 44 70 43
f 98 137 135 97
f 97 135 136 96
f 144 143 142
f 143 144 137 98
f 127 144 142 110
f 137 144 127 128
f 131 137 128
f 142 143 99 113
f 143 98 92 91
f 99 143 91
f 106 110 142 113
f 104 106 113

BIN
textures/xmas_leaves.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
textures/xmas_sapling.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B