cleanup paintedcanvas on_place
parent
1cc3d63b2e
commit
5022d30da0
22
init.lua
22
init.lua
|
@ -128,10 +128,10 @@ paintedcanvas = {
|
||||||
local dir = sub(pos, placerpos)
|
local dir = sub(pos, placerpos)
|
||||||
local fd = minetest.dir_to_facedir(dir)
|
local fd = minetest.dir_to_facedir(dir)
|
||||||
|
|
||||||
local pic = minetest.env:add_node(pos, { name = "painting:pic",
|
minetest.env:add_node(pos, { name = "painting:pic",
|
||||||
param2 = fd,
|
param2 = fd,
|
||||||
paramtype2 = "none" })
|
paramtype2 = "none" })
|
||||||
|
|
||||||
--save metadata
|
--save metadata
|
||||||
local data = itemstack:get_metadata()
|
local data = itemstack:get_metadata()
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
@ -139,18 +139,18 @@ paintedcanvas = {
|
||||||
|
|
||||||
--add entity
|
--add entity
|
||||||
dir = dirs[fd]
|
dir = dirs[fd]
|
||||||
local off = 0.5-thickness-0.01
|
local off = 0.5 - thickness - 0.01
|
||||||
|
|
||||||
local np = { x = pos.x + dir.x*off,
|
pos = { x = pos.x + dir.x * off,
|
||||||
y = pos.y,
|
y = pos.y,
|
||||||
z = pos.z + dir.z*off}
|
z = pos.z + dir.z * off}
|
||||||
|
|
||||||
data = minetest.deserialize(data)
|
data = minetest.deserialize(data)
|
||||||
data = to_imagestring(data)
|
data = to_imagestring(data)
|
||||||
|
|
||||||
local p = minetest.env:add_entity(np, "painting:picent"):get_luaentity()
|
local p = minetest.env:add_entity(pos, "painting:picent"):get_luaentity()
|
||||||
p.object:set_properties({textures = { data }})
|
p.object:set_properties({ textures = { data }})
|
||||||
p.object:setyaw(math.pi*fd/-2)
|
p.object:setyaw(math.pi * fd / -2)
|
||||||
|
|
||||||
return ItemStack("")
|
return ItemStack("")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue