whitespace and consistency fixes
parent
f5f9058863
commit
5840098c6c
33
init.lua
33
init.lua
|
@ -86,8 +86,6 @@ paintedcanvas = {
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local data = itemstack:get_metadata()
|
|
||||||
|
|
||||||
--place node
|
--place node
|
||||||
local placerpos = placer:getpos()
|
local placerpos = placer:getpos()
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
|
@ -98,19 +96,20 @@ paintedcanvas = {
|
||||||
param2 = fd,
|
param2 = fd,
|
||||||
paramtype2 = 'none' })
|
paramtype2 = 'none' })
|
||||||
|
|
||||||
|
--save metadata
|
||||||
|
local data = itemstack:get_metadata()
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
meta:set_string("painting:picturedata", data)
|
meta:set_string("painting:picturedata", data)
|
||||||
|
|
||||||
--and entity
|
--add entity
|
||||||
local dir = dirs.z[fd]
|
dir = dirs.z[fd]
|
||||||
local off = 0.5-thickness-0.01
|
local off = 0.5-thickness-0.01
|
||||||
|
|
||||||
local np = {
|
local np = { x = pos.x + dir.x*off,
|
||||||
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(itemstack:get_metadata())
|
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(np, "painting:picent"):get_luaentity()
|
||||||
|
@ -352,12 +351,12 @@ end
|
||||||
|
|
||||||
dirs = {
|
dirs = {
|
||||||
x = {
|
x = {
|
||||||
[0] = {x=1, z=0}, --x
|
[0] = {x = 1, z = 0},
|
||||||
[1] = {x=0, z=-1},
|
[1] = {x = 0, z =-1},
|
||||||
[2] = {x=-1, z=0},
|
[2] = {x =-1, z = 0},
|
||||||
[3] = {x=0, z=1}},
|
[3] = {x = 0, z = 1}},
|
||||||
z = {
|
z = {
|
||||||
[0] = {x=0, z=1}, --z
|
[0] = {x = 0, z = 1},
|
||||||
[1] = {x=1, z=0},
|
[1] = {x = 1, z = 0},
|
||||||
[2] = {x=0, z=-1},
|
[2] = {x = 0, z =-1},
|
||||||
[3] = {x=-1, z=0}}}
|
[3] = {x =-1, z = 0}}}
|
||||||
|
|
Loading…
Reference in New Issue