From ecf9af4f85b0264089dcd75eb6237392d0f55241 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 17 Jul 2023 15:54:07 +0200 Subject: [PATCH] Make 'realchess' table private again --- src/chess.lua | 11 ++++++++++- src/chessbot.lua | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/chess.lua b/src/chess.lua index 03e3b28..64221e2 100644 --- a/src/chess.lua +++ b/src/chess.lua @@ -4,8 +4,16 @@ if minetest.get_modpath("realchess") ~= nil then minetest.log("action", "[xdecor] 'realchess' mod detected. Disabling X-Decor-libre's Chess module in favor of realchess") return end -realchess = {} + +-- For making some functions available for the chessbot. +-- It is NOT recommended to use the public chess function outside of this mod! +xdecor.chess = {} + +local realchess = xdecor.chess -- just an alias + +-- Load chess bot code local chessbot = dofile(minetest.get_modpath(minetest.get_current_modname()).."/src/chessbot.lua") + screwdriver = screwdriver or {} -- Translation init @@ -804,6 +812,7 @@ local function get_theoretical_moves_from(meta, board, from_idx) end -- Rate the possible moves depending on its piece value + -- TODO: Move this to chessbot.lua for i in pairs(moves) do local stack_name = board[tonumber(i)] if stack_name ~= "" then diff --git a/src/chessbot.lua b/src/chessbot.lua index 3067331..4784535 100644 --- a/src/chessbot.lua +++ b/src/chessbot.lua @@ -1,5 +1,7 @@ local chessbot = {} +local realchess = xdecor.chess + -- Delay in seconds for a bot moving a piece (excluding choosing a promotion) local BOT_DELAY_MOVE = 1.0 -- Delay in seconds for a bot promoting a piece