Clarify some messages

This commit is contained in:
kilbith 2015-10-26 17:40:25 +01:00
parent 1b186457db
commit 55a7fdc745

@ -70,7 +70,7 @@ function realchess.init(pos)
"realchess:king_white",
"realchess:bishop_white_2",
"realchess:knight_white_2",
"realchess:rook_white_2",
"realchess:rook_white_2"
})
end
@ -97,7 +97,7 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, count, pl
if pieceFrom:find("white") then
if playerWhite ~= "" and playerWhite ~= playerName then
minetest.chat_send_player(playerName, "Someone else plays white pieces !")
minetest.chat_send_player(playerName, "Someone else plays white pieces!")
return 0
end
if lastMove ~= "" and lastMove ~= "black" then
@ -112,7 +112,7 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, count, pl
thisMove = "white"
elseif pieceFrom:find("black") then
if playerBlack ~= "" and playerBlack ~= playerName then
minetest.chat_send_player(playerName, "Someone else plays black pieces !")
minetest.chat_send_player(playerName, "Someone else plays black pieces!")
return 0
end
if lastMove ~= "" and lastMove ~= "white" then
@ -268,7 +268,6 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, count, pl
if dx ~= 1 or dy ~= 2 then
return 0
end
-- just ensure that destination cell does not contain friend piece
-- ^ it was done already thus everything ok
@ -440,14 +439,14 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, count, pl
meta:set_string("lastMoveTime", minetest.get_gametime())
if meta:get_string("lastMove") == "black" then
minetest.chat_send_player(playerWhite, playerName .. " has moved a " .. pieceFrom:match("%a+:(%a+)") .. ", it's now your turn.")
minetest.chat_send_player(playerWhite, playerName.." has moved a "..pieceFrom:match("%a+:(%a+)")..", it's now your turn.")
elseif meta:get_string("lastMove") == "white" then
minetest.chat_send_player(playerBlack, playerName .. " has moved a " .. pieceFrom:match("%a+:(%a+)") .. ", it's now your turn.")
minetest.chat_send_player(playerBlack, playerName.." has moved a "..pieceFrom:match("%a+:(%a+)")..", it's now your turn.")
end
if pieceTo:find("king") then
minetest.chat_send_player(playerBlack, playerName .. " won the game.")
minetest.chat_send_player(playerWhite, playerName .. " won the game.")
minetest.chat_send_player(playerBlack, playerName.." won the game.")
minetest.chat_send_player(playerWhite, playerName.." won the game.")
meta:set_string("winner", thisMove)
end
@ -460,17 +459,17 @@ function realchess.fields(pos, formname, fields, sender)
if fields.quit then return end
-- The chess can't be reset while playing unless if nobody has played during a while
-- the chess can't be reset during a started game unless if nobody has played during a while
if fields.new and (meta:get_string("playerWhite") == playerName or
meta:get_string("playerBlack") == playerName) then
realchess.init(pos)
elseif fields.new and meta:get_string("lastMoveTime") ~= "" and
minetest.get_gametime() >= tonumber(meta:get_string("lastMoveTime") + 200) and
minetest.get_gametime() >= tonumber(meta:get_string("lastMoveTime")+200) and
(meta:get_string("playerWhite") ~= playerName or
meta:get_string("playerBlack") ~= playerName) then
realchess.init(pos)
else
minetest.chat_send_player(playerName, "You can't reset the chessboard, a game has been started.\nIf you weren't playing it, try again after a while.")
minetest.chat_send_player(playerName, "You can't reset the chessboard, a game has been started.\nIf you are not a current player, try again after a while.")
end
end
@ -478,11 +477,10 @@ function realchess.dig(pos, player)
local meta = minetest.get_meta(pos)
local playerName = player:get_player_name()
-- The chess can't be dug while playing unless if nobody has played during a while
if (meta:get_string("playerWhite") ~= "" or meta:get_string("playerBlack") ~= "") and
meta:get_string("lastMoveTime") ~= "" and
minetest.get_gametime() <= tonumber(meta:get_string("lastMoveTime") + 200) then
minetest.chat_send_player(playerName, "You can't dug the chessboard, a game has been started.\nIf you weren't playing it, try again after a while.")
-- the chess can't be dug during a started game unless if nobody has played during a while
if meta:get_string("lastMoveTime") ~= "" and
minetest.get_gametime() <= tonumber(meta:get_string("lastMoveTime")+200) 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
@ -528,7 +526,7 @@ local function register_piece(name, count)
description = color:gsub("^%l", string.upper).." "..name:gsub("^%l", string.upper),
inventory_image = name.."_"..color..".png",
stack_max = 1,
groups = {not_in_creative_inventory=1},
groups = {not_in_creative_inventory=1}
})
else
for i = 1, count do
@ -536,7 +534,7 @@ local function register_piece(name, count)
description = color:gsub("^%l", string.upper).." "..name:gsub("^%l", string.upper),
inventory_image = name.."_"..color..".png",
stack_max = 1,
groups = {not_in_creative_inventory=1},
groups = {not_in_creative_inventory=1}
})
end
end