Remove chessboard on node dig and added the punch node function to chess box. Still have to program the replace the pieces. I'll wait till i have the pieces before i do that
parent
5df3b47fca
commit
543cd1abc0
38
init.lua
38
init.lua
|
@ -21,22 +21,46 @@ minetest.register_node(":chess:spawn",{
|
|||
tile_images = {"chess_spawn.png"},
|
||||
inventory_image = "chess_spawn.png",
|
||||
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
after_dig_node = function(pos, node, digger)
|
||||
|
||||
local size = 10
|
||||
|
||||
for i = size, 1, -1 do
|
||||
for ii = size, 1, -1 do
|
||||
local p = {x=pos.x+i, y=pos.y, z=pos.z+ii}
|
||||
minetest.env:remove_node(p)
|
||||
end
|
||||
end
|
||||
|
||||
end,
|
||||
on_punch = function(pos)
|
||||
|
||||
--reset the pieces
|
||||
|
||||
end,
|
||||
after_place_node = function(pos)
|
||||
|
||||
local size = 8
|
||||
local size = 10
|
||||
local alternate = true
|
||||
|
||||
for i = size, 1, -1 do
|
||||
for ii = size, 1, -1 do
|
||||
|
||||
local p = {x=pos.x+i+1, y=pos.y, z=pos.z+ii+1}
|
||||
|
||||
if alternate then
|
||||
|
||||
local p = {x=pos.x+i, y=pos.y, z=pos.z+ii}
|
||||
if (ii == 1) or (ii == 10) or (i ==1) or (i == 10) then--create border
|
||||
minetest.env:add_node(p, {name="chess:board_black"})
|
||||
alternate = false
|
||||
else
|
||||
minetest.env:add_node(p, {name="chess:board_white"})
|
||||
alternate = true
|
||||
|
||||
|
||||
if alternate then
|
||||
minetest.env:add_node(p, {name="chess:board_black"})
|
||||
alternate = false
|
||||
else
|
||||
minetest.env:add_node(p, {name="chess:board_white"})
|
||||
alternate = true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
28
pieces.lua
28
pieces.lua
|
@ -19,8 +19,8 @@ for color = 1, 2 do
|
|||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
|
||||
{-0.3, -0.5, -0.2, 0.2, -0.4, 0.3},
|
||||
{-0.3, -0.5, -0.3, 0.2, -0.4, 0.3},
|
||||
{-0.3, -0.5, -0.3, 0.2, -0.4, 0.3},
|
||||
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
|
||||
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
|
||||
{-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
|
||||
|
@ -40,6 +40,30 @@ for color = 1, 2 do
|
|||
--Knight
|
||||
|
||||
--Bishop
|
||||
|
||||
minetest.register_node(":chess:bishop_"..colors[color],
|
||||
{
|
||||
description = 'bishop',
|
||||
groups = {snappy = 2},
|
||||
tiles = {"chess_piece_"..colors[color]..".png"},
|
||||
drawtype = "nodebox",
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
paramtype2 = "facedir",
|
||||
light_source = 8, --max light is 18
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.8, -0.3, 0.2, -0.4, 0.3},
|
||||
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.2, 0.3},
|
||||
},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
|
||||
})
|
||||
|
||||
--Queen
|
||||
|
||||
|
|
Loading…
Reference in New Issue