Chess: Set name of AI player immediately
This commit is contained in:
parent
a5866b2e42
commit
707bf1fd26
@ -3,6 +3,7 @@ local S = minetest.get_translator("xdecor")
|
|||||||
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
local FS = function(...) return minetest.formspec_escape(S(...)) end
|
||||||
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
|
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
|
||||||
local MOVES_LIST_SYMBOL_EMPTY = 69
|
local MOVES_LIST_SYMBOL_EMPTY = 69
|
||||||
|
local AI_NAME = S("Dumb AI")
|
||||||
screwdriver = screwdriver or {}
|
screwdriver = screwdriver or {}
|
||||||
|
|
||||||
-- Chess games are disabled because they are currently too broken.
|
-- Chess games are disabled because they are currently too broken.
|
||||||
@ -1423,7 +1424,7 @@ local function ai_move(inv, meta)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if meta:get_string("playerBlack") == "" then
|
if meta:get_string("playerBlack") == "" then
|
||||||
meta:set_string("playerBlack", S("Dumb AI"))
|
meta:set_string("playerBlack", AI_NAME)
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("lastMove", "black")
|
meta:set_string("lastMove", "black")
|
||||||
@ -1478,6 +1479,9 @@ function realchess.fields(pos, _, fields, sender)
|
|||||||
|
|
||||||
if fields.single or fields.multi then
|
if fields.single or fields.multi then
|
||||||
meta:set_string("mode", (fields.single and "single" or "multi"))
|
meta:set_string("mode", (fields.single and "single" or "multi"))
|
||||||
|
if fields.single then
|
||||||
|
meta:set_string("playerBlack", AI_NAME)
|
||||||
|
end
|
||||||
update_formspec(meta)
|
update_formspec(meta)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user