added player mark

master
4aiman 2013-03-04 01:25:13 +04:00
parent bc2023a75b
commit a86bb9f82a
13 changed files with 57 additions and 103 deletions

View File

@ -18,6 +18,55 @@ function map_handler (itemstack, user, pointed_thing)
local def = {}
local tiles = {}
local point = ""
local yaw = math.pi/2
local rotate = 0
pos.y = pos.y + 1
yaw = user:get_look_yaw()
if yaw ~= nil then
yaw = math.deg(yaw)
yaw = math.fmod (yaw, 360)
if yaw<0 then yaw = 360 - yaw end
if yaw>360 then yaw = yaw - 360 end
minetest.chat_send_all(yaw)
if yaw<= 5 then yaw = 0 rotate = 90
elseif yaw<= 15 then yaw = 10 rotate = 90
elseif yaw<= 25 then yaw = 20 rotate = 90
elseif yaw<= 35 then yaw = 30 rotate = 90
elseif yaw<= 45 then yaw = 40 rotate = 90
elseif yaw<= 55 then yaw = 50 rotate = 90
elseif yaw<= 65 then yaw = 60 rotate = 90
elseif yaw<= 75 then yaw = 70 rotate = 90
elseif yaw<= 85 then yaw = 80 rotate = 90
elseif yaw<= 95 then yaw = 0 rotate = 180
elseif yaw<=105 then yaw = 10 rotate = 180
elseif yaw<=115 then yaw = 20 rotate = 180
elseif yaw<=125 then yaw = 30 rotate = 180
elseif yaw<=135 then yaw = 40 rotate = 180
elseif yaw<=145 then yaw = 50 rotate = 180
elseif yaw<=155 then yaw = 60 rotate = 180
elseif yaw<=165 then yaw = 70 rotate = 180
elseif yaw<=175 then yaw = 80 rotate = 180
elseif yaw<=185 then yaw = 0 rotate = 270
elseif yaw<=195 then yaw = 10 rotate = 270
elseif yaw<=205 then yaw = 20 rotate = 270
elseif yaw<=215 then yaw = 30 rotate = 270
elseif yaw<=225 then yaw = 40 rotate = 270
elseif yaw<=235 then yaw = 50 rotate = 270
elseif yaw<=245 then yaw = 60 rotate = 270
elseif yaw<=255 then yaw = 70 rotate = 270
elseif yaw<=265 then yaw = 80 rotate = 270
elseif yaw<=275 then yaw = 0 rotate = 0
elseif yaw<=285 then yaw = 10 rotate = 0
elseif yaw<=295 then yaw = 20 rotate = 0
elseif yaw<=305 then yaw = 30 rotate = 0
elseif yaw<=315 then yaw = 40 rotate = 0
elseif yaw<=325 then yaw = 50 rotate = 0
elseif yaw<=335 then yaw = 60 rotate = 0
elseif yaw<=245 then yaw = 70 rotate = 0
elseif yaw<=355 then yaw = 80 rotate = 0
elseif yaw<=365 then yaw = 0 rotate = 90
end
end
for i = -17,17,1 do
mapar[i+17] = {}
@ -68,15 +117,12 @@ function map_handler (itemstack, user, pointed_thing)
map = map .. point
end
end
minetest.show_formspec(player_name, "mapp:map", "size[5.2,5]"..map)
if rotate ~= 0 then
point = "image[".. 0.15*(16)+0.075 ..",".. 0.15*(16)-0.085 ..";0.4,0.4;d" .. yaw .. ".png^[transformFYR".. rotate .."]"
else
point = "image[".. 0.15*(16)+0.075 ..",".. 0.15*(16)-0.085 ..";0.4,0.4;d" .. yaw .. ".png^[transformFY]"
end
map = map .. point
minetest.show_formspec(player_name, "mapp:map", "size[5.2,5]"..map)
end
minetest.register_craft({
output = 'mapp:map_block',
recipe = {
{'', '', ''},
{'', 'default:dirt', ''},
{'default:dirt', 'default:dirt', 'default:dirt'},
}
})

View File

@ -1,92 +0,0 @@
map_block = {
description = "map block",
inventory_image = ("map_block.png"),
tiles = {"map_block.png","map_block_s.png"},
drawtype="normal",
is_ground_content = true,
groups = {crumbly=3},
walkable=true,
pointable=true,
diggable=true,
on_punch = function(pos, node, puncher)
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 = ""
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
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) ..",".. 0.15*(32-j)+0.1 ..";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.2,5]"..
signal)
end,
}
minetest.register_node("mapp:map_block", map_block)
minetest.register_craft({
output = 'mapp:map_block',
recipe = {
{'', '', ''},
{'', 'default:dirt', ''},
{'default:dirt', 'default:dirt', 'default:dirt'},
}
})

BIN
textures/black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

BIN
textures/d0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

BIN
textures/d10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

BIN
textures/d20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

BIN
textures/d30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

BIN
textures/d40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

BIN
textures/d45.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

BIN
textures/d50.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

BIN
textures/d60.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

BIN
textures/d70.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

BIN
textures/d80.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B