changes in texturing

master
tony-ka 10 years ago
commit 237bb03c9e
  1. 59
      init.lua
  2. 30
      pieces.lua

@ -31,8 +31,15 @@ minetest.register_node("chess:spawn",{
if n.name == "chess:board_black" then
for i = size, 1, -1 do
for ii = size, 1, -1 do
--remove board
local p = {x=pos.x+i, y=pos.y, z=pos.z+ii}
minetest.env:remove_node(p)
--remove pieces ontop
local p = {x=pos.x+i, y=pos.y+1, z=pos.z+ii}
minetest.env:remove_node(p)
end
end
end
@ -42,12 +49,22 @@ minetest.register_node("chess:spawn",{
--reset the pieces
end,
after_place_node = function(pos)
after_place_node = function(pos, placer)
--spawn box ownership
local player = placer:get_player_name()
print(player)
local placed = minetest.env:get_node(pos)
local placed_meta = minetest.env:get_meta(placed)
placed_meta:set_string("owner", player)
--chessboard placement that is coded really ugly. I hate it!!! and i will fix it!!! I MUST!
local size = 10
local isFree = true
--check if there is room for a chessboard with pieces ontop
for i = size, 1, -1 do
for i = size, 1, -1 do --check if there is room for a chessboard with pieces ontop
for ii = size, 1, -1 do
local p = {x=pos.x+i, y=pos.y, z=pos.z+ii}
@ -66,13 +83,43 @@ minetest.register_node("chess:spawn",{
local alternate = true
if isFree then -- if there is room for a chessboard make the chessboard with pieces
if isFree then -- if there is room for a chessboard and pieces, make the chessboard with pieces
minetest.chat_send_all("Chess board has been placed, let the match begin!")
for i = size, 1, -1 do
for ii = size, 1, -1 do
--place pieces
local p = {x=pos.x+i, y=pos.y, z=pos.z+ii}
local p_top = {x=pos.x+i, y=pos.y+1, z=pos.z+ii}
if (i > 1 and i < size) then
--black pieces
if (ii == 3) then --pawns
minetest.env:add_node(p_top, {name="chess:pawn_black"})
end
if (ii == 2) then --behind pawns
if (i == 2 or i == 9) then minetest.env:add_node(p_top, {name="chess:rook_black"}) end
if (i == 3 or i == 8) then minetest.env:add_node(p_top, {name="chess:knight_black"}) end
if (i == 4 or i == 7) then minetest.env:add_node(p_top, {name="chess:bishop_black"}) end
if (i == 6) then minetest.env:add_node(p_top, {name="chess:queen_black"}) end
if (i == 5) then minetest.env:add_node(p_top, {name="chess:king_black"}) end
end
--white pieces
if (ii == 8) then --pawns
minetest.env:add_node(p_top, {name="chess:pawn_white"})
end
if (ii == 9) then --behind pawns
if (i == 2 or i == 9) then minetest.env:add_node(p_top, {name="chess:rook_white"}) end
if (i == 3 or i == 8) then minetest.env:add_node(p_top, {name="chess:knight_white"}) end
if (i == 4 or i == 7) then minetest.env:add_node(p_top, {name="chess:bishop_white"}) end
if (i == 5) then minetest.env:add_node(p_top, {name="chess:queen_white"}) end
if (i == 6) then minetest.env:add_node(p_top, {name="chess:king_white"}) end
end
end
if (ii == 1) or (ii == size) or (i ==1) or (i == size) then--create border
minetest.env:add_node(p, {name="chess:board_black"})
else

@ -21,9 +21,7 @@ for color = 1, 2 do
{
description = 'Pawn',
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png",
"chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png",
"chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
@ -53,9 +51,7 @@ for color = 1, 2 do
{
description = 'Rook',
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png",
"chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png",
"chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
@ -93,10 +89,8 @@ for color = 1, 2 do
minetest.register_node("chess:knight_"..colors[color],
{
description = 'Knight',
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png",
"chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png",
"chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
@ -130,9 +124,7 @@ for color = 1, 2 do
{
description = 'Bishop',
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png",
"chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png",
"chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
@ -164,10 +156,8 @@ for color = 1, 2 do
minetest.register_node("chess:queen_"..colors[color],
{
description = 'Queen',
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png",
"chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png",
"chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
@ -205,10 +195,8 @@ for color = 1, 2 do
minetest.register_node("chess:king_"..colors[color],
{
description = 'King',
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png",
"chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png",
"chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
groups = {snappy = 2},
tiles = {"chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color].."_top.png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color]..".png", "chess_piece_"..colors[color].."_side.png", "chess_piece_"..colors[color].."_side.png"},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',

Loading…
Cancel
Save