diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-27 18:11:13 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-05-08 14:02:51 +0200 |
commit | 0a1332f04b841bc32e09552665e5cd611fa23ca8 (patch) | |
tree | c0afc18cff01a6dbd028692fc3170d88bc47533b /src/scripting | |
parent | 06027d423e179ea3b479284c466725ed4c76ca7a (diff) | |
download | manaserv-0a1332f04b841bc32e09552665e5cd611fa23ca8.tar.gz manaserv-0a1332f04b841bc32e09552665e5cd611fa23ca8.tar.xz manaserv-0a1332f04b841bc32e09552665e5cd611fa23ca8.zip |
[Abilities] Added a add_hit_taken bind
This allows to display hit messages in the client for abilities
Diffstat (limited to 'src/scripting')
-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 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 } }; |