summaryrefslogtreecommitdiffstats
path: root/src/scripting/lua.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripting/lua.cpp')
-rw-r--r--src/scripting/lua.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 3fd1651..6258af3 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -2010,6 +2010,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()
**
@@ -3754,6 +3768,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 }
};