From 9acd36bf9981cf9cb8e82785508d6eb7f010cc77 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Tue, 10 Sep 2019 21:18:42 +0200 Subject: [PATCH] Formspecs: Introduce formspec_version to mods --- builtin/game/features.lua | 1 + doc/lua_api.txt | 14 ++++++++++++++ src/client/client.cpp | 3 ++- src/client/game.cpp | 2 +- src/gui/guiFormSpecMenu.cpp | 9 ++++++++- src/gui/guiFormSpecMenu.h | 4 ++-- src/network/networkprotocol.h | 12 +++++++++++- src/network/serverpackethandler.cpp | 3 +++ src/remoteplayer.h | 3 +++ src/script/lua_api/l_server.cpp | 4 ++++ src/server.cpp | 9 +++++---- 11 files changed, 54 insertions(+), 10 deletions(-) diff --git a/builtin/game/features.lua b/builtin/game/features.lua index cf21303c7..51d21e86c 100644 --- a/builtin/game/features.lua +++ b/builtin/game/features.lua @@ -13,6 +13,7 @@ core.features = { object_use_texture_alpha = true, object_independent_selectionbox = true, httpfetch_binary_data = true, + formspec_version_element = true, } function core.has_feature(arg) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 7fae20603..b809e18c3 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1959,6 +1959,15 @@ Examples Elements -------- +### `formspec_version[]` + +* Set the formspec version to a certain number. If not specified, + version 1 is assumed. +* Must be specified before `size` element. +* Clients older than this version can neither show newer elements nor display + elements with new arguments correctly. +* Available since feature `formspec_version_element`. + ### `size[,,]` * Define the size of the menu in inventory slots @@ -1995,6 +2004,7 @@ Elements ### `real_coordinates[]` +* INFORMATION: Enable it automatically using `formspec_version` version 2 or newer. * When set to true, all following formspec elements will use the new coordinate system. * If used immediately after `size`, `position`, `anchor`, and `no_prepend` elements (if present), the form size will use the new coordinate system. @@ -2114,6 +2124,7 @@ Elements image shall be sized 8 times 16px times 4 times 16px * If `auto_clip` is `true`, the background is clipped to the formspec size (`x` and `y` are used as offset values, `w` and `h` are ignored) +* Available since formspec version 2 ### `pwdfield[,;,;;