aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-08-15 15:45:28 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-08-15 15:45:28 +0200
commit3bed0981d058b512bfb8aeeeeed235c9ee9385af (patch)
tree8f3b06e1ac849fecf684af1ba7bb2e72eaed4b5d /src
parent622d547262ee6800810b228d9641edff63848e0c (diff)
downloaddragonfireclient-3bed0981d058b512bfb8aeeeeed235c9ee9385af.tar.xz
UI Update; Added AutoTool
Diffstat (limited to 'src')
-rw-r--r--src/client/game.cpp2
-rw-r--r--src/script/lua_api/l_localplayer.cpp13
-rw-r--r--src/script/lua_api/l_localplayer.h3
3 files changed, 17 insertions, 1 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index b08dac878..b9e7e4d9b 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -2290,7 +2290,7 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
f32 d = getToolRange(selected_def, hand_item.getDefinition(itemdef_manager));
if (g_settings->getBool("increase_tool_range"))
- d++;
+ d += 2;
if (g_settings->getBool("increase_tool_range_plus"))
d = 1000;
diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp
index bde120c1d..2644893f9 100644
--- a/src/script/lua_api/l_localplayer.cpp
+++ b/src/script/lua_api/l_localplayer.cpp
@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/c_content.h"
#include "client/client.h"
#include "client/content_cao.h"
+#include "client/game.h"
LuaLocalPlayer::LuaLocalPlayer(LocalPlayer *m) : m_localplayer(m)
{
@@ -86,6 +87,17 @@ int LuaLocalPlayer::l_get_wield_index(lua_State *L)
return 1;
}
+// set_wield_index(self)
+int LuaLocalPlayer::l_set_wield_index(lua_State *L)
+{
+ LocalPlayer *player = getobject(L, 1);
+ u32 index = luaL_checkinteger(L, 2);
+
+ player->setWieldIndex(index);
+ g_game->processItemSelection(&g_game->runData.new_playeritem);
+ return 0;
+}
+
// get_wielded_item(self)
int LuaLocalPlayer::l_get_wielded_item(lua_State *L)
{
@@ -468,6 +480,7 @@ const luaL_Reg LuaLocalPlayer::methods[] = {
luamethod(LuaLocalPlayer, get_hp),
luamethod(LuaLocalPlayer, get_name),
luamethod(LuaLocalPlayer, get_wield_index),
+ luamethod(LuaLocalPlayer, set_wield_index),
luamethod(LuaLocalPlayer, get_wielded_item),
luamethod(LuaLocalPlayer, is_attached),
luamethod(LuaLocalPlayer, is_touching_ground),
diff --git a/src/script/lua_api/l_localplayer.h b/src/script/lua_api/l_localplayer.h
index 2c9881d58..a5d1081c7 100644
--- a/src/script/lua_api/l_localplayer.h
+++ b/src/script/lua_api/l_localplayer.h
@@ -43,6 +43,9 @@ private:
// get_wield_index(self)
static int l_get_wield_index(lua_State *L);
+
+ // set_wield_index(self)
+ static int l_set_wield_index(lua_State *L);
// get_wielded_item(self)
static int l_get_wielded_item(lua_State *L);