add plant pots
This commit is contained in:
parent
87a78267bf
commit
ca50395cee
77
mods/fl_plantlife/flowerpot.lua
Normal file
77
mods/fl_plantlife/flowerpot.lua
Normal file
@ -0,0 +1,77 @@
|
||||
minetest.register_entity("fl_plantlife:flowerpot_ent", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "farlands_plant3.obj",
|
||||
textures = {"[combine:16x16", "[combine:16x16"},
|
||||
static_save = true,
|
||||
backface_culling = false,
|
||||
shaded = false,
|
||||
visual_size = {x=10,y=10,z=10},
|
||||
collisionbox = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
||||
},
|
||||
|
||||
get_staticdata = function(self)
|
||||
local tmp = {memory = self.memory}
|
||||
return minetest.serialize(tmp)
|
||||
end,
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
local sdata = minetest.deserialize(staticdata)
|
||||
if sdata then
|
||||
for k,v in pairs(sdata) do
|
||||
self[k] = v
|
||||
end
|
||||
end
|
||||
if not self.memory then self.memory = {} end
|
||||
if self.memory.textures then self.object:set_properties({textures = self.memory.textures}) end
|
||||
self.name = "fl_plantlife:flower_ent"
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
--minetest.chat_send_all("punch")
|
||||
if not self.memory.item_name then return end
|
||||
minetest.add_item(self.object:get_pos(), ItemStack(self.memory.item_name))
|
||||
self.memory.item_name = nil
|
||||
self.memory.textures = {"[combine:16x16", "[combine:16x16"}
|
||||
--self.memory.textures = {"farlands_flower_dandelion_yellow.png", "farlands_flower_dandelion_yellow.png"}
|
||||
self.object:set_properties({textures = self.memory.textures})
|
||||
end,
|
||||
on_rightclick = function(self, clicker)
|
||||
--minetest.chat_send_all("rightclick")
|
||||
--self.memory.textures = {"farlands_flower_dandelion_white.png", "farlands_flower_dandelion_white.png"}
|
||||
--self.object:set_properties({textures = self.memory.textures})
|
||||
local stack = clicker:get_wielded_item()
|
||||
if minetest.get_item_group(stack:get_name(), "potable") ~= 1 then return end
|
||||
if self.memory.item_name then minetest.add_item(self.object:get_pos(), ItemStack(self.memory.item_name)) end
|
||||
self.memory.item_name = stack:get_name()
|
||||
local node_def = minetest.registered_nodes[stack:get_name()]
|
||||
self.memory.textures = {node_def.tiles[1] .. "^[transformR180", node_def.tiles[1] .. "^[transformR180"}
|
||||
self.object:set_properties({textures = self.memory.textures})
|
||||
end,
|
||||
})
|
||||
|
||||
local box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}}
|
||||
|
||||
minetest.register_node("fl_plantlife:flowerpot", {
|
||||
description = "flowerpot",
|
||||
paramtype = "light",
|
||||
drawtype = "mesh",
|
||||
visual_scale = 0.5,
|
||||
mesh = "farlands_flowerpot.obj",
|
||||
tiles = {"farlands_pot.png"},
|
||||
selection_box = box,
|
||||
collision_box = box,
|
||||
on_construct = function(pos)
|
||||
minetest.add_entity({x=pos.x, y=pos.y+0.3, z=pos.z}, "fl_plantlife:flowerpot_ent")
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local obj = minetest.get_objects_inside_radius(pos, 0.5)
|
||||
for _, objref in pairs(obj) do
|
||||
local ent = objref:get_luaentity()
|
||||
if objref and ent and ent.name == "fl_plantlife:flower_ent" then
|
||||
if ent.memory.item_name then minetest.add_item(objref:get_pos(), ItemStack(ent.memory.item_name)) end
|
||||
objref:remove() break
|
||||
end
|
||||
end
|
||||
end,
|
||||
groups = {oddly_breakable_by_hand = 3}
|
||||
})
|
@ -43,7 +43,7 @@ for _, name in ipairs(dir) do
|
||||
type = "fixed",
|
||||
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
||||
},
|
||||
groups = {oddly_breakable_by_hand = 3, plant = 1, flower = 1}
|
||||
groups = {oddly_breakable_by_hand = 3, plant = 1, flower = 1, potable = 1}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -2,3 +2,4 @@ local modpath = minetest.get_modpath("fl_plantlife")
|
||||
|
||||
dofile(modpath .. "/grass.lua")
|
||||
dofile(modpath .. "/flowers.lua")
|
||||
dofile(modpath .. "/flowerpot.lua")
|
74
mods/fl_plantlife/models/farlands_flowerpot.obj
Normal file
74
mods/fl_plantlife/models/farlands_flowerpot.obj
Normal file
@ -0,0 +1,74 @@
|
||||
# Blender v2.72 (sub 0) OBJ File: 'flowerpot.blend'
|
||||
# www.blender.org
|
||||
mtllib flowerpot.mtl
|
||||
o Cube_Cube.001
|
||||
v -0.376261 -1.015969 0.376261
|
||||
v -0.376261 -0.263447 0.376261
|
||||
v -0.376261 -1.015969 -0.376261
|
||||
v -0.376261 -0.263447 -0.376261
|
||||
v 0.376261 -1.015969 0.376261
|
||||
v 0.376261 -0.263447 0.376261
|
||||
v 0.376261 -1.015969 -0.376261
|
||||
v 0.376261 -0.263447 -0.376261
|
||||
v -0.250727 -0.559166 0.250727
|
||||
v -0.250727 -0.263549 0.250727
|
||||
v -0.250727 -0.559166 -0.250727
|
||||
v -0.250727 -0.263549 -0.250727
|
||||
v 0.250727 -0.559166 0.250727
|
||||
v 0.250727 -0.263549 0.250727
|
||||
v 0.250727 -0.559166 -0.250727
|
||||
v 0.250727 -0.263549 -0.250727
|
||||
v 0.678334 1.490754 0.678334
|
||||
v 0.678334 -0.569152 0.678334
|
||||
v -0.678334 1.490754 -0.678334
|
||||
v -0.678334 -0.569152 -0.678334
|
||||
v -0.678334 1.490754 0.678334
|
||||
v -0.678334 -0.569152 0.678334
|
||||
v 0.678334 1.490754 -0.678334
|
||||
v 0.678334 -0.569152 -0.678334
|
||||
vt 0.562500 0.187500
|
||||
vt 0.562500 0.375000
|
||||
vt 0.375000 0.375000
|
||||
vt 0.375000 0.187500
|
||||
vt 0.187500 0.375000
|
||||
vt 0.187500 0.187500
|
||||
vt 0.000000 0.375000
|
||||
vt 0.000000 0.187500
|
||||
vt 0.750000 0.187500
|
||||
vt 0.750000 0.375000
|
||||
vt 0.687500 0.000000
|
||||
vt 0.875000 0.000000
|
||||
vt 0.875000 0.187500
|
||||
vt 0.687500 0.187500
|
||||
vt 0.500000 0.000000
|
||||
vt 0.500000 0.187500
|
||||
vt 0.375000 0.000000
|
||||
vt 0.250000 0.000000
|
||||
vt 0.250000 0.062500
|
||||
vt 0.375000 0.062500
|
||||
vt 0.125000 0.000000
|
||||
vt 0.125000 0.062500
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 0.062500
|
||||
vt 0.500000 0.062500
|
||||
vt 0.125000 0.187500
|
||||
vt 0.250000 0.187500
|
||||
vt 0.000000 1.000000
|
||||
vt 0.500000 1.000000
|
||||
vt 0.500000 0.500000
|
||||
vt 0.000000 0.500000
|
||||
usemtl None
|
||||
s off
|
||||
f 1/1 2/2 4/3 3/4
|
||||
f 3/4 4/3 8/5 7/6
|
||||
f 7/6 8/5 6/7 5/8
|
||||
f 5/9 6/10 2/2 1/1
|
||||
f 3/11 7/12 5/13 1/14
|
||||
f 8/15 4/11 2/14 6/16
|
||||
f 9/17 11/18 12/19 10/20
|
||||
f 11/18 15/21 16/22 12/19
|
||||
f 15/21 13/23 14/24 16/22
|
||||
f 13/15 9/17 10/20 14/25
|
||||
f 11/22 9/26 13/27 15/19
|
||||
f 17/28 19/29 20/30 18/31
|
||||
f 21/28 23/29 24/30 22/31
|
26
mods/fl_plantlife/models/farlands_plant2.obj
Normal file
26
mods/fl_plantlife/models/farlands_plant2.obj
Normal file
@ -0,0 +1,26 @@
|
||||
# Blender v2.83.1 OBJ File: 'farlands_chain.blend'
|
||||
# www.blender.org
|
||||
o Plane
|
||||
v -0.247487 0.500000 0.247487
|
||||
v -0.247487 -0.500000 0.247487
|
||||
v 0.247487 0.500000 -0.247487
|
||||
v 0.247487 -0.500000 -0.247487
|
||||
vt 0.937500 -0.000000
|
||||
vt 0.937500 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vt 0.062500 0.000000
|
||||
vn 0.7071 -0.0000 0.7071
|
||||
s off
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||
o plane2_Plane.001
|
||||
v -0.247487 0.500000 -0.247487
|
||||
v -0.247487 -0.500000 -0.247487
|
||||
v 0.247487 0.500000 0.247487
|
||||
v 0.247487 -0.500000 0.247487
|
||||
vt 0.937500 -0.000000
|
||||
vt 0.937500 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vt 0.062500 -0.000000
|
||||
vn -0.7071 0.0000 0.7071
|
||||
s off
|
||||
f 5/5/2 6/6/2 8/7/2 7/8/2
|
26
mods/fl_plantlife/models/farlands_plant3.obj
Normal file
26
mods/fl_plantlife/models/farlands_plant3.obj
Normal file
@ -0,0 +1,26 @@
|
||||
# Blender v2.83.1 OBJ File: 'farlands_chain.blend'
|
||||
# www.blender.org
|
||||
o Plane
|
||||
v -0.318198 0.500000 0.318198
|
||||
v -0.318198 -0.500000 0.318198
|
||||
v 0.318198 0.500000 -0.318198
|
||||
v 0.318198 -0.500000 -0.318198
|
||||
vt 0.937500 -0.000000
|
||||
vt 0.937500 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vt 0.062500 0.000000
|
||||
vn 0.7071 -0.0000 0.7071
|
||||
s off
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||
o plane2_Plane.001
|
||||
v -0.318198 0.500000 -0.318198
|
||||
v -0.318198 -0.500000 -0.318198
|
||||
v 0.318198 0.500000 0.318198
|
||||
v 0.318198 -0.500000 0.318198
|
||||
vt 0.937500 -0.000000
|
||||
vt 0.937500 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vt 0.062500 -0.000000
|
||||
vn -0.7071 0.0000 0.7071
|
||||
s off
|
||||
f 5/5/2 6/6/2 8/7/2 7/8/2
|
BIN
mods/fl_plantlife/textures/farlands_pot.png
Normal file
BIN
mods/fl_plantlife/textures/farlands_pot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 828 B |
Loading…
x
Reference in New Issue
Block a user