From 0edb2d609ac6d33b111be7134c48cc241b136221 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Fri, 9 Dec 2022 04:14:10 +0100 Subject: [PATCH] Remove unused Lua func entity_watchEntity() --- Aquaria/Entity.cpp | 23 ------------------- Aquaria/Entity.h | 2 -- Aquaria/ScriptInterface.cpp | 16 ------------- .../scripts/compat/internal/oldfunctions.lua | 1 + 4 files changed, 1 insertion(+), 41 deletions(-) diff --git a/Aquaria/Entity.cpp b/Aquaria/Entity.cpp index 2865ca6..7b97628 100644 --- a/Aquaria/Entity.cpp +++ b/Aquaria/Entity.cpp @@ -209,7 +209,6 @@ Entity::Entity() slowingToStopPathTimer = 0; slowingToStopPath = 0; followPos = 0; - watchingEntity = 0; swimPath = false; currentEntityTarget = 0; deleteOnPathEnd = false; @@ -534,11 +533,6 @@ bool Entity::hasTarget(int t) return (targets[t]!=0); } -void Entity::watchEntity(Entity *e) -{ - watchingEntity = e; -} - void Entity::destroy() { if (stopSoundsOnDeath) @@ -1589,23 +1583,6 @@ void Entity::onUpdate(float dt) { movementDetails(v); } - else - { - if (watchingEntity) - { - Vector v = position - watchingEntity->position; - if (v.x < 0) - { - if (!isfh()) - flipHorizontal(); - } - else if (v.x > 0) - { - if (isfh()) - flipHorizontal(); - } - } - } if (wasFollowing && !isFollowingPath()) { diff --git a/Aquaria/Entity.h b/Aquaria/Entity.h index cae5007..cf18ca8 100644 --- a/Aquaria/Entity.h +++ b/Aquaria/Entity.h @@ -219,7 +219,6 @@ public: void doFriction(float dt, float len); bool isNormalLayer() const; - void watchEntity(Entity *e); void idle(); int followPos; void slowToStopPath(float t); @@ -393,7 +392,6 @@ protected: float slowingToStopPathTimer, slowingToStopPath; void movementDetails(Vector v); - Entity *watchingEntity; virtual void onPathEnd(); InterpolatedVector multColor; EntityType entityType; diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 9404976..0ef2d8b 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -5917,20 +5917,6 @@ luaFunc(entity_getDistanceToPoint) luaReturnNum(dist); } -luaFunc(entity_watchEntity) -{ - Entity *e = entity(L); - Entity *e2 = 0; - if (lua_touserdata(L, 2) != NULL) - e2 = entity(L, 2); - - if (e) - { - e->watchEntity(e2); - } - luaReturnNil(); -} - luaFunc(setNaijaHeadTexture) { Avatar *a = dsq->game->avatar; @@ -10757,8 +10743,6 @@ static const struct { luaRegister(setSceneColor2), luaRegister(getSceneColor2), - luaRegister(entity_watchEntity), - luaRegister(entity_isEntityInRange), luaRegister(entity_isPositionInRange), diff --git a/files/scripts/compat/internal/oldfunctions.lua b/files/scripts/compat/internal/oldfunctions.lua index 20d772d..aafab11 100644 --- a/files/scripts/compat/internal/oldfunctions.lua +++ b/files/scripts/compat/internal/oldfunctions.lua @@ -23,6 +23,7 @@ local WARN_FUNCTIONS = setupConversationEntity = true, entity_grabTarget = true, entity_releaseTarget = true, + entity_watchEntity = true, } -- These returned something important, so here we just return a failure/dummy value