forked from MineClone5/MineClone5
Remove the old horribly broken flower pot
This commit is contained in:
parent
c4330c73f6
commit
65fea54e1e
|
@ -1,81 +0,0 @@
|
|||
minetest.register_entity("mcl_flowers:item",{
|
||||
hp_max = 1,
|
||||
visual="wielditem",
|
||||
visual_size={x=.25,y=.25},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
groups = {snappy=3,attached_node=1},
|
||||
stack_max = 1,
|
||||
physical=false,
|
||||
textures={"air"},
|
||||
on_activate = function(self, staticdata)
|
||||
if flower_tmp.nodename ~= nil and flower_tmp.texture ~= nil then
|
||||
self.nodename = flower_tmp.nodename
|
||||
flower_tmp.nodename = nil
|
||||
self.texture = flower_tmp.texture
|
||||
flower_tmp.texture = nil
|
||||
else
|
||||
if staticdata ~= nil and staticdata ~= "" then
|
||||
local data = staticdata:split(';')
|
||||
if data and data[1] and data[2] then
|
||||
self.nodename = data[1]
|
||||
self.texture = data[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.texture ~= nil then
|
||||
self.object:set_properties({textures={self.texture}})
|
||||
end
|
||||
end,
|
||||
get_staticdata = function(self)
|
||||
if self.nodename ~= nil and self.texture ~= nil then
|
||||
return self.nodename .. ';' .. self.texture
|
||||
end
|
||||
return ""
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
local facedir = {}
|
||||
facedir[0] = {x=0,y=0,z=1}
|
||||
facedir[1] = {x=1,y=0,z=0}
|
||||
facedir[2] = {x=0,y=0,z=-1}
|
||||
facedir[3] = {x=-1,y=0,z=0}
|
||||
|
||||
local flower_pot_remove_item = function(pos, node)
|
||||
local objs = nil
|
||||
if node and node.name == "mcl_flowers:pot" then
|
||||
objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, .5)
|
||||
end
|
||||
if objs then
|
||||
for _, obj in ipairs(objs) do
|
||||
if obj and obj:get_luaentity() and obj:get_luaentity().name == "mcl_flowers:item" then
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
flower_pot_update_item = function(pos, node)
|
||||
flower_pot_remove_item(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta and meta:get_string("item") ~= "" then
|
||||
if node.name == "mcl_flowers:pot" then
|
||||
pos.y = pos.y
|
||||
end
|
||||
flower_tmp.nodename = node.name
|
||||
flower_tmp.texture = ItemStack(meta:get_string("item")):get_name()
|
||||
local e = minetest.add_entity(pos,"mcl_flowers:item")
|
||||
end
|
||||
end
|
||||
|
||||
flower_pot_drop_item = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_string("item") ~= "" then
|
||||
if node.name == "mcl_flowers:pot" then
|
||||
minetest.add_item({x=pos.x,y=pos.y+1,z=pos.z}, meta:get_string("item"))
|
||||
end
|
||||
meta:set_string("item","")
|
||||
end
|
||||
flower_pot_remove_item(pos, node)
|
||||
end
|
|
@ -6,7 +6,6 @@ flower_tmp={}
|
|||
|
||||
-- Map Generation
|
||||
dofile(minetest.get_modpath("mcl_flowers").."/mapgen.lua")
|
||||
dofile(minetest.get_modpath("mcl_flowers").."/func.lua")
|
||||
|
||||
|
||||
|
||||
|
@ -276,69 +275,6 @@ function register_large(name, desc, inv_img, bot_img, colr) --change in function
|
|||
end
|
||||
|
||||
|
||||
--
|
||||
-- Flower Pot
|
||||
--
|
||||
|
||||
minetest.register_node("mcl_flowers:pot",{
|
||||
description = "Flower Pot",
|
||||
drawtype = "nodebox",
|
||||
is_ground_content = false,
|
||||
node_box = { type = "fixed", fixed = {
|
||||
{-0.125,-0.125,-0.187500,-0.187500,-0.500,0.1875}, --Wall 1
|
||||
{0.1875,-0.125,-0.125,0.125,-0.500,0.1875}, --Wall 2
|
||||
{-0.1875,-0.125,-0.125,0.1875,-0.500,-0.1875}, --Wall 3
|
||||
{0.1875,-0.125,0.125,-0.1875,-0.500,0.1875}, --Wall 4
|
||||
{-0.125,-0.500,-0.125,0.125,-0.250,0.125}, --Dirt 5
|
||||
}},
|
||||
selection_box = { type = "fixed", fixed = {-0.125,-0.5,-0.125,0.125,-0.25,0.125 }},
|
||||
tiles = {"flowers_pot_top.png", "flowers_pot_bottom.png", "flowers_pot_top.png"},
|
||||
inventory_image="flowers_pot_inventory.png",
|
||||
paramtype = "light",
|
||||
groups = {dig_immediate=3,deco_block=1},
|
||||
stack_max = 64,
|
||||
sounds = mcl_core.node_sound_defaults(),
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner",placer:get_player_name())
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if not itemstack then return end
|
||||
local meta = minetest.get_meta(pos)
|
||||
if clicker:get_player_name() == meta:get_string("owner") then
|
||||
flower_pot_drop_item(pos,node)
|
||||
local s = itemstack:take_item()
|
||||
meta:set_string("item",s:to_string())
|
||||
flower_pot_update_item(pos,node)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
on_punch = function(pos,node,puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if puncher:get_player_name() == meta:get_string("owner") then
|
||||
flower_pot_drop_item(pos,node)
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return player:get_player_name() == meta:get_string("owner")
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
flower_pot_drop_item(pos,node)
|
||||
minetest.add_node(pos, {name="air"})
|
||||
minetest.add_item(pos, "mcl_flowers:pot")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_flowers:pot",
|
||||
recipe = {
|
||||
{ "mcl_core:brick", "", "mcl_core:brick", },
|
||||
{ "", "mcl_core:brick", "" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Lily Pad
|
||||
minetest.register_node("mcl_flowers:waterlily", {
|
||||
description = "Lily Pad",
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 311 B |
Binary file not shown.
Before Width: | Height: | Size: 460 B |
Loading…
Reference in New Issue