From 84f1b12c67867669b0a80f9735d3ace662315af8 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sun, 29 Sep 2013 01:27:36 +0200 Subject: [PATCH] Add riding related Lua functions: - entity_getRidingPosition() - entity_getRidingRotation() - entity_getRidingFlip() --- Aquaria/ScriptInterface.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 6b413be..22b627e 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -2435,6 +2435,28 @@ luaFunc(entity_setRidingData) luaReturnNil(); } +luaFunc(entity_getRidingPosition) +{ + Entity *e = entity(L); + Vector v; + if (e) + v = e->getRidingPosition(); + luaReturnVec2(v.x, v.y); +} + +luaFunc(entity_getRidingRotation) +{ + Entity *e = entity(L); + luaReturnNum(e ? e->getRidingRotation() : 0.0f); +} + +luaFunc(entity_getRidingFlip) +{ + Entity *e = entity(L); + luaReturnBool(e && e->getRidingFlip()); +} + + luaFunc(entity_setBoneLock) { Entity *e = entity(L); @@ -8561,6 +8583,9 @@ static const struct { luaRegister(entity_setRidingPosition), luaRegister(entity_setRidingData), + luaRegister(entity_getRidingPosition), + luaRegister(entity_getRidingRotation), + luaRegister(entity_getRidingFlip), luaRegister(entity_setBoneLock), luaRegister(entity_setIngredient), luaRegister(entity_setDeathScene),