Chess: Show arrow to current player
This commit is contained in:
parent
84cbf5bf7b
commit
a5866b2e42
@ -625,15 +625,19 @@ local function update_formspec(meta)
|
|||||||
local m_sel_idx = meta:get_int("move_no") or 1
|
local m_sel_idx = meta:get_int("move_no") or 1
|
||||||
local eaten_img = meta:get_string("eaten_img")
|
local eaten_img = meta:get_string("eaten_img")
|
||||||
local lastMove = meta:get_string("lastMove")
|
local lastMove = meta:get_string("lastMove")
|
||||||
local turnBlack = minetest.colorize("#000001", (lastMove == "white" and playerBlack ~= "") and
|
-- arrow to show whose turn it is
|
||||||
playerBlack .. "..." or playerBlack)
|
local blackArr = (lastMove == "white" and "image[1,0.2;0.7,0.7;chess_turn_black.png]") or ""
|
||||||
local turnWhite = minetest.colorize("#000001", (lastMove == "black" and playerWhite ~= "") and
|
local whiteArr = ((lastMove == "" or lastMove == "black") and "image[1,9.05;0.7,0.7;chess_turn_white.png]") or ""
|
||||||
playerWhite .. "..." or playerWhite)
|
local turnBlack = minetest.colorize("#000001", playerBlack)
|
||||||
|
local turnWhite = minetest.colorize("#000001", playerWhite)
|
||||||
|
-- display the word "check" if the player is in check
|
||||||
local check_s = minetest.colorize("#FF0000", "\\["..FS("check").."\\]")
|
local check_s = minetest.colorize("#FF0000", "\\["..FS("check").."\\]")
|
||||||
|
|
||||||
local formspec = fs ..
|
local formspec = fs ..
|
||||||
"label[1.9,0.3;" .. turnBlack .. (black_king_attacked and " " .. check_s or "") .. "]" ..
|
"label[1.9,0.3;" .. turnBlack .. (black_king_attacked and " " .. check_s or "") .. "]" ..
|
||||||
|
blackArr ..
|
||||||
"label[1.9,9.15;" .. turnWhite .. (white_king_attacked and " " .. check_s or "") .. "]" ..
|
"label[1.9,9.15;" .. turnWhite .. (white_king_attacked and " " .. check_s or "") .. "]" ..
|
||||||
|
whiteArr ..
|
||||||
"table[8.9,1.05;5.07,3.75;moves;" .. moves .. ";"..m_sel_idx.."]" ..
|
"table[8.9,1.05;5.07,3.75;moves;" .. moves .. ";"..m_sel_idx.."]" ..
|
||||||
eaten_img
|
eaten_img
|
||||||
|
|
||||||
@ -701,11 +705,11 @@ local function update_moves_table(meta)
|
|||||||
-- Castling
|
-- Castling
|
||||||
if pieceFrom:sub(11,14) == "king" and ((curPlayerIsWhite and from_y == 7 and to_y == 7) or (not curPlayerIsWhite and from_y == 0 and to_y == 0)) then
|
if pieceFrom:sub(11,14) == "king" and ((curPlayerIsWhite and from_y == 7 and to_y == 7) or (not curPlayerIsWhite and from_y == 0 and to_y == 0)) then
|
||||||
moves_out = moves_out .. MOVES_LIST_SYMBOL_EMPTY .. ","
|
moves_out = moves_out .. MOVES_LIST_SYMBOL_EMPTY .. ","
|
||||||
-- queenside castling / shortside castling
|
-- queenside castling
|
||||||
if to_x == 2 then
|
if to_x == 2 then
|
||||||
-- write "0-0-0"
|
-- write "0-0-0"
|
||||||
moves_out = moves_out .. "0-0-0"
|
moves_out = moves_out .. "0-0-0"
|
||||||
-- kingside castling / shortside castling
|
-- kingside castling
|
||||||
elseif to_x == 6 then
|
elseif to_x == 6 then
|
||||||
-- write "0-0"
|
-- write "0-0"
|
||||||
moves_out = moves_out .. "0-0"
|
moves_out = moves_out .. "0-0"
|
||||||
|
BIN
textures/chess_turn_black.png
Normal file
BIN
textures/chess_turn_black.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 239 B |
BIN
textures/chess_turn_white.png
Normal file
BIN
textures/chess_turn_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 239 B |
Loading…
x
Reference in New Issue
Block a user