This commit is contained in:
4aiman 2013-03-01 08:15:51 +04:00
parent 1b1fd7dc16
commit 92f79c5718
10 changed files with 64 additions and 61 deletions

125
init.lua
View File

@ -1,7 +1,7 @@
radar = {
description = "map block",
inventory_image = ("radar_block.png"),
tiles = {"radar_block.png"},
inventory_image = ("map_block.png"),
tiles = {"map_block.png"},
drawtype="normal",
is_ground_content = true,
groups = {crumbly=3},
@ -9,72 +9,75 @@ radar = {
pointable=true,
diggable=true,
on_punch = function(pos, node, puncher)
local map = ""
local p = 0
for i = -16,16,1 do
for j = -16,16,1 do
local po = {x = pos.x+i, y = pos.y, z = pos.z+j}
local no = minetest.env:get_node(po)
local k=po.y
if no.name == "air" then
while no.name == "air" do
k=k-1
po = {x = pos.x+i, y = k, z = pos.z+j}
no = minetest.env:get_node(po)
end
else
local no = minetest.env:get_node_or_nil(po)
while (no.name ~= "air") and (no ~= nil) do
k=k+1
po = {x = pos.x+i, y = k, z = pos.z+j}
no = minetest.env:get_node(po)
minetest.debug("x = "..po.x..", y = ".. k .. ", z = ".. po.z)
end
local mapar = {}
local map = ""
local p = 0
local po = {x = 0, y = 0, z = 0}
local no = minetest.env:get_node(po)
local node = ""
local tile = ""
local def = {}
local tiles = {}
local point = ""
end
local node = minetest.env:get_node(po)
local tile = ""
local def = minetest.registered_nodes[node.name]
local tiles = def["tiles"]
if tiles ~=nil then
local tile = tiles[1]
for i = -17,17,1 do
mapar[i+17] = {}
for j = -17,17,1 do
mapar[i+17][j+17] = {}
po = {x = pos.x+i, y = pos.y, z = pos.z+j}
no = minetest.env:get_node(po)
local k=po.y
if no.name == "air" then
while no.name == "air" do
k=k-1
po = {x = pos.x+i, y = k, z = pos.z+j}
no = minetest.env:get_node(po)
end
elseif no.name ~= "air" and (no.name ~= "ignore") then
while (no.name ~= "air") and (no.name ~= "ignore") do
k=k+1
po = {x = pos.x+i, y = k, z = pos.z+j}
no = minetest.env:get_node(po)
end
k=k-1
po = {x = pos.x+i, y = k, z = pos.z+j}
end
node = minetest.env:get_node(po)
tile = ""
def = minetest.registered_nodes[node.name]
tiles = def["tiles"]
if tiles ~=nil then
tile = tiles[1]
end
if type(tile)=="table" then tile=tile["name"] end
local point = "image[".. 0.15*(i+16) ..",".. 0.15*(j+16) ..";0.2,0.2;" ..tile.."]"
ppp1 = {x=po.x+1,y=po.y,z=po.z}
ppp2 = {x=po.x-1,y=po.y,z=po.z}
ppp3 = {x=po.x,y=po.y+1,z=po.z}
ppp4 = {x=po.x,y=po.y-1,z=po.z}
ppp5 = {x=po.x,y=po.y,z=po.z+1}
ppp6 = {x=po.x,y=po.y,z=po.z-1}
<<<<<<< HEAD
if (minetest.env:get_node(ppp1).name=='air')
or (minetest.env:get_node(ppp2).name=='air')
or (minetest.env:get_node(ppp3).name=='air')
or (minetest.env:get_node(ppp4).name=='air')
or (minetest.env:get_node(ppp5).name=='air')
or (minetest.env:get_node(ppp6).name=='air')
then
map = map .. point
end
minetest.debug("x = "..po.x..", y = ".. k .. ", z = ".. po.z)
=======
>>>>>>> 4e602c6... vyfs
end
end
if type(tile)=="table" then
tile=tile["name"]
end
mapar[i+17][j+17].y = k
mapar[i+17][j+17].im = tile
end
end
for i=1,32,1 do
for j=1,32,1 do
if mapar[i][j].y ~= mapar[i][j+1].y then mapar[i][j].im = mapar[i][j].im .. "^1black_blockt.png" end
if mapar[i][j].y ~= mapar[i][j-1].y then mapar[i][j].im = mapar[i][j].im .. "^1black_blockb.png" end
if mapar[i][j].y ~= mapar[i-1][j].y then mapar[i][j].im = mapar[i][j].im .. "^1black_blockl.png" end
if mapar[i][j].y ~= mapar[i+1][j].y then mapar[i][j].im = mapar[i][j].im .. "^1black_blockr.png" end
point = "image[".. 0.15*(i)-16*0.15 ..",".. 0.15*(32-j)-16*0.15 ..";0.2,0.2;" .. mapar[i][j].im .. "]"
map = map .. point
end
end
local meta= minetest.env:get_meta(pos)
local signal=""
signal=map
meta:set_string("formspec","size[5.1,4.9]"..
meta:set_string("formspec","size[0.1,0.1]"..
signal)
end,
end,
}
minetest.register_node("mapp:map_block", radar)

BIN
textures/1black_blockb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

BIN
textures/1black_blockl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

BIN
textures/1black_blockr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

BIN
textures/1black_blockt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

BIN
textures/black_block.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

BIN
textures/black_blockb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

BIN
textures/black_blockl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

BIN
textures/black_blockr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

BIN
textures/black_blockt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B