1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

Remove 3 unused Lua functions:

- entityFollowEntity()
- entity_followEntity()
- entity_isFollowingEntity()
This commit is contained in:
fgenesis 2022-12-09 04:20:17 +01:00
parent 0edb2d609a
commit b17afecd4b
4 changed files with 3 additions and 99 deletions

View file

@ -208,7 +208,6 @@ Entity::Entity()
damageTime = vars->entityDamageTime;
slowingToStopPathTimer = 0;
slowingToStopPath = 0;
followPos = 0;
swimPath = false;
currentEntityTarget = 0;
deleteOnPathEnd = false;
@ -233,8 +232,6 @@ Entity::Entity()
activationRadius = 40;
activationRange = 600;
followEntity = 0;
bubble = 0;
@ -452,8 +449,6 @@ float Entity::moveToPos(Vector dest, float speed, int dieOnPathEnd, bool swim)
speed = getMaxSpeed();
Vector start = position;
followEntity = 0;
position.ensureData();
position.data->path.clear();
@ -1597,61 +1592,9 @@ void Entity::onUpdate(float dt)
if (getState() == STATE_PUSH)
{
vel = pushVec;
}
else if (followEntity)
{
Vector lastPos = position;
Vector off;
int sz = 96;
if (followEntity->vel.getSquaredLength2D() > sqr(1))
{
off = followEntity->vel.getPerpendicularLeft();
switch (followPos)
{
case 0: off.setLength2D(sz); break;
case 1: off.setLength2D(-sz); break;
}
}
else if (followEntity->lastMove.getSquaredLength2D() > sqr(1))
{
off = followEntity->lastMove.getPerpendicularLeft();
switch (followPos)
{
case 0: off.setLength2D(sz); break;
case 1: off.setLength2D(-sz); break;
}
}
Vector mov = followEntity->position + off - this->position;
if (mov.getSquaredLength2D() > sqr(96))
{
int spd = mov.getLength2D();
spd -= 64;
if (spd < 0)
spd = 0;
else if (spd < 400)
spd *= 2;
else
spd = 800;
mov.setLength2D(spd);
position += mov * dt;
Vector diff = position - lastPos;
movementDetails(diff);
}
else
{
Animation *anim = skeletalSprite.getCurrentAnimation();
if (!anim || anim->name != "idle")
idle();
}
}
if (stickToNaijasHead)
{
position = dsq->game->avatar->headPosition;

View file

@ -132,7 +132,6 @@ public:
ActivationType activationType;
float activationRange;
Entity *followEntity;
Entity *ridingOnEntity;
Vector startPos;
void rotateToVec(Vector addVec, float time, float offsetAngle=0);
@ -220,7 +219,6 @@ public:
bool isNormalLayer() const;
void idle();
int followPos;
void slowToStopPath(float t);
bool isSlowingToStopPath();
Vector lastMove;

View file

@ -6603,42 +6603,6 @@ luaFunc(entity_setCurrentTarget)
luaReturnNil();
}
luaFunc(entityFollowEntity)
{
Entity *e = dsq->getEntityByName(getString(L, 1));
if (e)
{
e->followEntity = dsq->getEntityByName(getString(L, 2));
}
luaReturnNil();
}
luaFunc(entity_isFollowingEntity)
{
Entity *e = entity(L);
bool v = false;
if (e)
v = e->followEntity != 0;
luaReturnBool(v);
}
luaFunc(entity_followEntity)
{
Entity *e1 = entity(L);
Entity *e2 = 0;
if (lua_touserdata(L, 2) != NULL)
{
e2 = entity(L, 2);
}
if (e1)
{
e1->followEntity = e2;
e1->followPos = lua_tointeger(L, 3);
}
luaReturnNil();
}
luaFunc(toggleInput)
{
bool v = getBool(L, 1);
@ -10300,7 +10264,6 @@ static const struct {
luaRegister(entity_followPath),
luaRegister(entity_followPathSpeed),
luaRegister(entity_isFollowingPath),
luaRegister(entity_followEntity),
luaRegister(entity_sound),
luaRegister(entity_playSfx),
@ -10355,8 +10318,6 @@ static const struct {
luaRegister(toggleBlackBars),
luaRegister(setBlackBarsColor),
luaRegister(entityFollowEntity),
luaRegister(bedEffects),
luaRegister(warpNaijaToEntity),
@ -10751,7 +10712,6 @@ static const struct {
luaRegister(entity_isSlowingToStopPath),
luaRegister(entity_findNearestEntityOfType),
luaRegister(entity_isFollowingEntity),
luaRegister(entity_resumePath),
luaRegister(entity_generateCollisionMask),

View file

@ -24,6 +24,8 @@ local WARN_FUNCTIONS =
entity_grabTarget = true,
entity_releaseTarget = true,
entity_watchEntity = true,
entityFollowEntity = true,
entity_followEntity = true,
}
-- These returned something important, so here we just return a failure/dummy value
@ -72,6 +74,7 @@ local DUMMY_FUNCTIONS =
streamSfx = true,
toggleVersionLabel = true,
setVersionLabelText = true,
entity_isFollowingEntity = true, -- never following anything now since those functions are gone
}
-- Deprecated stuff from v1.1's scripts/entities/entityinclude.lua