aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/game.cpp6
-rw-r--r--src/client/game.h2
-rw-r--r--src/defaultsettings.cpp2
-rw-r--r--src/script/lua_api/l_client.cpp46
-rw-r--r--src/script/lua_api/l_client.h6
-rwxr-xr-xutil/buildbot/buildwin32.sh4
-rwxr-xr-xutil/buildbot/buildwin64.sh4
7 files changed, 60 insertions, 10 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 10c3a7ceb..4862d3ed9 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -2563,7 +2563,7 @@ void Game::handlePointingAtNode(const PointedThing &pointed,
bool Game::nodePlacement(const ItemDefinition &selected_def,
const ItemStack &selected_item, const v3s16 &nodepos, const v3s16 &neighbourpos,
- const PointedThing &pointed, const NodeMetadata *meta)
+ const PointedThing &pointed, const NodeMetadata *meta, bool force)
{
std::string prediction = selected_def.node_placement_prediction;
const NodeDefManager *nodedef = client->ndef();
@@ -2579,7 +2579,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
// formspec in meta
if (meta && !meta->getString("formspec").empty() && !input->isRandom()
- && !isKeyDown(KeyType::SNEAK)) {
+ && !isKeyDown(KeyType::SNEAK) && !force) {
// on_rightclick callbacks are called anyway
if (nodedef_manager->get(map.getNode(nodepos)).rightclickable)
client->interact(INTERACT_PLACE, pointed);
@@ -2603,7 +2603,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
// on_rightclick callback
if (prediction.empty() || (nodedef->get(node).rightclickable &&
- !isKeyDown(KeyType::SNEAK))) {
+ !isKeyDown(KeyType::SNEAK) && !force)) {
// Report to server
client->interact(INTERACT_PLACE, pointed);
return false;
diff --git a/src/client/game.h b/src/client/game.h
index af0b7ef54..50a734be6 100644
--- a/src/client/game.h
+++ b/src/client/game.h
@@ -822,7 +822,7 @@ public:
bool nodePlacement(const ItemDefinition &selected_def, const ItemStack &selected_item,
const v3s16 &nodepos, const v3s16 &neighbourpos, const PointedThing &pointed,
- const NodeMetadata *meta);
+ const NodeMetadata *meta, bool force = false);
static const ClientEventHandler clientEventHandler[CLIENTEVENT_MAX];
InputHandler *input = nullptr;
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 6e4e348d0..a1cd61932 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -417,7 +417,7 @@ void set_default_settings()
settings->setDefault("max_simultaneous_block_sends_per_client", "40");
settings->setDefault("time_send_interval", "5");
- settings->setDefault("default_game", "mineclone2");
+ settings->setDefault("default_game", "MineClone2");
settings->setDefault("motd", "");
settings->setDefault("max_users", "15");
settings->setDefault("creative_mode", "false");
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index dac2febae..484af2ec3 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -440,7 +440,7 @@ int ModApiClient::l_place_node(lua_State *L)
pointed.node_abovesurface = pos;
pointed.node_undersurface = pos;
NodeMetadata *meta = map.getNodeMetadata(pos);
- g_game->nodePlacement(selected_def, selected_item, pos, pos, pointed, meta);
+ g_game->nodePlacement(selected_def, selected_item, pos, pos, pointed, meta, true);
return 0;
}
@@ -621,6 +621,48 @@ int ModApiClient::l_interact(lua_State *L)
return 1;
}
+StringMap *table_to_stringmap(lua_State *L, int index)
+{
+ StringMap *m = new StringMap;
+
+ lua_pushvalue(L, index);
+ lua_pushnil(L);
+
+ while (lua_next(L, -2)) {
+ lua_pushvalue(L, -2);
+ std::basic_string<char> key = lua_tostring(L, -1);
+ std::basic_string<char> value = lua_tostring(L, -2);
+ (*m)[key] = value;
+ lua_pop(L, 2);
+ }
+
+ lua_pop(L, 1);
+
+ return m;
+}
+
+// send_inventory_fields(formname, fields)
+// Only works if the inventory form was opened beforehand.
+int ModApiClient::l_send_inventory_fields(lua_State *L)
+{
+ std::string formname = luaL_checkstring(L, 1);
+ StringMap *fields = table_to_stringmap(L, 2);
+
+ getClient(L)->sendInventoryFields(formname, *fields);
+ return 0;
+}
+
+// send_nodemeta_fields(position, formname, fields)
+int ModApiClient::l_send_nodemeta_fields(lua_State *L)
+{
+ v3s16 pos = check_v3s16(L, 1);
+ std::string formname = luaL_checkstring(L, 2);
+ StringMap *m = table_to_stringmap(L, 3);
+
+ getClient(L)->sendNodemetaFields(pos, formname, *m);
+ return 0;
+}
+
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
@@ -657,4 +699,6 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(get_objects_inside_radius);
API_FCT(make_screenshot);
API_FCT(interact);
+ API_FCT(send_inventory_fields);
+ API_FCT(send_nodemeta_fields);
}
diff --git a/src/script/lua_api/l_client.h b/src/script/lua_api/l_client.h
index 03a42e022..caf21f78e 100644
--- a/src/script/lua_api/l_client.h
+++ b/src/script/lua_api/l_client.h
@@ -132,6 +132,12 @@ private:
// interact(action, pointed_thing)
static int l_interact(lua_State *L);
+ // send_inventory_fields(formname, fields)
+ static int l_send_inventory_fields(lua_State *L);
+
+ // send_nodemeta_fields(position, formname, fields)
+ static int l_send_nodemeta_fields(lua_State *L);
+
public:
static void Initialize(lua_State *L, int top);
};
diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh
index a4238fbd8..c99a0db7a 100755
--- a/util/buildbot/buildwin32.sh
+++ b/util/buildbot/buildwin32.sh
@@ -4,9 +4,9 @@ set -e
CORE_GIT=https://github.com/EliasFleckenstein03/dragonfireclient
CORE_BRANCH=master
CORE_NAME=dragonfireclient
-GAME_GIT=https://git.minetest.land/Wuzzy/MineClone2
+GAME_GIT=https://git.minetest.land/MineClone2/MineClone2
GAME_BRANCH=master
-GAME_NAME=mineclone2
+GAME_NAME=MineClone2
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ $# -ne 1 ]; then
diff --git a/util/buildbot/buildwin64.sh b/util/buildbot/buildwin64.sh
index 1b680cf5b..6d4ed47a1 100755
--- a/util/buildbot/buildwin64.sh
+++ b/util/buildbot/buildwin64.sh
@@ -4,9 +4,9 @@ set -e
CORE_GIT=https://github.com/EliasFleckenstein03/dragonfireclient
CORE_BRANCH=master
CORE_NAME=dragonfireclient
-GAME_GIT=https://git.minetest.land/Wuzzy/MineClone2
+GAME_GIT=https://git.minetest.land/MineClone2/MineClone2
GAME_BRANCH=master
-GAME_NAME=mineclone2
+GAME_NAME=MineClone2
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ $# -ne 1 ]; then