use proper mesh model instead of embedding a node def into

water reedmace entity texture (the latter was used to get plantlike look,
now using a mesh model for same).
This commit is contained in:
Vanessa Ezekowitz 2014-11-24 23:34:35 -05:00
parent d6e9d0a46e
commit be147c83a3
2 changed files with 77 additions and 18 deletions

View File

@ -0,0 +1,56 @@
# Blender v2.69 (sub 0) OBJ File: 'plantlike.blend'
# www.blender.org
mtllib plantlike.mtl
o Plane.001
v 0.347299 -0.500000 -0.359699
v -0.347299 -0.500000 0.359699
v 0.347299 0.500000 -0.359699
v -0.347299 0.500000 0.359699
v 0.359699 -0.500000 0.347299
v -0.359699 -0.500000 -0.347299
v 0.359699 0.500000 0.347299
v -0.359699 0.500000 -0.347299
v -0.347659 -0.500000 0.359352
v -0.347659 0.500000 0.359351
v 0.346940 0.500000 -0.360046
v 0.346940 -0.500000 -0.360046
v -0.359352 -0.500000 -0.347659
v -0.359351 0.500000 -0.347659
v 0.360046 0.500000 0.346939
v 0.360046 -0.500000 0.346940
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.999500 0.499625
vt 0.999500 0.000000
vt 0.999750 0.000000
vt 0.999750 0.499625
vt 0.999250 0.499625
vt 0.999251 0.000000
vt 0.999750 0.999250
vt 0.999500 0.999250
vt 1.000000 0.499625
vt 1.000000 0.999250
vt 0.499625 0.999500
vt 0.000000 0.999500
vt 0.000000 0.999250
vt 0.499625 0.999250
vt 0.999251 0.999250
vt 0.499625 0.999251
vt 0.999250 0.999250
vt 0.999250 0.999500
usemtl None
s off
f 2/1 1/2 3/3 4/4
f 6/1 5/2 7/3 8/4
f 9/2 10/3 11/4 12/1
f 13/2 14/3 15/4 16/1
f 5/5 6/6 13/7 16/8
f 7/6 5/5 16/9 15/10
f 8/8 7/11 15/12 14/5
f 6/13 8/14 14/11 13/8
f 1/15 2/16 9/17 12/18
f 3/5 1/12 12/19 11/9
f 4/20 3/21 11/22 10/15
f 2/2 4/13 10/8 9/7

View File

@ -49,6 +49,7 @@ abstract_dryplants.grow_reedmace = function(pos)
end
abstract_dryplants.grow_reedmace_water = function(pos)
print("abstract_dryplants.grow_reedmace_water executed.")
local size = math.random(1,3)
local spikes = math.random(1,3)
local pos_01 = {x = pos.x, y = pos.y + 1, z = pos.z}
@ -56,22 +57,23 @@ abstract_dryplants.grow_reedmace_water = function(pos)
local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z}
local pos_04 = {x = pos.x, y = pos.y + 4, z = pos.z}
minetest.add_entity(pos_01, "dryplants:reedmace_water_entity")
print("dryplants:reedmace_water_entity spawned at"..dump(pos))
if minetest.get_node(pos_02).name == "air" then -- bug fix
if minetest.get_node(pos_03).name ~= "air" then
minetest.set_node(pos_02, {name="dryplants:reedmace_top"})
elseif minetest.get_node(pos_04).name ~= "air" then
minetest.set_node(pos_02, {name="dryplants:reedmace_height_2"})
elseif size == 1 then
minetest.set_node(pos_02, {name="dryplants:reedmace_top"})
elseif size == 2 then
minetest.set_node(pos_02, {name="dryplants:reedmace_height_2"})
elseif size == 3 then
if spikes == 1 then
minetest.set_node(pos_02, {name="dryplants:reedmace_height_3_spikes"})
else
minetest.set_node(pos_02, {name="dryplants:reedmace_height_3"})
end
end
if minetest.get_node(pos_03).name ~= "air" then
minetest.set_node(pos_02, {name="dryplants:reedmace_top"})
elseif minetest.get_node(pos_04).name ~= "air" then
minetest.set_node(pos_02, {name="dryplants:reedmace_height_2"})
elseif size == 1 then
minetest.set_node(pos_02, {name="dryplants:reedmace_top"})
elseif size == 2 then
minetest.set_node(pos_02, {name="dryplants:reedmace_height_2"})
elseif size == 3 then
if spikes == 1 then
minetest.set_node(pos_02, {name="dryplants:reedmace_height_3_spikes"})
else
minetest.set_node(pos_02, {name="dryplants:reedmace_height_3"})
end
end
end
end
@ -308,9 +310,10 @@ minetest.register_node("dryplants:reedmace_water", {
-- REEDMACE WATER ENTITY
-----------------------------------------------------------------------------------------------
minetest.register_entity("dryplants:reedmace_water_entity",{
visual = "wielditem",
visual_size = {x=2/3, y=2/3, z=2/3},
textures = {"dryplants:reedmace_water"},
visual = "mesh",
mesh = "plantlike.obj",
visual_size = {x=10, y=10},
textures = {"dryplants_reedmace_water.png"},
collisionbox = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
on_punch = function(self, puncher)
if puncher:is_player() and puncher:get_inventory() then