diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 24a9186f7..47b94a5d9 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -673,8 +673,14 @@ int LuaEntitySAO::punch(v3f dir, { setHP(getHP() - result.damage); + + std::string punchername = "nil"; + + if ( puncher != 0 ) + punchername = puncher->getDescription(); + actionstream<getDescription()<<", damage "<getDescription(); + actionstream<<"Player "<getName()<<" punched by " - <getDescription()<<", damage "<getBasePosition() - puncher->getBasePosition(); - else - dir = read_v3f(L, 5); + } + float time_from_last_punch = 1000000; if(lua_isnumber(L, 3)) time_from_last_punch = lua_tonumber(L, 3); + ToolCapabilities toolcap = read_tool_capabilities(L, 4); + + if(lua_type(L, 5) == LUA_TTABLE) + dir = read_v3f(L, 5); dir.normalize(); + // Do it co->punch(dir, &toolcap, puncher, time_from_last_punch); return 0;