diff --git a/README.md b/README.md index 15f176a..f2e1c94 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,12 @@ blocks with special features: * Cauldron: For storing water and cooking soups * Recipe: Pour water in, light a fire below it and throw in some food items. Collect the soup with a bowl -* Chessboard: Play Chess against another player or the computer * Lever: Pull the lever to activate doors next to it * Pressure Plate: Step on it to activate doors next to it +The chessboard, radio and speaker are purely decorative +and have no special functionality. + ### X-Decor-libre vs X-Decor X-Decor is a popular mod in Minetest but it is (as the time of writing this text) @@ -44,7 +46,7 @@ X-Decor with clearly documented licenses and to fix bugs. No new features are planned. #### List of changes -The following bugs of X-Decor (as of 30/06/2023) are fixed: +The following bugs of X-Decor (as of 01/07/2023) are fixed: * Changed packed ice recipe to avoid recipe collision with Ethereal * Changed prison door recipe colliding with Minetest Game's Iron Bar Door @@ -66,7 +68,8 @@ The following bugs of X-Decor (as of 30/06/2023) are fixed: * Minor typo fixes Maintenance updates: -* Renamed blocks +* Chess games were disabled because they were too broken +* Renamed blocks: * "Empty Shelf" to "Plain Shelf" * "Slide Door" to "Paper Door" * "Rooster" to "Weathercock" diff --git a/settingtypes.txt b/settingtypes.txt index b9f8f46..b9f4c34 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -2,8 +2,9 @@ -# This adds a chessboard on which you can play Chess. -enable_xdecor_chess (Enable Chess) bool true +# This adds a decorative chessboard. +# Note: You can't play chess on it. +enable_xdecor_chess (Enable Chessboard) bool true # This enables the cauldron which you can use to store water and cook soup. enable_xdecor_cooking (Enable Cooking) bool true diff --git a/src/chess.lua b/src/chess.lua index ce70677..6038954 100644 --- a/src/chess.lua +++ b/src/chess.lua @@ -4,6 +4,10 @@ local FS = function(...) return minetest.formspec_escape(S(...)) end local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false screwdriver = screwdriver or {} +-- Chess games are disabled because they are currently too broken. +-- Set this to true to enable this again and try your luck. +local ENABLE_CHESS_GAMES = false + local function index_to_xy(idx) if not idx then return nil @@ -1426,7 +1430,7 @@ function realchess.blast(pos) minetest.remove_node(pos) end -minetest.register_node(":realchess:chessboard", { +local chessboarddef = { description = S("Chess Board"), drawtype = "nodebox", paramtype = "light", @@ -1440,14 +1444,44 @@ minetest.register_node(":realchess:chessboard", { node_box = {type = "fixed", fixed = {-.375, -.5, -.375, .375, -.4375, .375}}, sunlight_propagates = true, on_rotate = screwdriver.rotate_simple, - on_blast = realchess.blast, - can_dig = realchess.dig, - on_construct = realchess.init, - on_receive_fields = realchess.fields, - allow_metadata_inventory_move = realchess.move, - on_metadata_inventory_move = realchess.on_move, - allow_metadata_inventory_take = function() return 0 end -}) +} +if ENABLE_CHESS_GAMES then + -- Extend chess board node definition if chess games are enabled + chessboarddef.on_blast = realchess.blast + chessboarddef.can_dig = realchess.dig + chessboarddef.on_construct = realchess.init + chessboarddef.on_receive_fields = realchess.fields + chessboarddef.allow_metadata_inventory_move = realchess.move + chessboarddef.on_metadata_inventory_move = realchess.on_move + chessboarddef.allow_metadata_inventory_take = function() return 0 end + + minetest.register_lbm({ + label = "Re-initialize chessboard (enable Chess games)", + name = "xdecor:chessboard_reinit", + nodenames = {"realchess:chessboard"}, + run_at_every_load = true, + action = function(pos, node) + -- Init chessboard only if it was already d + local meta = minetest.get_meta(pos) + if meta:get_string("formspec", "") then + realchess.init(pos) + end + end, + }) +else + minetest.register_lbm({ + label = "Clear chessboard formspec+infotext (disable Chess games)", + name = "xdecor:chessboard_clear", + nodenames = {"realchess:chessboard"}, + run_at_every_load = true, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "") + meta:set_string("infotext", "") + end, + }) +end +minetest.register_node(":realchess:chessboard", chessboarddef) local function register_piece(name, white_desc, black_desc, count) for _, color in pairs({"black", "white"}) do