mirror of
https://github.com/minetest-mods/realchess.git
synced 2024-11-20 06:23:48 +01:00
Promote the pawns even after killing a piece at the end of board
This commit is contained in:
parent
e818da646a
commit
f0db2264c0
8
init.lua
8
init.lua
@ -149,6 +149,8 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, count, pl
|
||||
elseif from_x - 1 == to_x or from_x + 1 == to_x then
|
||||
if not pieceTo:find("black") then
|
||||
return 0
|
||||
elseif to_index >= 1 and to_index <= 8 then
|
||||
inv:set_stack(from_list, from_index, "realchess:queen_white")
|
||||
end
|
||||
else
|
||||
return 0
|
||||
@ -172,6 +174,8 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, count, pl
|
||||
elseif from_x - 1 == to_x or from_x + 1 == to_x then
|
||||
if not pieceTo:find("white") then
|
||||
return 0
|
||||
elseif to_index >= 57 and to_index <= 64 then
|
||||
inv:set_stack(from_list, from_index, "realchess:queen_black")
|
||||
end
|
||||
else
|
||||
return 0
|
||||
@ -546,7 +550,7 @@ function realchess.fields(pos, formname, fields, sender)
|
||||
meta:get_string("playerBlack") == playerName) then
|
||||
realchess.init(pos)
|
||||
elseif fields.new and meta:get_int("lastMoveTime") ~= 0 and
|
||||
minetest.get_gametime() >= meta:get_int("lastMoveTime") + 250 and
|
||||
minetest.get_gametime() >= meta:get_int("lastMoveTime") + 300 and
|
||||
(meta:get_string("playerWhite") ~= playerName or
|
||||
meta:get_string("playerBlack") ~= playerName) then
|
||||
realchess.init(pos)
|
||||
@ -561,7 +565,7 @@ function realchess.dig(pos, player)
|
||||
|
||||
-- the chess can't be dug during a started game unless if nobody has played during a while (~5 min. by default)
|
||||
if meta:get_int("lastMoveTime") ~= 0 and
|
||||
minetest.get_gametime() <= meta:get_int("lastMoveTime") + 250 then
|
||||
minetest.get_gametime() <= meta:get_int("lastMoveTime") + 300 then
|
||||
minetest.chat_send_player(playerName, "You can't dig the chessboard, a game has been started.\nReset it first if you're a current player, or try digging again after a while.")
|
||||
return false
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user