diff options
Diffstat (limited to 'src/scripting')
-rw-r--r-- | src/scripting/lua.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 726c14e0..6185e840 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1380,6 +1380,23 @@ static int entity_walk(lua_State *s) return 0; } +/** LUA entity:destination (being) + * local x, y = entity:destination() + ** + * Valid only for being entities. + * + * **Return value:** The x and y coordinates of the destination. + */ +static int entity_destination(lua_State *s) +{ + Entity *being = checkBeing(s, 1); + auto *beingComponent = being->getComponent<BeingComponent>(); + const Point &point = beingComponent->getDestination(); + lua_pushinteger(s, point.x); + lua_pushinteger(s, point.y); + return 2; +} + /** LUA entity:heal (being) * entity:heal([int value]) ** @@ -3371,6 +3388,7 @@ LuaScript::LuaScript(): { "ability_mana", entity_get_ability_mana }, { "cooldown_ability", entity_cooldown_ability }, { "walk", entity_walk }, + { "destination", entity_destination }, { "heal", entity_heal }, { "name", entity_get_name }, { "type", entity_get_type }, |