From 0a1332f04b841bc32e09552665e5cd611fa23ca8 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sat, 27 Apr 2013 18:11:13 +0200 Subject: [Abilities] Added a add_hit_taken bind This allows to display hit messages in the client for abilities --- src/scripting/lua.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/scripting') 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()->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 } }; -- cgit