diff options
Diffstat (limited to 'src/scripting/lua.cpp')
-rw-r--r-- | src/scripting/lua.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 2f84dd6e..11a3feea 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -2065,6 +2065,20 @@ static int xp_for_level(lua_State *s) return 1; } +/** LUA entity:add_hit_taken (being) + * add_hit_taken(int damage) + ** + * Adds a damage value to the taken hits of a being. This list will be send to + * all clients in the view range in order to allow to display the hit particles. + */ +static int entity_add_hit_taken(lua_State *s) +{ + Entity *c = checkBeing(s, 1); + const int damage = luaL_checkinteger(s, 2); + c->getComponent<BeingComponent>()->addHitTaken(damage); + return 0; +} + /** LUA entity:hair_color (being) * entity:hair_color() ** @@ -3817,6 +3831,7 @@ LuaScript::LuaScript(): { "has_status", entity_has_status }, { "status_time", entity_get_status_time }, { "set_status_time", entity_set_status_time }, + { "add_hit_taken", entity_add_hit_taken }, { nullptr, nullptr } }; |