summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-08-16 22:06:47 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-08-26 22:56:47 +0200
commit707a9e5252237c011c821644b9483cefe64f719c (patch)
treeefc5577cdcc5cfcd948dc89c363d5477385e6ebc /src
parent7f79610cdcd5bd55de8d4e413f0679ef634b0a37 (diff)
downloadmanaserv-707a9e5252237c011c821644b9483cefe64f719c.tar.gz
manaserv-707a9e5252237c011c821644b9483cefe64f719c.tar.bz2
manaserv-707a9e5252237c011c821644b9483cefe64f719c.tar.xz
manaserv-707a9e5252237c011c821644b9483cefe64f719c.zip
Allow abilities name for use_ability()
Diffstat (limited to 'src')
-rw-r--r--src/scripting/lua.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 759ae50b..c151b9fa 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -2308,6 +2308,7 @@ static int entity_take_ability(lua_State *s)
/** LUA entity:use_ability (being)
* entity:use_ability(int ability)
+ * entity:use_ability(string ability)
**
* Valid only for character and monster entities.
*
@@ -2319,21 +2320,22 @@ static int entity_take_ability(lua_State *s)
static int entity_use_ability(lua_State *s)
{
Entity *b = checkBeing(s, 1);
- const int ability = luaL_checkint(s, 2);
+ auto abilityInfo = checkAbility(s, 2);
+ const int id = abilityInfo->id;
bool targetIsBeing = lua_gettop(s) == 3;
auto *abilityComponent = b->getComponent<AbilityComponent>();
if (targetIsBeing)
{
Entity *target = checkBeing(s, 3);
- lua_pushboolean(s, abilityComponent->useAbilityOnBeing(*b, ability,
+ lua_pushboolean(s, abilityComponent->useAbilityOnBeing(*b, id,
target));
}
else
{
const int x = luaL_checkint(s, 3);
const int y = luaL_checkint(s, 4);
- lua_pushboolean(s, abilityComponent->useAbilityOnPoint(*b, ability,
+ lua_pushboolean(s, abilityComponent->useAbilityOnPoint(*b, id,
x, y));
}