Merged and added placement avoidence when not enough area to place board. Also displays message

master
Bas 2012-08-23 23:34:50 +02:00
commit d7894e59f7
2 changed files with 84 additions and 75 deletions

View File

@ -16,7 +16,7 @@ dofile(minetest.get_modpath("chess").."/pieces.lua")
dofile(minetest.get_modpath("chess").."/rules.lua")
-- Register the spawn block
minetest.register_node(":chess:spawn",{
minetest.register_node("chess:spawn",{
description = "Chess Board",
tile_images = {"chess_spawn.png"},
inventory_image = "chess_spawn.png",
@ -111,7 +111,7 @@ minetest.register_craft({
})
--Register the Board Blocks: white
minetest.register_node(":chess:board_white",{
minetest.register_node("chess:board_white",{
description = "White Chess Board Piece",
tile_images = {"chess_board_white.png"},
inventory_image = "chess_white.png",
@ -119,7 +119,7 @@ minetest.register_node(":chess:board_white",{
})
--Register the Board Blocks: black
minetest.register_node(":chess:board_black",{
minetest.register_node("chess:board_black",{
description = "Black Chess Board Piece",
tile_images = {"chess_board_black.png"},
inventory_image = "chess_black.png",

View File

@ -1,72 +1,81 @@
--This file declares all the pieces for the game
local colors = {"black", "white",}
--make a loop which makes the black and white nodes and crafting recipes
for color = 1, 2 do
--Pawn
minetest.register_node(":chess:pawn_"..colors[color],
{
description = 'pawn',
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.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},
{-0.2, -0.1, -0.1, 0.2, 0.1, 0.1},
{-0.1, -0.1, -0.2, 0.1, 0.1, 0.2},
},
},
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}
})
--Rook
--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
--King
end
-- CHESS MOD
-- ======================================
-- chess/pieces.lua
-- ======================================
-- Registers the chess pieces
--
-- Contents:
--
-- [loop] registers pieces
-- ======================================
local colors = {"black", "white",}
--make a loop which makes the black and white nodes and crafting recipes
for color = 1, 2 do
--Pawn
minetest.register_node("chess:pawn_"..colors[color],
{
description = 'pawn',
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.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},
{-0.2, -0.1, -0.1, 0.2, 0.1, 0.1},
{-0.1, -0.1, -0.2, 0.1, 0.1, 0.2},
},
},
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}
})
--Rook
--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
--King
end